You can use Dynamic Host Configuration Protocol (DHCP) options sets to configure DNS server IP addresses and domain names for Elastic Compute Services (ECS) instances in virtual private clouds (VPCs). Before you can use a DHCP options set, you must create one and specify the DNS server IP addresses and domain names that your business requires. Then, you can associate the DHCP options set with a VPC. After the DHCP options set is associated with the VPC, newly created ECS instances in the VPC use the configurations of the DHCP options set. After the DHCP options set is synchronized with existing ECS instances, existing ECS instances also use the configurations of the DHCP options set.
Limits
You can associate a DHCP options set with a VPC. After you associate a DHCP options set with a VPC, newly created ECS instances in the VPC use the configurations of the DHCP options set. Existing ECS instances also use the configurations of the DHCP options set after you restart the ECS instances, restart the DHCP client, or restart network services. For more information, see Overview of DHCP options sets.
A DHCP options set can be associated with only VPCs deployed in the region where the DHCP options set is created.
A DHCP options set can be associated with multiple VPCs. However, a VPC can be associated with only one DHCP options set.
By default, a DHCP options set can be associated with up to 10 VPCs. You cannot increase the quota.
The DHCP options set feature is an advanced VPC feature. If your VPC does not support DHCP options sets, contact Alibaba Cloud engineers.
Create a DHCP options set
Log on to the VPC console.
In the left-side navigation pane, click DHCP Options Sets.
In the top navigation bar, select the region where you want to create the DHCP options set.
For more information about the regions that support DHCP options sets, see Features and supported regions.
- On the DHCP Options Sets page, click Create DHCP Options Set.
On the Create DHCP Options Set page, set the following parameters.
Parameter
Description
Basic Information
Instance Name
Enter a name for the DHCP options set.
Description
Enter a description for the DHCP options set.
Resource Group
Select the resource group to which the DHCP options set belongs.
Tag Key
Select or enter a tag key. You can specify up to 20 tag keys.
A tag key can be up to 128 characters in length and cannot contain
http://
orhttps://
. It cannot start withacs:
oraliyun
.Tag Value
Select or enter a tag value. You can specify at most 20 tag values.
A tag value can be up to 128 characters in length and cannot contain
http://
orhttps://
. It cannot start withacs:
oraliyun
.Configure DHCP Options Set
Domain Name
Enter a root domain name.
After you associate the DHCP options set with a VPC, the domain name is synchronized to the ECS instances deployed in the VPC.
example.com is used in this example.
DNS Server IP Address
Enter DNS server IP addresses.
The IP addresses of 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 deployed on Alibaba Cloud. You can click Customize DNS server IP addresses to specify custom DNS server IP addresses to meet your requirements. You can specify up to four DNS server IP addresses.
ImportantBefore you specify custom DNS server IP addresses, take note of the following limits:
The system automatically specifies the IP addresses of 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 deployed on Alibaba Cloud. Proceed with caution.
You must add rules to the security group and network access control lists (ACLs) to enable access to the specified custom DNS servers. Otherwise, the services deployed on your ECS instances cannot be resolved. If network ACLs do not exist, add rules only to the security group. For more information, see Add security group rules and Add network ACL rules.
192.168.1.1 is used in this example.
Click OK.
Modify a DHCP options set
After you create a DHCP options set, you can modify it.
Log on to the VPC console.
In the left-side navigation pane, click DHCP Options Sets.
On the DHCP Options Sets page, find the DHCP options set that you want to modify and click Edit in the Actions column.
On the Modify DHCP Options Set page, modify the name, description, domain name, or DNS server IP address, and then click OK.
Associate with a VPC
Log on to the VPC console.
In the left-side navigation pane, click DHCP Options Sets.
On the DHCP Options Sets page, find the DHCP options set and click Associate with VPC in the Actions column.
In the Associate with VPC dialog box, select a VPC and click OK.
Replace the DHCP options set associated with a VPC
After you associate a DHCP options set with a VPC, you can replace the DHCP options set based on your business requirements.
Log on to the VPC console.
In the top navigation bar, select the region where the VPC is deployed.
On the VPCs page, find the VPC that you want to manage and click its ID.
In the VPC Details section, click Modify Association next to DHCP Options Set.
In the Associate DHCP Options Set dialog box, select a DHCP options set and click OK.
Disassociate a DHCP options set from a VPC
You can disassociate a DHCP options set from a VPC. Then, ECS instances in the VPC no longer use the configurations of the 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, find the DHCP options set and click its ID.
In the Associated VPCs section, find the VPC that you want to disassociate and click Disassociate in the Actions column.
In the message that appears, click OK.
Delete a DHCP options set
Make sure that the DHCP options set to be deleted is not associated with a VPC.
Log on to the VPC console.
In the left-side navigation pane, click DHCP Options Sets.
On the DHCP Options Sets page, find the DHCP options set that you want to delete and click Delete in the Actions column.
In the message that appears, click OK.
References
CreateDhcpOptionsSet: creates a DHCP options set.
UpdateDhcpOptionsSetAttribute: modifies a DHCP options set.
AttachDhcpOptionsSetToVpc: associates a DHCP options set with a VCP.
ReplaceVpcDhcpOptionsSet: modifies the association of a DHCP options set with a VPC.
DetachDhcpOptionsSetFromVpc: disassociates a DHCP options set from a VPC.
DeleteDhcpOptionsSet: deletes a DHCP options set.