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.
- An Alibaba Cloud account is created. To create an Alibaba Cloud account, log on to the Alibaba Cloud site. For more information, see Create an Alibaba Cloud account.
- A VPC network is created. For more information, see Create a VPC.
- ECS instances are created in the VPC network. For more information, see Create an instance by using the wizard.
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:
- Log on to the VPC console.
- In the left-side navigation pane, click DHCP Options Sets.
- On the DHCP Options Sets page, click Create DHCP Options Set.
- 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
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.
- Click OK.
Step 2: Associate the DHCP options set with a VPC network
Perform the following steps to associate the DHCP options set with a VPC network.
- Click Associate.
- In the Associate dialog box, select one or more VPC networks to be associated, and click OK.
Step 3: Restart the ECS instances in the associated VPC network and view the DNS configurations
An ECS instance that runs CentOS is used in the following example to describe how to restart ECS instances and view the DNS configurations.
- Connect to the ECS instance, and run the
rebootcommand to restart the ECS instance.
- Then, reconnect to the ECS instance.
- Run the
cat /etc/resolv.confcommand to query the domain name and DNS server IP addresses for the ECS instance.