DHCP Options

This topic describes how to manage the Dynamic Host Configuration Protocol (DHCP) options in a virtual cloud network (VCN).

Overview of DHCP Options

The Networking service uses DHCP to automatically provide configuration information to instances when they boot up. Although DHCP lets you change some settings dynamically, others are static and never change. For example, when you launch an instance, either you or Oracle specifies the instance's private IP address. Each time the instance boots up or you restart the instance's DHCP client, DHCP passes that same private IP address to the instance. The address never changes during the instance's lifetime.

The Networking service provides DHCP options to let you control certain types of configuration on the instances in your VCN. You can change the values of these options at your discretion, unlike the static information that DHCP provides to the instance. The changes take effect the next time you restart a given instance's DHCP client or reboot the instance. For more details, see Important Notes about Your Instances and DHCP Options.

Each subnet in a VCN can have a single set of DHCP options associated with it. That set of options applies to all instances in the subnet. Each VCN comes with a default set of DHCP options with initial values that you can change. If you don't specify otherwise, every subnet uses the VCN's default set of DHCP options.

The following table summarizes the available DHCP options you can configure.

DHCP Option Possible Values Initial Value in the Default DHCP Options Notes
Domain Name Server

DNS Type:

  • Internet and VCN Resolver
  • Custom Resolver
DNS Type = Internet and VCN resolver. For more information, see Choices for DNS in Your VCN. If you set DNS Type = Custom Resolver, you can specify up to three DNS servers of your choice. For more information, see Choices for DNS in Your VCN.
Search Domain A single search domain

If you've set up your VCN with a DNS label, the default value for the Search Domain option is the VCN domain name ( <VCN DNS label>.oraclevcn.com). Otherwise, the Search Domain option is not present in the default set of DHCP options.

In general, when any set of DHCP options is initially created (the default set or a custom set you create), the Networking service automatically adds the Search Domain option and sets it to the VCN domain name ( <VCN-DNS-label>.oraclevcn.com) if all of these are true:

  • The VCN has a DNS label
  • DNS Type = Internet and VCN Resolver
  • You did NOT specify a search domain of your choice during creation of the set of DHCP options

After the set of DHCP options is created, you can always remove the Search Domain option or set it to a different value.

You can specify only a single search domain in a set of DHCP options.

Working with DHCP Options

When you create a subnet, you specify which set of DHCP options to associate with the subnet. If you don't, the default set of DHCP options for the VCN is used. You can change which set of DHCP options the subnet uses at any time.

When creating a new set of DHCP options, you may optionally assign it a friendly name. It doesn't have to be unique, and you can change it later. Oracle automatically assigns the set of options a unique identifier called an Oracle Cloud ID (OCID). For more information, see Resource Identifiers.

You can change the values of an individual DHCP option in a set, but notice that when you use the REST API to update a single option in a set, the new set of options replaces the entire existing set.

To delete a set of DHCP options, it must not be associated with a subnet yet. You can't delete a VCN's default set of DHCP options.

See Service Limits for a list of applicable limits and instructions for requesting a limit increase.

Required IAM Policy

To use Oracle Cloud Infrastructure, you must be granted security access in a policy  by an administrator. This access is required whether you're using the Console or the REST API with an SDK, CLI, or other tool. If you get a message that you don’t have permission or are unauthorized, verify with your administrator what type of access you have and which compartment  to work in.

For administrators: see IAM Policies for Networking.

Important Notes about Your Instances and DHCP Options

Whenever you change the value of one of the DHCP options, you must do one of the following for the change to take effect on existing instances in the subnets associated with that set of DHCP options: either restart the DHCP client on the instance, or reboot the instance.

Make sure to keep the DHCP client running so you can always access the instance. If you stop the DHCP client manually or disable NetworkManager (which stops the DHCP client on Linux instances), the instance can't renew its DHCP lease and will become inaccessible when the lease expires (typically within 24 hours). Do not disable NetworkManager unless you use another method to ensure renewal of the lease.

Stopping the DHCP client might remove the host route table when the lease expires. Also, loss of network connectivity to your iSCSI connections might result in loss of the boot drive.

Any changes you make to the /etc/resolv.conf file are overwritten whenever the DHCP lease is renewed or the instance is rebooted.

Changes you make to the /etc/hosts file are overwritten whenever the DHCP lease is renewed or the instance is rebooted. To persist your changes to the /etc/hosts file in Oracle Linux or CentOS instances, add the following line to /etc/oci-hostname.conf:

PRESERVE_HOSTINFO=2

If the /etc/oci-hostname.conf file does not exist, create it.

Using the Console

To view a VCN's set of default DHCP options
  1. Open the navigation menu, click Networking, and then click Virtual cloud networks.
  2. Click the VCN you're interested in.
  3. Under Resources, click DHCP Options.

    The default set and its details are displayed in the list.

To update options in an existing set of DHCP options
  1. Open the navigation menu, click Networking, and then click Virtual cloud networks.
  2. Click the VCN you're interested in.
  3. Under Resources, click DHCP Options.
  4. For the set you're interested in, click the Actions menu (Actions Menu), and then click Edit:

    • For DNS Type: If want instances in the subnet to resolve internet hostnames and hostnames of instances in the VCN, select Internet and VCN Resolver. Or to use a DNS server of your choice, select Custom Resolver and then enter the server's IP address (three servers maximum). For more information, see DNS in Your Virtual Cloud Network.
    • For Search Domain: If you want instances in the subnet to append a particular search domain when resolving DNS queries, enter it here. If the Search Domain option is already set to the VCN domain name and you're not sure why, see the details in Overview of DHCP Options.
  5. When you're done, click Save Changes.
  6. If you have any existing instances in a subnet that uses this set of DHCP options, make sure to restart the DHCP client on each affected instance, or reboot the instance itself so that it picks up the new setting.
To create a new set of DHCP options
  1. Open the navigation menu, click Networking, and then click Virtual cloud networks.
  2. Click the VCN you're interested in.
  3. Under Resources, click DHCP Options.
  4. Click Create DHCP Options.
  5. Enter the following:

    • Name: A friendly name for the set of options. It doesn't have to be unique, and you can change it later. Avoid entering confidential information.
    • Create in Compartment: The compartment where you want to create the set of DHCP options, if different from the compartment you're currently working in.
    • DNS Type: If want instances in the subnet to resolve internet hostnames and hostnames of instances in the VCN, select Internet and VCN Resolver. Or to use a DNS server of your choice, select Custom Resolver and then enter the server's IP address (three servers maximum). For more information, see DNS in Your Virtual Cloud Network.
    • Search Domain: If you want instances in the subnet to append a particular search domain when resolving DNS queries, enter it here. Be aware that the Networking service automatically sets the Search Domain option in certain situations. See the details in Overview of DHCP Options.
    • Tags: If you have permissions to create a resource, then you also have permissions to apply free-form tags to that resource. To apply a defined tag, you must have permissions to use the tag namespace. For more information about tagging, see Resource Tags. If you're not sure whether to apply tags, skip this option or ask an administrator. You can apply tags later.
  6. When you're done, click Create DHCP Options.

The set of options is created and then displayed on the DHCP Options page of the compartment you chose. You can now specify this set of options when creating or updating a subnet.

To change which set of DHCP options a subnet uses
  1. Open the navigation menu, click Networking, and then click Virtual cloud networks.
  2. Click the VCN you're interested in.
  3. Click Subnets.
  4. Click the subnet you're interested in.
  5. Click Edit.
  6. In the DHCP Options section, select the new set of DHCP options you want the subnet to use.
  7. Click Save Changes.

    The changes take effect within a few seconds.

To delete a set of DHCP options

Prerequisite: To delete a set of DHCP options, it must not be associated with a subnet yet. You can't delete the default set of DHCP options in a VCN.

  1. Open the navigation menu, click Networking, and then click Virtual cloud networks.
  2. Click the VCN you're interested in.
  3. Under Resources, click DHCP Options.
  4. For the set you want to delete, click the Actions menu (Actions Menu), and then click Terminate.
  5. Confirm when prompted.
To manage tags for a set of DHCP options
  1. Open the navigation menu, click Networking, and then click Virtual cloud networks.
  2. Click the VCN you're interested in.
  3. Under Resources, click DHCP Options.
  4. For the set you're interested in, click the Actions menu (Actions Menu), and then click View Tags. From there you can view the existing tags, edit them, and apply new ones.

For more information, see Resource Tags.

To move a set of DHCP options to a different compartment

You can move a set of DHCP options from one compartment to another. When you move a set of DHCP options to a new compartment, inherent policies apply immediately.

  1. Open the navigation menu, click Networking, and then click Virtual cloud networks.
  2. Click the VCN you're interested in.
  3. Under Resources, click DHCP Options.
  4. For the set you're interested in, click the Actions menu (Actions Menu), and then click Move Resource.
  5. Choose the destination compartment from the list.
  6. Click Move Resource.

For more information about using compartments and policies to control access to your cloud network, see Access Control. For general information about compartments, see Managing Compartments.