Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
Software Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Creating a VPC and Subnet

Updated on 2025-01-17 GMT+08:00

Scenarios

Virtual Private Cloud (VPC) allows you to provision logically isolated virtual private networks for cloud resources, such as cloud servers, containers, and databases.

You can create a VPC, specify a CIDR block, and create one or more subnets for the VPC. A VPC comes with a default route table that enables subnets in the VPC to communicate with each other.

Procedure

  1. Go to the Create VPC page.
  2. On the Create VPC page, set parameters for the VPC and subnets as prompted.
    You can click to create more subnets. A maximum of three subnets can be created at a time.
    Figure 1 Creating a VPC and subnet
    Table 1 VPC parameter descriptions

    Parameter

    Description

    Example Value

    Region

    The region where the VPC belongs. Select the region nearest to you to ensure the lowest latency possible.

    CN-Hong Kong

    Name

    The VPC name. The name:
    • Can contain 1 to 64 characters.
    • Can contain letters, digits, underscores (_), hyphens (-), and periods (.).

    vpc-test

    IPv4 CIDR Block

    The IPv4 CIDR block of the VPC. Consider the following when specifying a CIDR block:
    • Number of IP addresses: Reserve sufficient IP addresses for subsequent business growth.
    • IP address ranges: Avoid IP address conflicts if you need to connect a VPC to an on-premises data center or connect two VPCs.
    When you create a VPC, we recommend that you use the private IPv4 address ranges specified in RFC 1918 as the CIDR block:
    • 10.0.0.0/8-24: The IP address ranges from 10.0.0.0 to 10.255.255.255, and the mask ranges from 8 to 24.
    • 172.16.0.0/12-24: The IP address ranges from 172.16.0.0 to 172.31.255.255, and the mask ranges from 12 to 24.
    • 192.168.0.0/16-24: The IP address ranges from 192.168.0.0 to 192.168.255.255, and the mask ranges from 16 to 24.
    In addition to the preceding addresses, you can create a VPC with a publicly routable CIDR block that falls outside of the private IPv4 address ranges specified in RFC 1918. However, the following system and public reserved addresses must be excluded:
    • Reserved system CIDR blocks
      • 100.64.0.0/10
      • 214.0.0.0/7
      • 198.18.0.0/15
      • 169.254.0.0/16
    • Reserved public CIDR blocks
      • 0.0.0.0/8
      • 127.0.0.0/8
      • 240.0.0.0/4
      • 255.255.255.255/32

    For details about VPC planning, see VPC and Subnet Planning.

    10.0.0.0/8

    Enterprise Project

    The enterprise project to which the VPC belongs.

    An enterprise project facilitates project-level management and grouping of cloud resources and users. The name of the default project is default.

    For details about creating and managing enterprise projects, see the Enterprise Management User Guide.

    default

    Advanced Settings (Optional) > Tag

    The VPC tag. Click to expand the configuration area and set this parameter.

    Add tags to help you quickly identify, classify, and search for your VPCs.

    For details, see Managing VPC Tags.

    NOTE:

    If your organization has configured tag policies for VPCs, you need to add tags to your VPCs based on the policies. If you add a tag that does not comply with the tag policies, VPCs may fail to be created. Contact your administrator to learn more about tag policies.

    • Key: vpc_key1
    • Value: vpc-01

    Advanced Settings (Optional) > Description

    Supplementary information about the VPC. Click to expand the configuration area and set this parameter.

    Enter the description about the VPC in the text box as required.

    The VPC description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).

    N/A

    Table 2 Subnet parameter descriptions

    Parameter

    Description

    Example Value

    Subnet Name

    The subnet name. The name:
    • Can contain 1 to 64 characters.
    • Can contain letters, digits, underscores (_), hyphens (-), and periods (.).

    subnet-01

    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.

    Each region contains multiple AZs. If one AZ is unavailable, other AZs in the same region continue to provide services.

    If Edge is displayed, select an edge AZ based on your service requirements. If Edge is not displayed, you do not need to set the subnet AZ, which does not affect your service running.

    • By default, all instances in different subnets of the same VPC can communicate with each other and the subnets can be in different AZs. For example, if you have a VPC with two subnets, A01 in AZ 1 and A02 in AZ 2. Subnet A01 and A02 can communicate with each other by default.
    • A cloud resource and its subnet can be in different AZs. For example, a cloud server in AZ 1 can use 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.
    • Select Central if you want to provision cloud resources on the cloud and run your workloads on the cloud.
    • Select Edge if you want to provision cloud resources to an edge site and run workloads at the edge site. For details about edge sites, see CloudPond.

    For details, see Region and AZ.

    You can select an AZ for a subnet only in certain regions. See the available regions on the management console.

    AZ1

    CIDR Block

    The CIDR block of the subnet. This parameter is displayed only in regions where IPv4/IPv6 dual stack is not supported.

    Set the IPv4 CIDR block of the subnet. For details, see section "IPv4 CIDR Block".

    10.0.0.0/24

    IPv4 CIDR Block

    The IPv4 CIDR block of the subnet. This parameter is displayed only in regions where IPv4/IPv6 dual stack is supported.

    A subnet is a unique CIDR block with a range of IP addresses in a VPC. Comply with the following principles when planning subnets:

    • Planning CIDR block size: After a subnet is created, the CIDR block cannot be changed. You need to properly plan the CIDR block in advance based on the number of IP addresses required by your service.
      • The subnet CIDR block size cannot be too small. Ensure that the number of available IP addresses in the subnet meets service requirements. Remember that the first and last three addresses in a subnet CIDR block are reserved for system use. For example, in subnet 10.0.0.0/24, 10.0.0.1 is the gateway address, 10.0.0.253 is the system interface address, 10.0.0.254 is used by DHCP, and 10.0.0.255 is the broadcast address.
      • The subnet CIDR block cannot be too large, either. If you use a CIDR block that is too large, you may not have enough CIDR blocks available for new subnets, which can be a problem when you want to scale out services.
    • Avoiding subnet CIDR block conflicts: Avoid CIDR block conflicts if you need to connect two VPCs or connect a VPC to an on-premises data center.

      If the subnet CIDR blocks at both ends of the network conflict, create a subnet.

    A subnet mask can be between the netmask of its VPC CIDR block and /28 netmask. If a VPC CIDR block is 10.0.0.0/16, its subnet mask can between 16 to 28.

    For details about subnet planning, see VPC and Subnet Planning.

    10.0.0.0/24

    IPv6 CIDR Block (Optional)

    The IPv6 CIDR block of the subnet. This parameter is displayed only in regions where IPv4/IPv6 dual stack is supported.

    After the IPv6 function is enabled, 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.

    For details, see IPv4 and IPv6 Dual-Stack Network.

    -

    Associated Route Table

    The default route table with which the subnet will be associated. A route table contains a set of routes that are used to control the traffic routing for your subnets in a VPC. Each VPC comes with a default route table that will be automatically associated with subnets. This allows subnets in a VPC to communicate with each other.

    If the default route table cannot meet your requirements, you can create a custom route table and associate subnets with it. Then, the default route table controls inbound traffic to the subnets, while the custom route table controls outbound traffic from the subnets. For details, see Creating a Custom Route Table.

    -

    Advanced Settings (Optional) > Gateway

    The gateway address of the subnet. Click to expand the configuration area and set this parameter.

    Retain the default value unless there are special requirements.

    10.0.0.1

    Advanced Settings (Optional) > DNS Server Address

    The DNS server addresses. Click to expand the configuration area and set this parameter.

    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

    Advanced Settings (Optional) > Domain Name

    The domain name. Click to expand the configuration area and set this parameter.

    Enter domain names (), separated with spaces. A maximum of 254 characters are allowed. A domain name can consist of multiple labels (max. 63 characters each).

    To access a domain name, you only need to enter the domain name prefix. ECSs in the subnet automatically match the configured domain name suffix.

    If the domain names are changed, ECSs newly added to this subnet will use the new domain names.

    If an existing ECS in this subnet needs to use the new domain names, restart the ECS or run a command to restart the DHCP Client service or network service.

    NOTE:
    The command for updating the DHCP configuration depends on the ECS OS. The following commands are for your reference.
    • Restart the DHCP Client service: service dhcpd restart
    • Restart the network service: service network restart

    test.com

    Advanced Settings (Optional) > IPv4 DHCP Lease Time

    The period during which a client can use an IP address automatically assigned by the DHCP server. Click to expand the configuration area and set this parameter.

    This parameter is displayed only in regions where IPv4/IPv6 dual stack is not supported.

    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.

    After you change the DHCP lease time on the console, the change is applied automatically when the DHCP lease of an instance (such as ECS) is renewed. You can wait for the system to renew the lease or manually renew the lease. Renewing lease will not change the IP address used by the instance. If you want the new lease time to take effect immediately, manually renew the lease or restart the ECS.

    For details, see How Do I Make the Changed DHCP Lease Time of a Subnet Take Effect Immediately?

    -

    Advanced Settings > IPv4 DHCP Lease Time

    The period during which a client can use an IPv4 address automatically assigned by the DHCP server. Click to expand the configuration area and set this parameter.

    This parameter is displayed only in regions where IPv4/IPv6 dual stack is supported.

    You can set the DHCP lease time of an IPv4 address.

    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.

    For details, see How Do I Make the Changed DHCP Lease Time of a Subnet Take Effect Immediately?

    -

    Advanced Settings > IPv6 DHCP Lease Time

    The period during which a client can use an IPv6 address automatically assigned by the DHCP server. Click to expand the configuration area and set this parameter.

    This parameter is displayed in the region where the IPv4/IPv6 dual stack is supported and when IPv6 is enabled.

    You can set the DHCP lease time of an IPv6 address in the same way as how you do with an IPv4 address.

    -

    Advanced Settings (Optional) > NTP Server Address

    The IP address of the NTP server. Click to expand the configuration area and set this parameter.

    If you want to add NTP server addresses for a subnet, you can specify NTP Server Address. The IP addresses are added in addition to the default NTP server addresses.

    • If you add or change the NTP server addresses of a subnet, you need to renew the DHCP lease for or restart all the ECSs in the subnet to make the change take effect immediately.
    • If the NTP server addresses have been cleared out, restarting the ECSs will not help. You must renew the DHCP lease for all ECSs to make the change take effect immediately.

    192.168.2.1

    Advanced Settings (Optional) > Tag

    The subnet tag. Click to expand the configuration area and set this parameter.

    Add tags to help you quickly identify, classify, and search for your subnets.

    For details, see Managing Subnet Tags.

    NOTE:

    If you have configured tag policies for subnets, you need to add tags to your subnets based on the tag policies. If you add a tag that does not comply with the tag policies, subnets may fail to be created. Contact the administrator to learn more about tag policies.

    • Key: subnet_key1
    • Value: subnet-01

    Advanced Settings (Optional) > Description

    Supplementary information about the subnet. Click to expand the configuration area and set this parameter.

    Enter the description about the subnet in the text box as required.

    The subnet description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).

    N/A

  3. Click Create Now.

    Return to the VPC list and view the new VPC.

Follow-up Operations

After the VPC and subnets are created, you need to create other cloud resources in the subnets. For details, see Setting Up an IPv4/IPv6 Dual-Stack Network In a VPC and Setting Up an IPv4/IPv6 Dual-Stack Network In a VPC.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback