This topic describes how to create a Dynamic Host Configuration Protocol (DHCP) options set and associate it with a Virtual Private Cloud (VPC) network. After a DHCP options set is associated with a VPC network, existing and new Elastic Compute Service (ECS) instances in the VPC network all use the configurations of the DHCP options set.

Note The DHCP options sets feature is in public preview and is available only in the following regions: China (Chengdu), India (Mumbai), Malaysia (Kuala Lumpur), Indonesia (Jakarta), UAE (Dubai), and UK (London). To use the DHCP options sets feature in the preceding regions,submit a ticket.

Prerequisites

Before you start, make sure the following requirements are met:

Procedure

Procedure

Step 1: Create a DHCP options set

To use the feature, you must create a DHCP options set, and specify domain names and DNS server IP addresses.

Perform the following steps to create a DHCP options set:

  1. Log on to the VPC console.
  2. In the left-side navigation pane, click DHCP Options Sets.
  3. On the DHCP Options Sets page, click Create DHCP Options Set.
  4. On the Create DHCP Options Set page, set the required parameters for the DHCP options set.
    Parameter Description
    Basic Information
    Instance Name Enter a name for the DHCP options set.

    The name must be 2 to 128 characters in length and can contain letters, Chinese characters, digits, underscores (_), and hyphens (-). It must start with a letter or a Chinese character.

    Description Enter a description for the DHCP options set.

    The description must be 2 to 256 characters in length and cannot start with http:// or https://.

    DHCP Options Sets Configuration
    Domain Name Enter a root domain for ECS instances.

    After you associate the DHCP options set with a VPC network, all ECS instances in the VPC network use the specified root domain.

    Enter example.com in this example.

    DNS Server IP Address Enter DNS server IP addresses.
    The IP addresses of the Alibaba Cloud DNS servers, which are 100.100.2.136 and 100.100.2.138, are used by default. This ensures that you can access basic services on Alibaba Cloud. You can customize DNS server IP addresses to meet your requirements. Click Customize DNS server IP addresses to specify the custom DNS server IP addresses. You can specify up to four DNS server IP addresses.
    Notice Before you specify custom DNS server IP addresses, note the following limits:
    • The system automatically specifies the IP addresses of the Alibaba Cloud DNS servers, which are 100.100.2.136 and 100.100.2.138. If you delete these IP addresses, you may not be able to access the basic services on Alibaba Cloud. Proceed with caution.
    • You must add rules to the security group and network ACL (if any) to enable access to the specified custom DNS servers. Otherwise, the services deployed on your ECS instances cannot be resolved. For more information, see Add security group rules and Add network ACL rules.

    In this example, enter 192.168.1.1.

  5. Click OK.
After the DHCP options set is created, the status of the DHCP options set displays Available.DHCP Option status

Step 2: Associate the DHCP options set with a VPC network

After you create the DHCP options set, you must associate it with a VPC network. After the DHCP options set is associated with a VPC network, existing and new ECS instances in the VPC network all use the configurations of the DHCP options set.
Note A DHCP options set can be associated with only VPC networks in the same region as the DHCP options set.

Perform the following steps to associate the DHCP options set with a VPC network.

  1. Click Associate.
    Associate
  2. In the Associate dialog box, select one or more VPC networks to be associated, and click OK.
After the DHCP options set is associated with the VPC network, the status of the DHCP options set changes from Available to In Use.Status

Step 3: Restart the ECS instances in the associated VPC network and view the DNS configurations

After you associate the DHCP options set with a VPC network, you must restart the ECS instances in the VPC network. This way, the ECS instances in the VPC network can use the configurations of the DHCP options set.
Note After a DHCP options set is associated with a VPC network, the configurations of the DHCP options are automatically synchronized to the newly created ECS instances in the VPC network. No operation is required to trigger the synchronization.

An ECS instance that runs CentOS is used in the following example to describe how to restart ECS instances and view the DNS configurations.

  1. Connect to the ECS instance, and run the reboot command to restart the ECS instance.
  2. Then, reconnect to the ECS instance.
  3. Run the cat /etc/resolv.conf command to query the domain name and DNS server IP addresses for the ECS instance.
    Query the DNS server IP addresses