Creating a Subnet for the VPC
Scenarios
A VPC comes with a default subnet. If the default subnet cannot meet your requirements, you can create one.
A subnet is configured with DHCP by default. When an ECS in this subnet starts, the ECS automatically obtains an IP address using DHCP.
Procedure
- Log in to the management console.
- Click
in the upper left corner and select the desired region and project.
- Click
in the upper left corner and choose Networking > Virtual Private Cloud.
The Virtual Private Cloud page is displayed.
- In the navigation pane on the left, choose Virtual Private Cloud > Subnets.
- Click Create Subnet.
The Create Subnet page is displayed.
- Set the parameters as prompted.
Table 1 Parameter descriptions Parameter
Description
Example Value
VPC
The VPC for which you want to create a subnet.
-
AZ
An AZ is a geographic location with independent power supply and network facilities in a region. AZs are physically isolated, and AZs in the same VPC are interconnected through an internal network. For details, see Region and AZ.
Note the following when you select an AZ:- Subnets in a VPC can be in different AZs. For example, a VPC can have a subnet in AZ 1, and another subnet in AZ 3.
- A cloud resource can be in a different AZ from its subnet. For example, a cloud server in AZ 1 can be in a subnet in AZ 3. If AZ 3 becomes faulty, cloud servers in AZ 1 can still use the subnet in AZ 3, and your services are not interrupted.
AZ1
Name
The subnet name.
The name can contain a maximum of 64 characters, which may consist of letters, digits, underscores (_), hyphens (-), and periods (.). The name cannot contain spaces.
Subnet
IPv4 CIDR Block
The CIDR block for the subnet. This value must be within the VPC CIDR block.
This parameter is displayed only in regions where IPv4/IPv6 dual stack is supported.
192.168.0.0/24
IPv6 CIDR Block
Specifies whether to set IPv6 CIDR Block to Enable.
This parameter is displayed only in regions where IPv4/IPv6 dual stack is supported.
If you select this option, the system automatically assigns an IPv6 CIDR block to the created subnet. Currently, the IPv6 CIDR block cannot be customized. IPv6 cannot be disabled after the subnet is created.
-
Associated Route Table
The default route table to which the subnet will be associated. You can change the route table to a custom route table on the Subnets page.
Default
Gateway
The gateway address of the subnet.
This IP address is used to communicate with other subnets.
192.168.0.1
DNS Server Address
Huawei Cloud private DNS server addresses are entered by default. This allows ECSs in a VPC to communicate with each other and also access other cloud services using private domain names without exposing their IP addresses to the Internet.
You can change the default DNS server addresses if needed. This may interrupt your access to cloud services.
You can also click Reset on the right to restore the DNS server addresses to the default value.
A maximum of two DNS server IP addresses can be configured. Multiple IP addresses must be separated using commas (,).
100.125.x.x
DHCP Lease Time
The period during which a client can use an IP address automatically assigned by the DHCP server. After the lease time expires, a new IP address will be assigned to the client.- Limited: Set the DHCP lease time. The unit can be day or hour.
- Unlimited: The DHCP lease time does not expire.
If the time period is changed, the new lease time takes effect when the instance (such as an ECS) in the subnet is renewed next time. You can wait for the instance to be renewed automatically or manually modify the lease time. If you want the new lease time to take effect immediately, manually renew the lease or restart the ECS.
-
Tag
The subnet tag, which consists of a key and value pair.
Each cloud resource can have a maximum of 20 tags.
The tag key and value must meet the requirements listed in Table 2.
- Key: subnet_key1
- Value: subnet-01
Description
Supplementary information about the subnet. This parameter is optional.
The subnet description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).
-
Table 2 Subnet tag key and value requirements Parameter
Requirements
Example Value
Key
- Cannot be left blank.
- Must be unique for each subnet.
- Can contain a maximum of 36 characters.
- Can contain only the following character types:
- Uppercase letters
- Lowercase letters
- Digits
- Special characters, including hyphens (-) and underscores (_)
subnet_key1
Value
- Can contain a maximum of 43 characters.
- Can contain only the following character types:
- Uppercase letters
- Lowercase letters
- Digits
- Special characters, including hyphens (-) and underscores (_)
subnet-01
- Click OK.
Precautions
After a subnet is created, some reserved IP addresses 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 configured the default settings under Advanced Settings 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.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.