A VPC comes with a default subnet. If the default subnet cannot meet your requirements, you can create one.
The subnet is configured with DHCP by default. When an ECS using this VPC starts, the ECS automatically uses DHCP to obtain an IP address.
- Log in to the management console.
- On the console homepage, under Network, click Virtual Private Cloud.
- In the navigation pane on the left, click Virtual Private Cloud.
- On the Virtual Private Cloud page, locate the VPC for which a subnet is to be created and click the VPC name.
- On the displayed Subnets tab, click Create Subnet.
- Set the parameters as prompted.
Table 1 Parameter description
Specifies the VPC for which you want to create a subnet.
This parameter is available only when Subnets is displayed in the navigation pane.
Specifies the subnet name.
The VPC flow log name can contain a maximum of 64 characters, which may consist of letters, digits, underscores (_), hyphens (-), and periods (.). The name cannot contain spaces.
Specifies the CIDR block for the subnet. This value must be within the VPC CIDR block.
Click the drop-down arrow to set advanced settings for the subnet, including Gateway and DNS Server Address.
Specifies the gateway address of the subnet.
This IP address is used to communicate with other subnets.
DNS Server Address
By default, there are two DNS server addresses configured (including two private DNS server addresses or one private DNS server address and one public DNS server address. A private DNS server address takes precedence over a public DNS server address). In this way, services in the VPC can access cloud services through the private DNS server address, reducing the latency. If you want to use other public DNS servers for resolution, you can change the default DNS server addresses.
- Click OK.
When a subnet is created, there are five reserved IP addresses, which cannot be used. For example, in a subnet with CIDR block 192.168.0.0/24, the following IP addresses are reserved:
- 192.168.0.0: Network ID. This address is the beginning of the private IP address range and will not be assigned to any instance.
- 192.168.0.1: Gateway address.
- 192.168.0.253: Reserved for the system interface. This IP address is used by the VPC for external communication.
- 192.168.0.254: DHCP service address.
- 192.168.0.255: Network broadcast address.
If you set Advanced Settings to Custom during subnet creation, the reserved IP addresses may be different from the default ones, but there will still be five of them. The specific addresses depend on your subnet settings.