Virtual Private Cloud

User Guide

Issue 31 Date 2021-05-20

HUAWEI TECHNOLOGIES CO., LTD.

Copyright © Huawei Technologies Co., Ltd. 2021. All rights reserved. No part of this document may be reproduced or transmitted in any form or by any means without prior written consent of Huawei Technologies Co., Ltd.

Trademarks and Permissions

and other Huawei trademarks are trademarks of Huawei Technologies Co., Ltd. All other trademarks and trade names mentioned in this document are the property of their respective holders.

Notice The purchased products, services and features are stipulated by the contract made between Huawei and the customer. All or part of the products, services and features described in this document may not be within the purchase scope or the usage scope. Unless otherwise specified in the contract, all statements, information, and recommendations in this document are provided "AS IS" without warranties, guarantees or representations of any kind, either express or implied.

The information in this document is subject to change without notice. Every effort has been made in the preparation of this document to ensure accuracy of the contents, but all statements, information, and recommendations in this document do not constitute a warranty of any kind, express or implied.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. i Virtual Private Cloud User Guide Contents

Contents

1 VPC and Subnet...... 1 1.1 Network Planning...... 1 1.2 VPC...... 4 1.2.1 Creating a VPC...... 4 1.2.2 Modifying a VPC...... 9 1.2.3 Adding a Secondary CIDR Block to a VPC...... 10 1.2.4 Removing a Secondary CIDR Block from a VPC...... 12 1.2.5 Deleting a VPC...... 12 1.2.6 Managing VPC Tags...... 13 1.2.7 Exporting VPC Information...... 15 1.3 Subnet...... 15 1.3.1 Creating a Subnet for the VPC...... 15 1.3.2 Modifying a Subnet...... 18 1.3.3 Deleting a Subnet...... 19 1.3.4 Managing Subnet Tags...... 20 1.4 IPv4 and IPv6 Dual-Stack Network...... 22 2 Security...... 25 2.1 Security Group...... 25 2.1.1 Security Group Overview...... 25 2.1.2 Default Security Groups and Security Group Rules...... 28 2.1.3 Security Group Configuration Examples...... 29 2.1.4 Creating a Security Group...... 33 2.1.5 Adding a Security Group Rule...... 35 2.1.6 Fast-Adding Security Group Rules...... 40 2.1.7 Replicating a Security Group Rule...... 41 2.1.8 Modifying a Security Group Rule...... 41 2.1.9 Deleting a Security Group Rule...... 42 2.1.10 Importing and Exporting Security Group Rules...... 43 2.1.11 Deleting a Security Group...... 43 2.1.12 Adding Instances to and Removing Them from a Security Group...... 44 2.1.13 Cloning a Security Group...... 45 2.1.14 Modifying a Security Group Name...... 46 2.1.15 Viewing the Security Group of an ECS...... 47

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. ii Virtual Private Cloud User Guide Contents

2.1.16 Changing the Security Group of an ECS...... 47 2.1.17 Common Ports Used by ECSs...... 48 2.2 Network ACL...... 50 2.2.1 Network ACL Overview...... 50 2.2.2 Network ACL Configuration Examples...... 53 2.2.3 Creating a Network ACL...... 56 2.2.4 Adding a Network ACL Rule...... 57 2.2.5 Associating Subnets with a Network ACL...... 59 2.2.6 Disassociating a Subnet from a Network ACL...... 60 2.2.7 Changing the Sequence of a Network ACL Rule...... 61 2.2.8 Modifying a Network ACL Rule...... 62 2.2.9 Enabling or Disabling a Network ACL Rule...... 64 2.2.10 Deleting a Network ACL Rule...... 64 2.2.11 Exporting and Importing Network ACL Rules...... 65 2.2.12 Viewing a Network ACL...... 66 2.2.13 Modifying a Network ACL...... 66 2.2.14 Enabling or Disabling a Network ACL...... 66 2.2.15 Deleting a Network ACL...... 67 2.3 Differences Between Security Groups and Network ACLs...... 67 2.4 IP Address Group...... 69 2.4.1 IP Address Group Overview...... 69 2.4.2 Creating an IP Address Group...... 69 2.4.3 Associating an IP Address Group with a Security Group Rule...... 70 2.4.4 Managing an IP Address Group...... 71 3 EIP...... 72 3.1 EIP Overview...... 72 3.2 Assigning an EIP and Binding It to an ECS...... 73 3.3 Unbinding an EIP from an ECS and Releasing the EIP...... 76 3.4 Managing EIP Tags...... 77 3.5 Modifying an EIP Bandwidth...... 79 3.6 Exporting EIP Information...... 82 4 Shared Bandwidth...... 83 4.1 Shared Bandwidth Overview...... 83 4.2 Buying a Shared Bandwidth...... 84 4.3 Adding EIPs to a Shared Bandwidth...... 86 4.4 Removing EIPs from a Shared Bandwidth...... 86 4.5 Modifying a Shared Bandwidth...... 87 4.6 Deleting a Shared Bandwidth...... 87 5 Shared Data Package...... 89 5.1 Shared Data Package Overview...... 89 5.2 Buying a Shared Data Package...... 89

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. iii Virtual Private Cloud User Guide Contents

6 Route Table...... 92 6.1 Route Table Overview...... 92 6.2 Example Custom Route in a VPC...... 93 6.3 Example Custom Route Outside a VPC...... 95 6.4 Configuring an SNAT Server...... 98 6.5 Adding a Custom Route...... 101 6.6 Viewing a Route Table...... 102 6.7 Modifying a Route...... 102 6.8 Deleting a Route...... 103 7 Route Table (Module Accessible from the Left Navigation Pane)...... 104 7.1 Route Table Overview...... 104 7.2 Creating a Custom Route Table...... 107 7.3 Adding a Custom Route...... 109 7.4 Associating a Subnet with a Route Table...... 110 7.5 Changing the Route Table Associated with a Subnet...... 111 7.6 Viewing a Route Table...... 111 7.7 Deleting a Route Table...... 112 7.8 Modifying a Route...... 112 7.9 Deleting a Route...... 113 7.10 Replicating a Route...... 114 7.11 Exporting Route Table Information...... 114 8 VPC Peering Connection...... 116 8.1 VPC Peering Connection Overview...... 116 8.2 VPC Peering Connection Configuration Plans...... 117 8.3 Creating a VPC Peering Connection with Another VPC in Your Account...... 120 8.4 Creating a VPC Peering Connection with a VPC in Another Account...... 126 8.5 Viewing VPC Peering Connections...... 133 8.6 Modifying a VPC Peering Connection...... 133 8.7 Deleting a VPC Peering Connection...... 134 8.8 Viewing Routes Configured for a VPC Peering Connection...... 134 8.9 Deleting a VPC Peering Route...... 135 9 VPC Flow Log (OBT)...... 137 9.1 VPC Flow Log Overview...... 137 9.2 Creating a VPC Flow Log...... 138 9.3 Viewing a VPC Flow Log...... 140 9.4 Enabling or Disabling VPC Flow Log...... 143 9.5 Deleting a VPC Flow Log...... 143 10 Virtual IP Address...... 145 10.1 Virtual IP Address Overview...... 145 10.2 Assigning a Virtual IP Address...... 147 10.3 Binding a Virtual IP Address to an EIP or ECS...... 149

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. iv Virtual Private Cloud User Guide Contents

10.4 Using an EIP to Access a Virtual IP Address...... 153 10.5 Using a VPN to Access a Virtual IP Address...... 154 10.6 Using a Direct Connect Connection to Access the Virtual IP Address...... 154 10.7 Using a VPC Peering Connection to Access the Virtual IP Address...... 154 10.8 Disabling IP Forwarding on the Standby ECS...... 154 10.9 Disabling Source and Destination Check (HA Load Balancing Cluster Scenario)...... 155 10.10 Releasing a Virtual IP Address...... 156 11 Layer 2 Connection Gateway (OBT)...... 158 11.1 L2CG Overview...... 158 11.2 Buying a L2CG...... 160 11.3 Viewing a L2CG...... 163 11.4 Modifying a L2CG...... 163 11.5 Deleting a L2CG...... 164 11.6 Creating a Layer 2 Connection...... 165 11.7 Viewing a Layer 2 Connection...... 166 11.8 Deleting a Layer 2 Connection...... 167 11.9 Configuring a Tunnel Gateway in Your Data Center...... 168 12 Monitoring...... 170 12.1 Supported Metrics...... 170 12.2 Viewing Metrics...... 172 12.3 Creating an Alarm Rule...... 173 A Change History...... 174

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. v Virtual Private Cloud User Guide 1 VPC and Subnet

1 VPC and Subnet

1.1 Network Planning

Before creating your VPCs, determine how many VPCs, the number of subnets, and what IP address ranges or connectivity options you will need.

How Do I Determine How Many VPCs I Need?

VPCs are region-specific. By default, networks in VPCs in different regions or even in the same region are not connected. The communications on these different networks are completely isolated from each other, this is not the case for different AZs in the same VPC. Two networks in the same VPC should be able to communicate with each other even if they are in different AZs.

One VPC

If your services do not require network isolation, a single VPC should be enough.

Multiple VPCs

If you have multiple service systems in a region and each service system requires an isolated network, you can create a separate VPC for each service system. If you require network connectivity between separate VPCs, you can use a VPC peering connection as shown in Figure 1-1.

Figure 1-1 VPC peering connection

Default VPC Quota

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 1 Virtual Private Cloud User Guide 1 VPC and Subnet

By default, you can create a maximum of five VPCs in your account. If this cannot meet your service requirements, request a quota increase. For details, see What Is a Quota?

How Do I Plan Subnets? A subnet is a range of IP addresses in your VPC. All of the resources in a VPC must be deployed on subnets and the subnets on a VPC cannot overlap. Once a subnet has been created, its CIDR block cannot be modified. The subnets used to deploy your resources must reside within your VPC, and the subnet masks used to define them can be between the netmask of its VPC CIDR block and /28 netmask. ● 10.0.0.0 – 10.255.255.255 ● 172.16.0.0 – 172.31.255.255 ● 192.168.0.0 – 192.168.255.255 Subnet Planning ● We recommend that you create different subnets for different service modules in a VPC. For example, you can create different subnets for web, application, and database servers. A web server is in a publicly accessible subnet, and application and database servers are in non-publically accessible subnets. You can leverage network ACLs to help control access to the servers in each subnet. ● If you only need to plan subnets for VPCs, and communication between VPCs and on-premises data centers are not required, you can create subnets within any of the CIDR blocks listed above. ● If your VPC needs to communicate with an on-premises data center through VPN or Direct Connect, the VPC CIDR block cannot overlap with the CIDR block of the on-premises data center. Therefore, when creating a VPC or subnet, ensure that its CIDR block does not overlap with any CIDR block on the data center. ● When determining the size of a VPC or subnet CIDR block, ensure that the number of available IP addresses on the CIDR block meet your service requirements. Default Subnet Quota By default, you can create up to 100 subnets in your account. If you need more, request a quota increase. For details, see What Is a Quota?

How Do I Plan Routing Policies? A route table contains a set of routes that are used to determine where network traffic from your subnets in a VPC is directed. When you create a VPC, it automatically has a default route table, which enables internal communication within that VPC. ● If you do not need to explicitly control how each subnet routes inbound and outbound traffic, you can use the default route table. ● If you need to explicitly control how each subnet routes inbound and outbound traffic in a VPC, you can add custom routes to the route table.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 2 Virtual Private Cloud User Guide 1 VPC and Subnet

How Do I Connect to an On-Premises Data Center? If you require interconnection between a VPC and an on-premises data center, ensure that the VPC does not have an overlapping IP address range with the on- premises data center to be connected. In Figure 1-2, VPC 1 is in North China region and VPC 2 and VPC 3 are in East China region. To connect to an on-premises data center, they can use a VPN, as VPC 1 does in Beijing; or a Direct Connect connection, as VPC 2 does in Shanghai. VPC 2 connects to the data center through a Direct Connect connection, but to connect to another VPC in that region, like VPC 3, a VPC peering connection must be established.

Figure 1-2 Connections to on-premises data centers

When planning CIDR blocks for VPC 1, VPC 2, and VPC 3. ● The CIDR block of VPC 1 cannot overlap with the CIDR block of the on- premises data center in Beijing. ● The CIDR block of VPC 2 cannot overlap with the CIDR block of the on- premises data center in Shanghai. ● The CIDR blocks of VPC 2 and VPC 3 cannot overlap.

How Do I Access the ? Use EIPs to enable a small number of ECSs to access the Internet. When only a few ECSs need to access the Internet, you can bind the EIPs to the ECSs. This will provide them with Internet access. You can also dynamically unbind the EIPs from the ECSs and bind them to NAT gateways and load balancers instead, which will also provide Internet access. The process is not complicated. For more information about EIP, see EIP Overview. Use a NAT gateway to enable a large number of ECSs to access the Internet. When a large number of ECSs need to access the Internet, the public cloud system provides NAT gateways for your ECSs. With NAT gateways, you do not need to assign an EIP to each ECS. NAT gateways reduce costs as you do not need so many EIPs. NAT gateways offer both source network address translation (SNAT)

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 3 Virtual Private Cloud User Guide 1 VPC and Subnet

and destination network address translation (DNAT). SNAT allows multiple ECSs in the same VPC to share one or more EIPs to access the Internet. SNAT prevents the EIPs of ECSs from being exposed to the Internet. DNAT can implement port- level data forwarding. It maps EIP ports to ECS ports so that the ECSs in a VPC can share the same EIP and bandwidth to provide Internet-accessible services.

For more information, see NAT Gateway User Guide.

Use ELB to access the Internet If there are a large number of concurrent requests.

In high-concurrency scenarios, such as e-commerce, you can use load balancers provided by the ELB service to evenly distribute incoming traffic across multiple ECSs, allowing a large number of users to concurrently access your business system or application. ELB is deployed in the cluster mode. It provides fault tolerance for your applications by automatically balancing traffic across multiple AZs. You can also take advantage of deep integration with Auto Scaling (AS), which enables automatic scaling based on service traffic and ensures service stability and reliability.

For more information, see Elastic Load Balance User Guide.

Helpful Links ● Application Scenarios ● Access ● Public Network Access

1.2 VPC

1.2.1 Creating a VPC

Scenarios

A VPC provides an isolated virtual network for ECSs. You can configure and manage the network as required.

Create a VPC by following the procedure provided in this section. Then, create subnets, security groups, and assign EIPs by following the procedure provided in subsequent sections based on your actual network requirements.

Procedure 1. Log in to the management console. 2. On the console homepage, under Networking, click Virtual Private Cloud. 3. Click Create VPC. 4. On the Create VPC page, set parameters as prompted. A default subnet will be created together with a VPC and you can also click Add Subnet to create more subnets for the VPC.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 4 Virtual Private Cloud User Guide 1 VPC and Subnet

Table 1-1 VPC parameter descriptions Parameter Description Example Value

Region Regions are geographic areas CN-Hong Kong that are physically isolated from each other. The networks inside different regions are not connected to each other, so resources cannot be shared across different regions. For lower network latency and faster access to your resources, select the region nearest you.

Name The VPC name. VPC-001 The name can contain a maximum of 64 characters, which may consist of letters, digits, underscores (_), hyphens (-), and periods (.). The name cannot contain spaces.

CIDR Block The CIDR block of the VPC. 192.168.0.0/16 or IPv4 CIDR The CIDR block of a subnet Block can be the same as the CIDR block for the VPC (for a single subnet in the VPC) or a subset of the CIDR block for the VPC (for multiple subnets in the VPC). The following CIDR blocks are supported: 10.0.0.0/8-24 172.16.0.0/12-24 192.168.0.0/16-24

Enterprise The enterprise project to default Project 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.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 5 Virtual Private Cloud User Guide 1 VPC and Subnet

Parameter Description Example Value

Tag The VPC tag, which consists of ● Key: vpc_key1 a key and value pair. You can ● Value: vpc-01 add a maximum of 10 tags to each VPC. The tag key and value must meet the requirements listed in Table 1-3.

Table 1-2 Subnet parameter descriptions Parameter Description Example Value

Name The subnet name. Subnet The name can contain a maximum of 64 characters, which may consist of letters, digits, underscores (_), hyphens (-), and periods (.). The name cannot contain spaces.

IPv4 CIDR The CIDR block for the subnet. 192.168.0.0/24 Block This value must be within the VPC CIDR block.

IPv6 CIDR Specifies whether to set IPv6 - Block CIDR Block to Enable. 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.

Associated The default route table to Default Route Table which the subnet will be associated. You can change the route table to a custom route table on the Subnets page.

Advanced Click the drop-down arrow to Default Settings set advanced settings for the subnet, including Gateway and DNS Server Address.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 6 Virtual Private Cloud User Guide 1 VPC and Subnet

Parameter Description Example Value

Gateway The gateway address of the 192.168.0.1 subnet. This IP address is used to communicate with other subnets.

NTP Server The IP address of the NTP 192.168.2.1 Address server. This parameter is optional. You can configure the NTP server IP addresses to be added to the subnet as required. The IP addresses are added in addition to the default NTP server addresses. If this parameter is left empty, no IP address of the NTP server is added. Enter a maximum of four valid IP addresses, and separate multiple IP addresses with commas. Each IP address must be unique. 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.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 7 Virtual Private Cloud User Guide 1 VPC and Subnet

Parameter Description Example Value

DNS Server DNS server addresses allow 100.125.x.x Address ECSs in a VPC subnet to communicate with each other using private domain names. You can also directly access cloud services through private DNS servers. If you want to use other public DNS servers for resolution, you can change the default DNS server addresses. A maximum of two DNS server IP addresses can be configured. Multiple IP addresses must be separated using commas (,).

DHCP Lease The period during which a 365 days Time 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. Unit: Dayor hour If a DHCP lease time is changed, the new lease automatically takes effect when half of the current lease time has passed. To make the change take effect immediately, restart the ECS or log in to the ECS to cause the DHCP lease to automatically renew.

Tag The subnet tag, which consists ● Key: subnet_key1 of a key and value pair. You ● Value: subnet-01 can add a maximum of 10 tags to each subnet. The tag key and value must meet the requirements listed in Table 1-4.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 8 Virtual Private Cloud User Guide 1 VPC and Subnet

Table 1-3 VPC tag key and value requirements Parameter Requirements Example Value

Key ● Cannot be left blank. vpc_key1 ● Must be unique for the same VPC and can be the same for different VPCs. ● Can contain a maximum of 36 characters. ● Can contain letters, digits, underscores (_), and hyphens (-).

Value ● Can contain a maximum of 43 characters. vpc-01 ● Can contain letters, digits, underscores (_), periods (.), and hyphens (-).

Table 1-4 Subnet tag key and value requirements Parameter Requirements Example Value

Key ● Cannot be left blank. subnet_key1 ● Must be unique for each subnet. ● Can contain a maximum of 36 characters. ● Can contain letters, digits, underscores (_), and hyphens (-).

Value ● Can contain a maximum of 43 subnet-01 characters. ● Can contain letters, digits, underscores (_), periods (.), and hyphens (-).

5. Confirm the current configuration and click Create Now. 1.2.2 Modifying a VPC

Scenarios Change the VPC name and CIDR block. If the VPC CIDR block conflicts with the CIDR block of a VPN created in the VPC, you can modify its CIDR block.

Notes and Constraints ● If adding a secondary IPv4 CIDR block to a VPC is supported, you cannot modify the CIDR block of an existing VPC. However, you can use APIs to modify the CIDR block of an existing VPC. For details, see the Virtual Private

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 9 Virtual Private Cloud User Guide 1 VPC and Subnet

Cloud API Reference. Currently, secondary IPv4 CIDR blocks for VPCs are available only in AP-Singapore and CN North-Beijing4. For details, see Adding a Secondary CIDR Block to a VPC. ● When modifying the VPC CIDR block: – The VPC CIDR block to be modified must be in the supported CIDR blocks: 10.0.0.0 – 10.255.255.255, 172.16.0.0 – 172.31.255.255, and 192.168.0.0 – 192.168.255.255 – If the VPC has subnets, the VPC CIDR block to be modified must contain all subnet CIDR blocks.

Procedure 1. Log in to the management console. 2. On the console homepage, under Networking, click Virtual Private Cloud. 3. In the navigation pane on the left, click Virtual Private Cloud. 4. On the Virtual Private Cloud page, locate the row that contains the VPC to be modified and click Modify or Edit CIDR Block in the Operation column. 5. On the displayed page, modify parameters as prompted. You can change the CIDR block and name. Figure 1-3 shows the screenshot.

Figure 1-3 Modify VPC

6. Click OK. 1.2.3 Adding a Secondary CIDR Block to a VPC

Scenarios

When you create a VPC, you must specify a CIDR block for the VPC. This is the primary CIDR block of your VPC, and it cannot be modified after the VPC is created.

To extend the IP address range of your VPC, you can add a secondary CIDR block.

If you need to create a subnet in the VPC, you can select either the primary or the secondary CIDR block. Similar to the primary CIDR block, if you create a subnet in the secondary CIDR block, a route will be automatically added to your VPC route table to enable routing within the VPC.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 10 Virtual Private Cloud User Guide 1 VPC and Subnet

NO TE

● Currently, secondary IPv4 CIDR blocks for VPCs are available only in regions AP- Singapore and CN North-Beijing4. ● If adding a secondary IPv4 CIDR block to a VPC is supported, you can only use APIs to modify the CIDR block of an existing VPC. For details, see the Virtual Private Cloud API Reference.

Prerequisites A VPC has been created.

Notes and Constraints ● Only one secondary IPv4 CIDR block can be added to each VPC by default. ● The destination of the route for a subnet in the secondary CIDR block is the subnet CIDR block. The subnet CIDR block must not be the same or larger than a destination CIDR block of a route in the VPC route table. ● Restricted secondary CIDR blocks: – Your primary CIDR blocks or CIDR blocks: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 – CIDR blocks that are the same as or fall within reserved private CIDR blocks: 100.64.0.0/10, 214.0.0.0/7, 198.18.0.0/15 and 169.254.0.0/16 – CIDR blocks that are the same as or fall within reserved public CIDR blocks: 0.0.0.0/8, 127.0.0.0/8, 240.0.0.0/4, and 255.255.255.255/32

Procedure 1. Log in to the management console. 2. On the console homepage, under Networking, click Virtual Private Cloud. 3. In the navigation pane on the left, click Virtual Private Cloud. 4. On the Virtual Private Cloud page, locate the row that contains the VPC to be modified and click Modify or Edit CIDR Block in the Operation column. 5. Click Add Secondary IPv4 CIDR Block.

Figure 1-4 Add Secondary IPv4 CIDR Block

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 11 Virtual Private Cloud User Guide 1 VPC and Subnet

6. Enter the secondary CIDR block and click OK. 1.2.4 Removing a Secondary CIDR Block from a VPC

Scenarios You can remove a secondary CIDR block from a VPC if you no longer need it. You cannot remove the primary IPv4 CIDR block.

NO TE

● Currently, secondary IPv4 CIDR blocks for VPCs are available only in regions AP- Singapore and CN North-Beijing4. ● If adding a secondary IPv4 CIDR block to a VPC is supported, you can only use APIs to modify the CIDR block of an existing VPC. For details, see the Virtual Private Cloud API Reference.

Prerequisites All subnets in the secondary CIDR block have been deleted.

Procedure 1. Log in to the management console. 2. On the console homepage, under Networking, click Virtual Private Cloud. 3. In the navigation pane on the left, click Virtual Private Cloud. 4. In the VPC list, locate the row that contains the VPC from which you want to delete a secondary CIDR block and click Edit CIDR Block in the Operation column. 5. Locate the row that contains the secondary CIDR block to be deleted and click Delete in the Operation column. 1.2.5 Deleting a VPC

Scenarios You can delete a VPC if the VPC is no longer required. You can delete a VPC only if there are no resources in the VPC. If there are resources in the VPC, you must delete those resources before you can delete the VPC. A VPC cannot be deleted if it contains subnets, Direct Connect connections, custom routes, VPC peering connections, or VPNs. To delete the VPC, you must first delete the following resources. ● Subnets. For details, see section Deleting a Subnet. ● VPN connections. For details, see the Virtual Private Network User Guide. ● Direct Connect connections. For details, see the Direct Connect User Guide. ● Custom routes. For details, see section Deleting a Route or Deleting a Route.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 12 Virtual Private Cloud User Guide 1 VPC and Subnet

● VPC peering connections. For details, see section Deleting a VPC Peering Connection.

Notes and Constraints If there are any EIPs or security groups, the last VPC cannot be deleted.

Procedure 1. Log in to the management console. 2. On the console homepage, under Networking, click Virtual Private Cloud. 3. In the navigation pane on the left, click Virtual Private Cloud. 4. On the Virtual Private Cloud page, locate the row that contains the VPC to be deleted and click Delete in the Operation column. 5. Click Yes in the displayed dialog box. 1.2.6 Managing VPC Tags

Scenarios A VPC tag identifies a VPC. Tags can be added to VPCs to facilitate VPC identification and management. You can add a tag to a VPC when creating the VPC, or you can add a tag to a created VPC on the VPC details page. A maximum of 10 tags can be added to each VPC.

A tag consists of a key and value pair. Table 1-5 lists the tag key and value requirements.

Table 1-5 VPC tag key and value requirements

Parameter Requirements Example Value

Key ● Cannot be left blank. vpc_key1 ● Must be unique for the same VPC and can be the same for different VPCs. ● Can contain a maximum of 36 characters. ● Can contain letters, digits, underscores (_), and hyphens (-).

Value ● Can contain a maximum of 43 characters. vpc-01 ● Can contain letters, digits, underscores (_), periods (.), and hyphens (-).

Procedure Search for VPCs by tag key and value on the page showing the VPC list. 1. Log in to the management console.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 13 Virtual Private Cloud User Guide 1 VPC and Subnet

2. Click in the upper left corner and select the desired region and project. 3. Under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Virtual Private Cloud. 5. In the upper right corner of the VPC list, click Search by Tag. 6. In the displayed area, enter the tag key and value of the VPC you are looking for. Both the tag key and value must be specified. The system automatically displays the VPCs you are looking for if both the tag key and value are matched. 7. Click + to add another tag key and value. You can add multiple tag keys and values to refine your search results. If you add more than one tag to search for VPCs, the VPCs containing all specified tags will be displayed. 8. Click Search. The system displays the VPCs you are looking for based on the entered tag keys and values. Add, delete, edit, and view tags on the Tags tab of a VPC. 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. Under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Virtual Private Cloud. 5. On the Virtual Private Cloud page, locate the VPC whose tags are to be managed and click the VPC name. The page showing details about the particular VPC is displayed. 6. Click the Tags tab and perform desired operations on tags. – View tags. On the Tags tab, you can view details about tags added to the current VPC, including the number of tags and the key and value of each tag. – Add a tag. Click Add Tag in the upper left corner. In the displayed Add Tag dialog box, enter the tag key and value, and click OK. – Edit a tag. Locate the row that contains the tag you want to edit, and click Edit in the Operation column. Enter the new tag key and value, and click OK. – Delete a tag. Locate the row that contains the tag you want to delete, and click Delete in the Operation column. In the displayed dialog box, click Yes.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 14 Virtual Private Cloud User Guide 1 VPC and Subnet

1.2.7 Exporting VPC Information

Scenarios Information about all VPCs under your account can be exported as an Excel file to a local directory. This file records the names, ID, status, IP address ranges of VPCs, and the number of subnets.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. Under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Virtual Private Cloud.

5. In the upper right corner of the VPC list, click . The system will automatically export information about all VPCs under your account in the current region. They will be exported in Excel format.

1.3 Subnet

1.3.1 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.

The subnet is configured with DHCP by default. When an ECS in this subnet starts, the ECS automatically obtains an IP address using DHCP.

NO TE

The entry to visit the subnet module varies by region. ● If the subnet module is not decoupled from the VPC module in your selected region, access the subnet module by clicking the Subnets tab on the VPC details page. This is used as the example of the operation procedure in this section. ● If the subnet module is decoupled from the VPC module in your selected region, access the subnet module directly after you click Subnets on the navigation pane of the VPC console.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Virtual Private Cloud.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 15 Virtual Private Cloud User Guide 1 VPC and Subnet

5. On the Virtual Private Cloud page, locate the VPC for which a subnet is to be created and click the VPC name. 6. On the displayed Subnets tab, click Create Subnet. 7. Set the parameters as prompted.

Table 1-6 Parameter descriptions Parameter Description Example Value

VPC The VPC for which you want to create a - subnet. This parameter is available only when Subnets is displayed in the navigation pane.

Name The subnet name. Subnet The name can contain a maximum of 64 characters, which may consist of letters, digits, underscores (_), hyphens (-), and periods (.). The name cannot contain spaces.

CIDR Block The CIDR block for the subnet. This value 192.168.0.0/24 must be within the VPC CIDR block.

IPv4 CIDR The CIDR block for the subnet. This value 192.168.0.0/24 Block must be within the VPC CIDR block.

IPv6 CIDR Specifies whether to set IPv6 CIDR Block - Block to Enable. 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.

Associated The default route table to which the Default Route Table subnet will be associated. You can change the route table to a custom route table on the Subnets page.

Advanced Click the drop-down arrow to set Default Settings advanced settings for the subnet, including Gateway and DNS Server Address.

Gateway The gateway address of the subnet. 192.168.0.1 This IP address is used to communicate with other subnets.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 16 Virtual Private Cloud User Guide 1 VPC and Subnet

Parameter Description Example Value

DNS Server DNS server addresses allow ECSs in a 100.125.x.x Address VPC subnet to communicate with each other using private domain names. You can also directly access cloud services through private DNS servers. If you want to use other public DNS servers for resolution, you can change the default DNS server addresses. A maximum of two DNS server IP addresses can be configured. Multiple IP addresses must be separated using commas (,).

DHCP Lease The period during which a client can use 365 days Time an IP address automatically assigned by the DHCP server. After the lease time expires, a new IP address will be assigned to the client. Unit: Dayor hour If a DHCP lease time is changed, the new lease automatically takes effect when half of the current lease time has passed. To make the change take effect immediately, restart the ECS or log in to the ECS to cause the DHCP lease to automatically renew.

8. Click OK.

Precautions 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 . 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.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 17 Virtual Private Cloud User Guide 1 VPC and Subnet

1.3.2 Modifying a Subnet

Scenarios Change the subnet name and DNS server address.

NO TE

The entry to visit the subnet module varies by region. ● If the subnet module is not decoupled from the VPC module in your selected region, access the subnet module by clicking the Subnets tab on the VPC details page. This is used as the example of the operation procedure in this section. ● If the subnet module is decoupled from the VPC module in your selected region, access the subnet module directly after you click Subnets on the navigation pane of the VPC console.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Virtual Private Cloud. 5. On the Virtual Private Cloud page, locate the VPC for which a subnet is to be modified and click the VPC name. 6. In the subnet list, locate the target subnet and click Modify. Modify the parameters as prompted.

Table 1-7 Parameter descriptions Parameter Description Example Value

Name The subnet name. Subnet The name can contain a maximum of 64 characters, which may consist of letters, digits, underscores (_), hyphens (-), and periods (.). The name cannot contain spaces.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 18 Virtual Private Cloud User Guide 1 VPC and Subnet

Parameter Description Example Value

DNS Server Address DNS server addresses allow 100.125.x.x ECSs in a VPC subnet to communicate with each other using private domain names. You can also directly access cloud services through private DNS servers. If you want to use other public DNS servers for resolution, you can change the default DNS server addresses. A maximum of two DNS server IP addresses can be configured. Multiple IP addresses must be separated using commas (,).

DHCP Lease Time The period during which a 365 days 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. Unit: Dayor hour If a DHCP lease time is changed, the new lease automatically takes effect when half of the current lease time has passed. To make the change take effect immediately, restart the ECS or log in to the ECS to cause the DHCP lease to automatically renew.

7. Click OK. 1.3.3 Deleting a Subnet

Scenarios You can delete a subnet to release network resources if the subnet is no longer required.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 19 Virtual Private Cloud User Guide 1 VPC and Subnet

NO TE

The entry to visit the subnet module varies by region. ● If the subnet module is not decoupled from the VPC module in your selected region, access the subnet module by clicking the Subnets tab on the VPC details page. This is used as the example of the operation procedure in this section. ● If the subnet module is decoupled from the VPC module in your selected region, access the subnet module directly after you click Subnets on the navigation pane of the VPC console.

Prerequisites You can delete a subnet only if there are no resources in the subnet. If there are resources in the subnet, you must delete those resources before you can delete the subnet. You can view all resources of your account on the console homepage and check the resources that are in the subnet you want to delete. The resources may include: ● ECS ● CCI instance ● Load balancer ● VPN ● Private IP address ● Custom route ● NAT gateway ● VPC endpoint and VPC endpoint service If you cannot delete a subnet even after deleting all the resources it contains, submit a service ticket.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Virtual Private Cloud. 5. On the Virtual Private Cloud page, locate the VPC from which a subnet is to be deleted and click the VPC name. 6. On the Subnets page, locate the target subnet and click Delete. 7. Click Yes in the displayed dialog box. 1.3.4 Managing Subnet Tags

Scenarios A subnet tag identifies a subnet. Tags can be added to subnets to facilitate subnet identification and administration. You can add a tag to a subnet when creating the

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 20 Virtual Private Cloud User Guide 1 VPC and Subnet

subnet, or you can add a tag to a created subnet on the subnet details page. A maximum of 10 tags can be added to each subnet.

A tag consists of a key and value pair. Table 1-8 lists the tag key and value requirements.

Table 1-8 Subnet tag key and value requirements

Parameter Requirements Example Value

Key ● Cannot be left blank. subnet_key1 ● Must be unique for each subnet. ● Can contain a maximum of 36 characters. ● Can contain letters, digits, underscores (_), and hyphens (-).

Value ● Can contain a maximum of 43 subnet-01 characters. ● Can contain letters, digits, underscores (_), periods (.), and hyphens (-).

NO TE

The entry to visit the subnet module varies by region. ● If the subnet module is not decoupled from the VPC module in your selected region, access the subnet module by clicking the Subnets tab on the VPC details page. This is used as the example of the operation procedure in this section. ● If the subnet module is decoupled from the VPC module in your selected region, access the subnet module directly after you click Subnets on the navigation pane of the VPC console.

Procedure Search for subnets by tag key and value on the page showing the subnet list. 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. Under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Virtual Private Cloud. 5. On the Virtual Private Cloud page, locate the VPC containing the target subnet and click the VPC name. 6. In the upper right corner of the subnet list, click Search by Tag. 7. Enter the tag key of the subnet to be queried. Both the tag key and value must be specified. The system automatically displays the subnets you are looking for if both the tag key and value are matched. 8. Click + to add another tag key and value.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 21 Virtual Private Cloud User Guide 1 VPC and Subnet

You can add multiple tag keys and values to refine your search results. If you add more than one tag to search for subnets, the subnets containing all specified tags will be displayed. 9. Click Search. The system displays the subnets you are looking for based on the entered tag keys and values.

Add, delete, edit, and view tags on the Tags tab of a subnet. 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. Under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Virtual Private Cloud. 5. On the Virtual Private Cloud page, locate the VPC containing the target subnet and click the VPC name. 6. Click the name of the target subnet. 7. On the subnet details page, click the Tags tab and perform desired operations on tags. – View tags. On the Tags tab, you can view details about tags added to the current subnet, including the number of tags and the key and value of each tag. – Add a tag. Click Add Tag in the upper left corner. In the displayed Add Tag dialog box, enter the tag key and value, and click OK. – Edit a tag. Locate the row that contains the tag you want to edit, and click Edit in the Operation column. Enter the new tag key and value, and click OK. – Delete a tag. Locate the row that contains the tag you want to delete, and click Delete in the Operation column. In the displayed dialog box, click Yes.

1.4 IPv4 and IPv6 Dual-Stack Network

Overview

IPv4 and IPv6 dual-stack allows your resources, such as ECSs, to use both IPv4 and IPv6 addresses for private and public network communications.

● Private IPv4 addresses can be used for private network access between ECSs. ● Private IPv4 addresses with EIPs bound can be used for Internet access. ● IPv6 addresses can be used for private network access between ECSs (in the same VPC) that have both IPv4 and IPv6 addresses. ● IPv6 addresses can be used to access IPv6 networks on the Internet.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 22 Virtual Private Cloud User Guide 1 VPC and Subnet

Application Scenarios If your application provides services for users who use IPv6 clients, you can use IPv6 EIPs or IPv4/IPv6 dual-stack function. If your application provides services for users who use IPv6 clients and analyzes the requests, you need to use the IPv4 and IPv6 dual-stack function. If private network communication is required between your application systems or between your application system and another system (such as a database system), you can only use the IPv4 and IPv6 dual-stack function.

Basic Operations NO TE

● Basic operations for IPv4 and IPv6 dual-stack networks are the same as those for IPv4 networks, except some parameters. Check the console pages for details. ● The IPv4/IPv6 dual-stack function is currently free, but will be billed at a later date (price yet to be determined). ● You can experience IPv4/IPv6 dual-stack networks only when you select ECSs configured with specific flavors in the following regions: ● S6, C6s, C6, M6, T6, and I3 ECSs in AZ 1 of the AP-Singapore region ● S6, C6s, C6, M6, and I3 ECSs in AZ 2 of the AP-Singapore region ● C6 ECSs in AZ 1 of the LA-Sao Paulo region ● C6 ECSs in AZ 1 of the CN-Hong Kong region ● C6 ECSs in AZ 2 of the CN-Hong Kong region Creating an IPv6 Subnet Create an IPv6 subnet by following the instructions in Creating a Subnet for the VPC. Select Enable for IPv6 CIDR Block. An IPv6 CIDR block will be automatically assigned to the subnet. IPv6 cannot be disabled after the subnet is created. Currently, customizing IPv6 CIDR block is not supported. Viewing In-Use IPv6 Addresses In the subnet list, click the subnet name. On the displayed page, view in-use IPv6 addresses on the IP Addresses tab page. Adding a Security Group Rule (IPv6) Add a security group rule with Type set to IPv6 and Source or Destination set to an IPv6 address or IPv6 CIDR block.

Adding a Network ACL Rule (IPv6) Add a network ACL rule with Type set to IPv6 and Source or Destination set to an IPv6 address or IPv6 CIDR block.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 23 Virtual Private Cloud User Guide 1 VPC and Subnet

Figure 1-5 Adding a network ACL rule (IPv6)

Adding a Route (IPv6) Add a route with Destination set to an IPv6 address and Next Hop set to an IPv6 address or CIDR block. For details about how to add a route, see Adding a Custom Route. If the destination is an IPv6 CIDR block, the next hop can only be an IP address in the same VPC as the IPv6 CIDR block.

NO TE

If the destination is an IPv6 CIDR block, the next hop type can only be an ECS, extension NIC, or virtual IP address. The next hop must also have IPv6 addresses. Dynamically Assigning IPv6 Addresses After an ECS is created successfully, you can view the assigned IPv6 address on the ECS details page. You can also log in to the ECS and run the ifconfig command to view the assigned IPv6 address. If an IPv6 address fails to be automatically assigned or the selected image does not support the function of automatic IPv6 address assignment, manually obtain the IPv6 address by referring to Dynamically Assigning IPv6 Addresses.

NO TE

If an ECS is created from a public image: ● By default, dynamic IPv6 address assignment is enabled for Windows public images. ● Before enabling dynamic IPv6 address assignment for a Linux public image, check whether IPv6 is supported and then check whether dynamic IPv6 address assignment has been enabled. Currently, all Linux public images support IPv6, and dynamic IPv6 address assignment is enabled for the Ubuntu 16 OS by default. You do not need to configure dynamic IPv6 address assignment for the Ubuntu 16 OS. For other Linux public images, you need to enable this function.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 24 Virtual Private Cloud User Guide 2 Security

2 Security

2.1 Security Group

2.1.1 Security Group Overview

Security Group A security group is a collection of access control rules for ECSs that have the same security protection requirements and are mutually trusted within a VPC. After you create a security group, you can create different access rules for the security group, and the rules will apply to any ECS that the security group contains.

Your account automatically comes with a default security group. The default security group allows all outbound traffic, denies all inbound traffic, and allows all traffic between ECSs in the group. Your ECSs in this security group can communicate with each other already without adding additional rules. You can directly use the default security group. For details, see Default Security Groups and Security Group Rules.

You can also create custom security groups to meet your specific service requirements. For details, see Creating a Security Group.

Security Group Basics ● You can associate instances, such as servers and extension NICs, with one or more security groups. You can change the security groups that are associated with instances, such as servers or extension NICs. By default, when you create an instance, it is associated with the default security group of its VPC unless you specify another security group. ● You need to add security group rules to allow instances in the same security group to communicate with each other. ● Security groups are stateful. If you send a request from your instance and the outbound traffic is allowed, the response traffic for that request is allowed to flow in regardless of inbound security group rules. Similarly, if inbound traffic

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 25 Virtual Private Cloud User Guide 2 Security

is allowed, responses to allowed inbound traffic are allowed to flow out, regardless of outbound rules. Security groups use connection tracking to track traffic to and from instances that they contain and security group rules are applied based on the connection status of the traffic to determine whether to allow or deny traffic. If you add, modify, or delete a security group rule, or create or delete an instance in the security group, the connection tracking of all instances in the security group will be automatically cleared. In this case, the inbound or outbound traffic of the instance will be considered as new connections, which need to match the inbound or outbound security group rules to ensure that the rules take effect immediately and the security of incoming traffic. In addition, if the inbound or outbound traffic of an instance has no packets for a long time, the traffic will be considered as new connections after the connection tracking times out, and the connections need to match the outbound and inbound rules. The timeout period of connection tracking varies according to the protocol. The timeout period of a TCP connection in the established state is 600s, and the timeout period of an ICMP connection is 30s. For other protocols, if packets are received in both directions, the connection tracking timeout period is 180s. If one or more packets are received in one direction but no packet is received in the other direction, the connection tracking timeout period is 30s. For protocols other than TCP, UDP, and ICMP, only the IP address and protocol number are tracked.

NO TE

If two ECSs are in the same security group but in different VPCs, the ECSs cannot communicate with each other. To enable communications between the ECSs, use a VPC peering connection to connect the two VPCs. For details about VPC connectivity, see Application Scenarios.

Security Group Rules

After you create a security group, you can add rules to the security group. A rule applies either to inbound traffic or outbound traffic. After you add ECSs to the security group, they are protected by the rules of the group.

A security group rule consists of:

● Source (inbound rule) or Destination (outbound rule): The value can be an IP address (such as 192.168.10.10/32), IP address range (such as 192.168.52.0/24), or a security group (such as sg-abc). ● Protocol & Port: The value of ports can be individual ports (such as 22), consecutive ports (such as 22-30), ports and port ranges (such as 20,23-30), all ports (1-65535). The protocol can be TCP, UDP, HTTP, and others. ● Source: The value can be a single IP address, an IP address group, or a security group. ● Type: The value can be IPv4 or IPv6. ● Description: Supplementary information about the security group rule.

Each security group has default rules. You can also customize security group rules. For details, see Adding a Security Group Rule.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 26 Virtual Private Cloud User Guide 2 Security

Security Group Template You can select one of the following security group templates provided by the system to quickly create a security group with default rules. ● General-purpose web server: The security group that you create using this template is for general-purpose web servers and includes default rules that allow all inbound ICMP traffic and allow inbound traffic on ports 22, 80, 443, and 3389. ● All ports open: The security group that you create using this template includes default rules that allow inbound traffic on any port. Note that allowing inbound traffic on any port poses security risks. ● Custom: The security group that you create using this template includes default rules that deny inbound traffic on any port. You can add or modify security group rules as required.

Security Group Configuration Process

Figure 2-1 Process for configuring a security group

Security Group Constraints ● By default, you can create a maximum of 100 security groups in your cloud account. ● By default, you can add up to 50 security group rules to a security group. ● By default, you can add an ECS or an extension NIC to a maximum of five security groups. In such a case, the rules of all the selected security groups are aggregated to take effect. ● You can add a maximum of 20 instances to a security group at a time. ● Do not add more than 1000 instances to the same security group. Otherwise, the security group performance may be impacted.

Suggestions When using a security group:

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 27 Virtual Private Cloud User Guide 2 Security

● Do not add all instances to the same security group if they have different isolation requirements. ● It is not necessary that you create a security group for each instance. Instead, you can add instances with the same security requirements to the same security group.

When adding a security group rule: ● Define simple security group rules. For example, if you add an instance to multiple security groups, the instance may comply with hundreds of security group rules, and a change to any rule may cause network disconnection for the instance. ● Before you modify a security group and its rules, clone the security group and then modify the cloned security group to test communication and prevent adverse impact on running services. For details, see Cloning a Security Group. ● When adding a security group rule for an instance, grant the minimum permissions possible. For example: – Open a specific port, for example, 22. It is not recommended that you open a port range, for example, 22-30. – It is not recommended that you enter 0.0.0.0/0, allowing traffic to or from all IP addresses. 2.1.2 Default Security Groups and Security Group Rules Your account automatically comes with a default security group (Sys-default). The default security group allows all outbound traffic, denies all inbound traffic, and allows all traffic between ECSs in the group. Your ECSs in this security group can communicate with each other already without adding additional rules.

Figure 2-2 shows the default security group.

Figure 2-2 Default security group

NO TE

● You cannot delete the default security group, but you can modify the rules for the default security group. ● If two ECSs are in the same security group but in different VPCs, the ECSs cannot communicate with each other. To enable communications between the ECSs, use a VPC peering connection to connect the two VPCs. For details about VPC connectivity, see Application Scenarios.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 28 Virtual Private Cloud User Guide 2 Security

Table 2-1 describes the default rules for the default security group (Sys-default).

Table 2-1 Rules in the default security group (Sys-default)

Directio Protocol Port/ Source/ Description n Range Destination

Outboun All All Destination: Allows all outbound d 0.0.0.0/0 traffic.

Inbound All All Source: the current Allows security group (for communication example, sg-xxxxx) among ECSs within the security group and denies all inbound traffic (incoming data packets).

Inbound TCP 22 Source: 0.0.0.0/0 Allows all IP addresses to access Linux ECSs over SSH.

Inbound TCP 3389 Source: 0.0.0.0/0 Allows all IP addresses to access Windows ECSs over RDP.

2.1.3 Security Group Configuration Examples

Common security group configurations are presented here. The examples in this section allow all outgoing data packets by default. This section will only describe how to configure inbound rules.

● Allowing External Access to a Specified Port ● Enabling ECSs in Different Security Groups to Communicate with Each Other Through an Internal Network ● Enabling Specified IP Addresses to Remotely Access ECSs in a Security Group ● Remotely Connecting to Linux ECSs Using SSH ● Remotely Connecting to Windows ECSs Using RDP ● Enabling Communication Between ECSs ● Hosting a Website on ECSs ● Enabling an ECS to Function as a DNS Server ● Uploading or Downloading Files Using FTP

You can use the default security group or create a security group in advance. For details, see sections Creating a Security Group and Adding a Security Group Rule.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 29 Virtual Private Cloud User Guide 2 Security

Allowing External Access to a Specified Port ● Example scenario: After services are deployed, you can add security group rules to allow external access to a specified port (for example, 1100). ● Security group rule:

Directi Protocol Port Source on

Inboun TCP 1100 0.0.0.0/0 d

Enabling ECSs in Different Security Groups to Communicate with Each Other Through an Internal Network ● Example scenario: Resources on an ECS in a security group need to be copied to an ECS associated with another security group. The two ECSs are in the same VPC. We recommend that you enable private network communication between the ECSs and then copy the resources. ● Security group configuration: Within a given VPC, ECSs in the same security group can communicate with one another by default. However, ECSs in different security groups cannot communicate with each other by default. To enable these ECSs to communicate with each other, you need to add certain security group rules. You can add an inbound rule to the security groups containing the ECSs to allow access from ECSs in the other security group. The required rule is as follows.

Directi Protocol/Application Port Source on

Inboun Used for Port or port ID of another d communication range security group through an internal network

Enabling Specified IP Addresses to Remotely Access ECSs in a Security Group ● Example scenario: To prevent ECSs from being attacked, you can change the port number for remote login and configure security group rules that allow only specified IP addresses to remotely access the ECSs. ● Security group configuration: To allow IP address 192.168.20.2 to remotely access Linux ECSs in a security group over the SSH protocol (port 22), you can configure the following security group rule.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 30 Virtual Private Cloud User Guide 2 Security

Directi Protocol Port Source on

Inboun SSH 22 IPv4 CIDR block or ID of another d security group For example, 192.168.20.2/32

Remotely Connecting to Linux ECSs Using SSH ● Example scenario: After creating Linux ECSs, you can add a security group rule to enable remote SSH access to the ECSs.

NO TE

The default security group comes with the following rule. If you use the default security group, you do not need to add this rule again. ● Security group rule:

Directio Protocol Port Source n

Inbound SSH 22 0.0.0.0/0

Remotely Connecting to Windows ECSs Using RDP ● Example scenario: After creating Windows ECSs, you can add a security group rule to enable remote RDP access to the ECSs.

NO TE

The default security group comes with the following rule. If you use the default security group, you do not need to add this rule again. ● Security group rule:

Directio Protocol Port Source n

Inbound RDP 3389 0.0.0.0/0

Enabling Communication Between ECSs ● Example scenario: After creating ECSs, you need to add a security group rule so that you can run the ping command to test communication between the ECSs. ● Security group rule:

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 31 Virtual Private Cloud User Guide 2 Security

Direction Protocol Port Source

Inbound ICMP All 0.0.0.0/0

Hosting a Website on ECSs ● Example scenario: If you deploy a website on your ECSs and require that your website be accessed over HTTP or HTTPS, you can add rules to the security group used by the ECSs that function as the web servers. ● Security group rule:

Direction Protocol Port Source

Inbound HTTP 80 0.0.0.0/0

Inbound HTTPS 443 0.0.0.0/0

Enabling an ECS to Function as a DNS Server ● Example scenario: If you need to use an ECS as a DNS server, you must allow TCP and UDP access from port 53 to the DNS server. You can add the following rules to the security group associated with the ECS. ● Security group rules:

Direction Protocol Port Source

Inbound TCP 53 0.0.0.0/0

Inbound UDP 53 0.0.0.0/0

Uploading or Downloading Files Using FTP ● Example scenario: If you want to use File Transfer Protocol (FTP) to upload files to or download files from ECSs, you need to add a security group rule.

NO TE

You must first install the FTP server program on the ECSs and check whether ports 20 and 21 are working properly. ● Security group rule:

Direction Protocol Port Source

Inbound TCP 20-21 0.0.0.0/0

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 32 Virtual Private Cloud User Guide 2 Security

Adding an ECS to Multiple Security Groups You may need to add an ECS to multiple security groups based on service requirements. In such a case, the rules of these security groups are effectively aggregated to create one set of rules to apply on the ECS. This might cause problems when you access the ECS. We recommend that you associate no more than five security groups with each ECS. 2.1.4 Creating a Security Group

Scenarios You can create a security group and add ECSs in a VPC to the security group to improve ECS access security. We recommend that you allocate ECSs that have different Internet access policies to different security groups. Each ECS must be associated with at least one security group. If you have no security groups when buying an ECS, the ECS will use the default security group (Sys-default). You have an option to create a new security group for the ECS. This section describes how to create a security group on the management console.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Security Groups. 5. On the Security Groups page, click Create Security Group. 6. In the Create Security Group area, set the parameters as prompted. Table 2-2 lists the parameters to be configured.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 33 Virtual Private Cloud User Guide 2 Security

Figure 2-3 Create Security Group

Table 2-2 Parameter description Parameter Description Example Value

Template A template comes with default security group General- rules, helping you quickly create security purpose web groups. The following templates are provided: server ● Custom: This template allows you to create security groups with custom security group rules. ● General-purpose web server: The security group that you create using this template is for general-purpose web servers and includes default rules that allow all inbound ICMP traffic and allow inbound traffic on ports 22, 80, 443, and 3389. ● All ports open: The security group that you create using this template includes default rules that allow inbound traffic on any port. Note that allowing inbound traffic on any port poses security risks.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 34 Virtual Private Cloud User Guide 2 Security

Parameter Description Example Value

Name The security group name. This parameter is sg-318b mandatory. The security group name can contain a maximum of 64 characters, which may consist of letters, digits, underscores (_), hyphens (-), and periods (.). The name cannot contain spaces. NOTE You can change the security group name after a security group is created. It is recommended that you give each security group a different name.

Description Supplementary information about the N/A security group. This parameter is optional. The security group description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).

7. Click OK.

Related Operations ● For each security group, you can add rules that control the inbound traffic to ECSs, and a separate set of rules that control the outbound traffic. For details, see Adding a Security Group Rule. ● Each ECS must be associated with at least one security group. You can add an ECS to multiple security groups based on service requirements. For details, see Adding Instances to and Removing Them from a Security Group. 2.1.5 Adding a Security Group Rule

Scenarios After you create a security group, you can add rules to the security group. A rule applies either to inbound traffic or outbound traffic. After you add ECSs to the security group, they are protected by the rules of the group. ● Inbound rules control incoming traffic to ECSs associated with the security group. ● Outbound rules control outgoing traffic from ECSs associated with the security group. For details about the default security group rules, see Default Security Groups and Security Group Rules. For details about security group rule configuration examples, see Security Group Configuration Examples.

Prerequisites ● A security group has been created. For details about how to create a security group, see Creating a Security Group.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 35 Virtual Private Cloud User Guide 2 Security

● You have planned the public or private networks that can or cannot access instances, such as ECSs. For more examples of security group rules, see Security Group Configuration Examples.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Security Groups. 5. On the Security Groups page, locate the target security group and click Manage Rule in the Operation column to switch to the page for managing inbound and outbound rules. 6. On the Inbound Rules tab, click Add Rule. In the displayed dialog box, set required parameters to add an inbound rule. You can click + to add more inbound rules.

Figure 2-4 Add Inbound Rule

Table 2-3 Inbound rule parameter description Param Description Example eter Value

Protoc Protocol: The network protocol. Currently, the value TCP ol & can be All, TCP, UDP, ICMP, GRE, or others. Port Port: The port or port range over which the traffic 22, or can reach your ECS. The value ranges from 1 to 22-30 65535.

Type The IP address type. This parameter is available IPv4 only after the IPv6 function is enabled. ● IPv4 ● IPv6

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 36 Virtual Private Cloud User Guide 2 Security

Param Description Example eter Value

Source The source of the security group rule. The value can 0.0.0.0/0 be a single IP address, an IP address group, or a security group to allow access from the IP address or instances in the security group. For example: ● Single IP address: 192.168.10.10/32 (IPv4); 2002:50::44/127 (IPv6) ● IP address range: 192.168.1.0/24 (IPv4); 2407:c080:802:469::/64 (IPv6) ● All IP addresses: 0.0.0.0/0 (IPv4); ::/0 (IPv6) ● Security group: sg-abc ● IP address group: ipGroup-test For more information about IP address groups, see IP Address Group Overview.

Descrip Supplementary information about the security N/A tion group rule. This parameter is optional. The security group rule description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).

7. On the Outbound Rules tab, click Add Rule. In the displayed dialog box, set required parameters to add an outbound rule. You can click + to add more outbound rules.

Figure 2-5 Add Outbound Rule

Table 2-4 Outbound rule parameter description

Param Description Example eter Value

Protoc Protocol: The network protocol. Currently, the value TCP ol & can be All, TCP, UDP, ICMP, GRE, or others. Port

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 37 Virtual Private Cloud User Guide 2 Security

Param Description Example eter Value

Port: The port or port range over which the traffic 22, or can leave your ECS. The value ranges from 1 to 22-30 65535.

Type The IP address type. IPv4 ● IPv4 ● IPv6

Destina The destination of the security group rule. The 0.0.0.0/0 tion value can be a single IP address, an IP address group, or a security group to allow access to the IP address or instances in the security group. For example: ● Single IP address: 192.168.10.10/32 (IPv4); 2002:50::44/127 (IPv6) ● IP address range: 192.168.1.0/24 (IPv4); 2407:c080:802:469::/64 (IPv6) ● All IP addresses: 0.0.0.0/0 (IPv4); ::/0 (IPv6) ● Security group: sg-abc ● IP address group: ipGroup-test For more information about IP address groups, see IP Address Group Overview.

Descrip Supplementary information about the security N/A tion group rule. This parameter is optional. The security group rule description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).

8. Click OK.

Verification

After required security group rules are added, you can verify that the rules take effect. For example, you have deployed a website on ECSs. Users need to access your website over TCP (port 80), and you have added the security group rule shown in Table 2-5.

Table 2-5 Security group rule

Direction Protocol Port Source

Inbound TCP 80 0.0.0.0/0

Linux ECS

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 38 Virtual Private Cloud User Guide 2 Security

To verify the security group rule on a Linux ECS: 1. Log in to the ECS. 2. Run the following command to check whether TCP port 80 is being listened on: netstat -an | grep 80 If command output shown in Figure 2-6 is displayed, TCP port 80 is being listened on.

Figure 2-6 Command output for the Linux ECS

3. Enter http://ECS EIP in the address box of the browser and press Enter. If the requested page can be accessed, the security group rule has taken effect. Windows ECS To verify the security group rule on a Windows ECS: 1. Log in to the ECS. 2. Choose Start > Accessories > Command Prompt. 3. Run the following command to check whether TCP port 80 is being listened on: netstat -an | findstr 80 If command output shown in Figure 2-7 is displayed, TCP port 80 is being listened on.

Figure 2-7 Command output for the Windows ECS

4. Enter http://ECS EIP in the address box of the browser and press Enter. If the requested page can be accessed, the security group rule has taken effect.

Related Operations Allow Common Ports You can click Allow Common Ports to allow traffic on some common ports, such as port 21, 22, 3389, 80, 443, and 20.

Figure 2-8 Allow Common Ports

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 39 Virtual Private Cloud User Guide 2 Security

Helpful Links ● Are the Security Group Rules Considered the Same If All Parameters Except Their Description Are the Same? ● How Do I Configure a Security Group for Multi-Channel Protocols? 2.1.6 Fast-Adding Security Group Rules

Scenarios You can add multiple security group rules with different protocols and ports at the same time.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Security Groups. 5. On the Security Groups page, locate the target security group and click Manage Rule in the Operation column to switch to the page for managing inbound and outbound rules. 6. On the Inbound Rules tab, click Fast-Add Rule. In the displayed dialog box, select the protocols and ports you wish to add all at once.

Figure 2-9 Fast-Add Inbound Rule

7. On the Outbound Rules tab, click Fast-Add Rule. In the displayed dialog box, select required protocols and ports to add multiple rules at a time.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 40 Virtual Private Cloud User Guide 2 Security

Figure 2-10 Fast-Add Outbound Rule

8. Click OK. 2.1.7 Replicating a Security Group Rule

Scenarios

Replicate an existing security group rule to generate a new rule. When replicating a security group rule, you can make changes so that it is not a perfect copy.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Security Groups. 5. On the Security Groups page, click the security group name. 6. On the displayed page, locate the row that contains the security group rule to be replicated, and click Replicate in the Operation column. You can also modify the security group rule as required to quickly generate a new rule. 7. Click OK. 2.1.8 Modifying a Security Group Rule

Scenarios

Improper security group rules may cause serious security risks. For example, security group rules allow access to specific ports. You can modify the port, protocol, and IP address of such rules to ensure the security of your instances.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 41 Virtual Private Cloud User Guide 2 Security

Prerequisites

A security group has been created, and security group rules have been added to the security group.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Security Groups. 5. On the Security Groups page, click the security group name. 6. On the displayed page, locate the row that contains the security group rule to be modified, and click Modify in the Operation column. 7. Modify the rule and click Confirm. 2.1.9 Deleting a Security Group Rule

Scenarios

If the source of an inbound security group rule or destination of an outbound security group rule needs to be changed, you need to first delete the security group rule and add a new one.

NO TE

Security group rules use whitelists. Deleting a security group rule may result in ECS access failures.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Security Groups. 5. On the Security Groups page, click the security group name. 6. If you do not need a security group rule, locate the row that contains the target rule, and click Delete. 7. Click Yes in the displayed dialog box.

Deleting multiple security group rules at once

You can also select multiple security group rules and click Delete above the security group rule list to delete multiple rules at a time.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 42 Virtual Private Cloud User Guide 2 Security

2.1.10 Importing and Exporting Security Group Rules

Scenarios ● If you want to quickly create or restore security group rules, you can import existing rules to the security group. ● If you want to back up security group rules locally, you can export the rules to an Excel file. ● If you want to quickly apply the rules of one security group to another, or if you want to modify multiple rules of the current security group at once, you can import or export existing rules.

Notes and Constraints ● When modifying exported security group rules, you can only modify existing fields in the exported file based on the template and cannot add new fields or modify the field names. Otherwise, the file will fail to be imported. ● When importing security group rules, if the source is an IP address group, ensure that the IP address group exists and its name and ID are correct. The format is ipGroup-zy[2b5213cb-0f41-4d0b-bed9-b6340bf51017]. ● Duplicate rules are not allowed.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Security Groups. 5. On the Security Groups page, click the security group name. 6. On the displayed page, export and import security group rules.

– Click to export all rules of the current security group to an Excel file.

– Click to import security group rules from an Excel file into the current security group. 2.1.11 Deleting a Security Group

Scenarios

You can delete a security group to release resources if the security group is no longer required.

Notes and Constraints ● The default security group cannot be deleted. ● If a security group is associated with resources other than servers and extension NICs, the security group cannot be deleted.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 43 Virtual Private Cloud User Guide 2 Security

Prerequisites ● Before deleting a security group, ensure that the security group is not used by any cloud resource, such as ECS, Relational Database Service (RDS), and Distributed Cache Service (DCS). If the security group is used by a cloud resource, release the cloud resource or change the security group used by the cloud resource, and then delete the security group. ● If the security group you want to delete is associated with rules of another security group (Source), delete or modify the associated security group rules, and then delete the security group.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Security Groups. 5. On the Security Groups page, locate the row that contains the target security group, click More in the Operation column, and click Delete. 6. Click Yes in the displayed dialog box. 2.1.12 Adding Instances to and Removing Them from a Security Group

Scenarios

After a security group is created, you can add instances, including servers and extension NICs, to the security group to protect the instances. If the instances are not required, you can also remove them from the security group.

You can add multiple instances to or remove them from a security group.

Adding Instances to a Security Group 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Security Groups. 5. On the Security Groups page, click Manage Instance in the Operation column. 6. On the Servers tab, click Add and add one or more servers to the current security group. 7. On the Extension NICs tab, click Add and add one or more extension NICs to the current security group. 8. Click OK.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 44 Virtual Private Cloud User Guide 2 Security

Removing Instances from a Security Group

NO TE

● Instances have been added to two or more security groups. ● The instances removed from a security group cannot communicate with other instances in this security group. Ensure that your instances will not be adversely affected before you remove instances from a security group. 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Security Groups. 5. On the Security Groups page, click Manage Instance in the Operation column. 6. On the Servers tab, locate the target server and click Remove in the Operation column to remove the server from current security group. 7. On the Extension NICs tab, locate the target extension NIC and click Remove in the Operation column to remove the NIC from the current security group. 8. Click Yes.

Removing multiple instances from a security group

Select multiple servers and click Remove above the server list to remove the selected servers from the current security group all at once.

Select multiple extension NICs and click Remove above the extension NIC list to remove the selected extension NICs from the current security group all at once.

Related Operations ● You can change a security group for an instance based on service requirements. ● You can delete the security groups that you no longer need. Deleting a security group will also delete its security group rules. 2.1.13 Cloning a Security Group

Scenarios

You can clone a security group from one region to another to quickly apply the security group rules to ECSs in another region.

You can clone a security group in the following scenarios:

● For example, you have security group sg-A in region A. If ECSs in region B require the same security group rules as those configured for security group sg-A, you can clone security group sg-A to region B, freeing you from creating a new security group in region B. ● If you need new security group rules, you can clone the original security group as a backup.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 45 Virtual Private Cloud User Guide 2 Security

Notes and Constraints If you clone security group across regions, the system will clone only rules whose source and destination are CIDR blocks and rules whose source and destination is the current security group.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Security Groups. 5. On the Security Groups page, locate the row that contains the target security group and choose More > Clone in the Operation column. 6. Set required parameters and click OK. You can then switch to the required region to view the cloned security group in the security group list. 2.1.14 Modifying a Security Group Name

Scenarios Modify the name and description of a created security group.

Procedure Method 1

1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Security Groups. 5. On the Security Groups page, locate the target security group and choose More > Modify in the Operation column. 6. Modify the name and description of the security group as required. 7. Click OK.

Method 2

1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Security Groups. 5. On the Security Groups page, click the security group name. 6. On the displayed page, click on the right of Name and edit the security group name.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 46 Virtual Private Cloud User Guide 2 Security

7. Click √ to save the security group name. 8. Click on the right of Description and edit the security group description. 9. Click √ to save the security group description. 2.1.15 Viewing the Security Group of an ECS

Scenarios View inbound and outbound rules of a security group used by an ECS.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. Under Computing, click Elastic Cloud Server. 4. On the Elastic Cloud Server page, click the name of the target ECS. 5. Click the Security Groups tab and view information about the security group used by the ECS. 2.1.16 Changing the Security Group of an ECS

Scenarios Change the security group associated with an ECS NIC.

Procedure 1. Log in to the management console. 2. Under Compute, click Elastic Cloud Server. 3. In the ECS list, locate the row that contains the target ECS. Click More in the Operation column and select Manage Network > Change Security Group. The Change Security Group dialog box is displayed.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 47 Virtual Private Cloud User Guide 2 Security

Figure 2-11 Change Security Group

4. Select the target NIC and security groups as prompted. You can select multiple security groups. In such a case, the rules of all the selected security groups will be aggregated to apply on the ECS. To create a security group, click Create Security Group.

NO TE

Using multiple security groups may deteriorate ECS network performance. You are suggested to select no more than five security groups. 5. Click OK. 2.1.17 Common Ports Used by ECSs When adding a security group rule, you must specify the port or port range for communication. When a security group detects an access request, it checks whether the IP address and the port of the device that sends the request are allowed by security group rules. Data communication can be established only when security group rules allow the request.

Table 2-6 lists the common ports used by ECSs. You can configure security group rules to allow traffic to and from specified ECS ports. For details, see Adding a Security Group Rule. For more information about requirements for Windows, see Service overview and network port requirements for Windows.

Table 2-6 Common ports used by ECSs

Protocol Port Description

FTP 21 An FTP port used to upload and download files

SSH 22 An SSH port used to remotely connect to Linux ECSs

Telnet 23 A port used to remotely log in to ECSs using Telnet

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 48 Virtual Private Cloud User Guide 2 Security

Protocol Port Description

SMTP 25 A port of the SMTP server, which is used to send emails For security purposes, TCP port 25 is disabled in the outbound direction by default. For details about how to open the port, see Why Is Outbound Access Through TCP Port 25 Restricted?

HTTP 80 A port used to access websites over HTTP

POP3 110 A port used to receive emails using Post Office Protocol version 3 (POP3)

IMAP 143 A port used to receive emails using Internet Message Access Protocol (IMAP)

HTTPS 443 A port used to access websites over HTTPS

SQL Server 1433 A TCP port of the Microsoft SQL Server for providing services

SQL Server 1434 A UDP port of the Microsoft SQL Server for returning the TCP/IP port number used by the SQL Server

Oracle 1521 Oracle database communications port, which must be enabled on the ECSs where Oracle SQL Server is deployed

MySQL 3306 A port used by MySQL databases to provide services

Windows 3389 Windows Server Remote Desktop Services port, which Server Remote can be used to connect to Windows ECSs Desktop Services

Proxy 8080 Proxy port 8080 used in the WWW proxy service for web browsing. If you use port 8080, you need to add :8080 after the IP address when you visit a website or use a proxy server. After Apache Tomcat is installed, the default service port is 8080.

NetBIOS 137, NetBIOS is often used for Windows files, printer 138, sharing, and Samba. and ● Ports 137 and 138: UDP ports that are used when 139 transferring files using Network Neighborhood (My Network Places) ● Port 139: Connections from this port try to access the NetBIOS/SMB service.

Some Ports Inaccessible Symptom: Users in certain areas cannot access some ports in the public cloud system.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 49 Virtual Private Cloud User Guide 2 Security

Analysis: Ports listed in the following table are high-risk ports and are blocked by default.

Table 2-7 High-risk ports

Protocol Port

TCP 42, 135, 137, 138, 139, 444, 445, 593, 1025, 1068, 1434, 3127, 3128, 3129, 3130, 4444, 4789, 5554, 5800, 5900, and 9996

UDP 135 to 139, 1026, 1027, 1028, 1068, 1433, 1434, 4789, 5554, and 9996

Solution: It is recommended that you use ports that are not listed in the table for your services.

2.2 Network ACL

2.2.1 Network ACL Overview A network ACL is an optional layer of security for your subnets. After you associate one or more subnets with a network ACL, you can control traffic in and out of the subnets. Figure 2-12 shows how a network ACL works.

Figure 2-12 Security groups and network ACLs

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 50 Virtual Private Cloud User Guide 2 Security

Similar to security groups, network ACLs control access to subnets and add an additional layer of defense to your subnets. Security groups only have the "allow" rules, but network ACLs have both "allow" and "deny" rules. You can use network ACLs together with security groups to implement comprehensive and fine-grained access control.

Differences Between Security Groups and Network ACLs summarizes the basic differences between security groups and network ACLs.

Network ACL Basics ● Your VPC does not come with a network ACL, but you can create a network ACL and associate it with a VPC subnet if required. By default, each network ACL denies all inbound traffic to and outbound traffic from the associated subnet until you add rules. ● You can associate a network ACL with multiple subnets. However, a subnet can only be associated with one network ACL at a time. ● Each newly created network ACL is in the Inactive state until you associate subnets with it. ● Network ACLs are stateful. If you send a request from your instance and the outbound traffic is allowed, the response traffic for that request is allowed to flow in regardless of inbound network ACL rules. Similarly, if inbound traffic is allowed, responses to allowed inbound traffic are allowed to flow out, regardless of outbound rules. The timeout period of connection tracking varies according to the protocol. The timeout period of a TCP connection in the established state is 600s, and the timeout period of an ICMP connection is 30s. For other protocols, if packets are received in both directions, the connection tracking timeout period is 180s. If one or more packets are received in one direction but no packet is received in the other direction, the connection tracking timeout period is 30s. For protocols other than TCP, UDP, and ICMP, only the IP address and protocol number are tracked.

Default Network ACL Rules

By default, each network ACL has preset rules that allow the following packets:

● Packets whose source and destination are in the same subnet ● Broadcast packets with the destination 255.255.255.255/32, which is used to configure host startup information. ● Multicast packets with the destination 224.0.0.0/24, which is used by routing protocols. ● Metadata packets with the destination 169.254.169.254/32 and TCP port number 80, which is used to obtain metadata. ● Packets from CIDR blocks that are reserved for public services (for example, packets with the destination 100.125.0.0/16) ● A network ACL denies all traffic in and out of a subnet excepting the preceding ones. Table 2-8 shows the default network ACL rules. You cannot modify or delete the default rules.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 51 Virtual Private Cloud User Guide 2 Security

Table 2-8 Default network ACL rules Direction Priorit Actio Protoco Sourc Destinatio Description y n l e n

Inbound * Deny All 0.0.0.0 0.0.0.0/0 Denies all /0 inbound traffic.

Outboun * Deny All 0.0.0.0 0.0.0.0/0 Denies all d /0 outbound traffic.

Rule Priorities ● Each network ACL rule has a priority value where a smaller value corresponds to a higher priority. Any time two rules conflict, the rule with the higher priority is the one that gets applied. The rule whose priority value is an asterisk (*) has the lowest priority. ● If multiple network ACL rules conflict, only the rule with the highest priority takes effect. If you need a rule to take effect before or after a specific rule, you can insert that rule before or after the specific rule.

Application Scenarios ● If the application layer needs to provide services for users, traffic must be allowed to reach the application layer from all IP addresses. However, you also need to prevent illegal access from malicious users. Solution: You can add network ACL rules to deny access from suspect IP addresses. ● How can I isolate ports with identified vulnerabilities? For example, how do I isolate port 445 that can be exploited by WannaCry worm? Solution: You can add network ACL rules to deny access traffic from a specific port and protocol, for example, TCP port 445. ● No defense is required for the communication within a subnet, but access control is required for communication between subnets. Solution: You can add network ACL rules to control traffic between subnets. ● For frequently accessed applications, a security rule sequence may need to be adjusted to improve performance. Solution: A network ACL allows you to adjust the rule sequence so that frequently used rules are applied before other rules.

Configuration Procedure Figure 2-13 shows the procedure for configuring a network ACL.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 52 Virtual Private Cloud User Guide 2 Security

Figure 2-13 Network ACL configuration procedure

1. Create a network ACL by following the steps described in Creating a Network ACL. 2. Add network ACL rules by following the steps described in Adding a Network ACL Rule. 3. Associate subnets with the network ACL by following the steps described in Associating Subnets with a Network ACL. After subnets are associated with the network ACL, the subnets will be protected by the configured network ACL rules.

Constraints ● By default, you can create a maximum of 200 network ACLs in your cloud account. ● You can associate a network ACL with multiple subnets. However, a subnet can only be associated with one network ACL at a time. ● It is recommended that a network ACL contain no more than 20 rules in one direction. Otherwise, its performance may deteriorate. ● For optimal performance, import no more than 40 network ACL rules at a time. Existing rules will still be available after new rules are imported. Each rule can be imported only once. 2.2.2 Network ACL Configuration Examples

This section provides examples for configuring network ACLs.

● Denying Access from a Specific Port ● Allowing Access from Specific Ports and Protocols ● Denying Access from a Specific IP Address

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 53 Virtual Private Cloud User Guide 2 Security

Denying Access from a Specific Port You might want to block TCP 445 to protect against the WannaCry ransomware attacks. You can add a network ACL rule to deny all incoming traffic from TCP port 445. Network ACL Configuration Table 2-9 lists the inbound rule required.

Table 2-9 Network ACL rules Dire Ac Prot Sour Source Destination Destina Description ctio ti ocol ce Port tion n on Range Port Range

Inbo D TCP 0.0.0. 1-6553 0.0.0.0/0 445 Denies inbound und en 0/0 5 traffic from any y IP address through TCP port 445.

Inbo All All 0.0.0. 1-6553 0.0.0.0/0 All Allows all und o 0/0 5 inbound traffic. w

NO TE

● By default, a network ACL denies all inbound traffic. You need to allow all inbound traffic if necessary. ● If you want a deny rule to be matched first, insert the deny rule above the allow rule. For details, see Changing the Sequence of a Network ACL Rule.

Allowing Access from Specific Ports and Protocols In this example, an ECS in a subnet is used as the web server, and you need to allow inbound traffic from HTTP port 80 and HTTPS port 443 and allow all outbound traffic regardless of the port. You need to configure both the network ACL rules and security group rules to allow the traffic. Network ACL Configuration Table 2-10 lists the inbound rule required.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 54 Virtual Private Cloud User Guide 2 Security

Table 2-10 Network ACL rules Dire Acti Protoc Sourc Source Desti Destina Description ctio on ol e Port natio tion n Range n Port Range

Inbo Allo TCP 0.0.0.0 1-65535 0.0.0. 80 Allows inbound und w /0 0/0 HTTP traffic from any IP address to ECSs in the subnet through port 80.

Inbo Allo TCP 0.0.0.0 1-65535 0.0.0. 443 Allows inbound und w /0 0/0 HTTPS traffic from any IP address to ECSs in the subnet through port 443.

Outb Allo All 0.0.0.0 All 0.0.0. All Allows all ound w /0 0/0 outbound traffic from the subnet.

Security group configuration Table 2-11 lists the inbound and outbound security group rules required.

Table 2-11 Security group rules Direc Protocol Port Source/ Description tion / Destination Applicati on

Inbou TCP 80 Source: 0.0.0.0/0 Allows inbound HTTP nd traffic from any IP address to ECSs associated with the security group through port 80.

Inbou TCP 443 Source: 0.0.0.0/0 Allows inbound HTTPS nd traffic from any IP address to ECSs associated with the security group through port 443.

Outb All All Destination: Allows all outbound traffic ound 0.0.0.0/0 from the security group.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 55 Virtual Private Cloud User Guide 2 Security

A network ACL adds an additional layer of security. Even if the security group rules allow more traffic than that actually required, the network ACL rules allow only access from HTTP port 80 and HTTPS port 443 and deny other inbound traffic.

Denying Access from a Specific IP Address In this example, you can add a network ACL rule to deny the access from some abnormal IP addresses, for example, 192.168.1.102.

Network ACL Configuration

Table 2-12 lists the inbound rules required.

Table 2-12 Network ACL rules

Dir A Pr Source Source Destina Destin Description ect ct ot Port tion ation ion io oc Range Port n ol Range

Inb D TC 192.168 1-65535 0.0.0.0/ All Denies access from ou en P . 0 192.168.1.102. nd y 1.102/3 2

Inb Al All 0.0.0.0/ 1-65535 0.0.0.0/ All Allows all inbound ou lo 0 0 traffic. nd w

NO TE

● By default, a network ACL denies all inbound traffic. You need to allow all inbound traffic if necessary. ● If you want a deny rule to be matched first, insert the deny rule above the allow rule. For details, see Changing the Sequence of a Network ACL Rule. 2.2.3 Creating a Network ACL

Scenarios You can create a custom network ACL, but any newly created network ACL will be disabled by default. It will not have any inbound or outbound rules, or have any subnets associated. Each user can create up to 200 network ACLs by default.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Network ACLs.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 56 Virtual Private Cloud User Guide 2 Security

5. In the right pane displayed, click Create Network ACL. 6. In the displayed dialog box, enter network ACL information as prompted. Table 2-13 lists the parameters to be configured.

Figure 2-14 Create Network ACL

Table 2-13 Parameter descriptions

Parameter Description Example Value

Name The network ACL name. This parameter fw-92d3 is mandatory. The name contains a maximum of 64 characters, which may consist of letters, digits, underscores (_), and hyphens (-). The name cannot contain spaces.

Description Supplementary information about the N/A network ACL. This parameter is optional. The description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).

7. Click OK. 2.2.4 Adding a Network ACL Rule

Scenarios Add an inbound or outbound rule based on your network security requirements. It is recommended that a network ACL contain no more than 20 rules in one direction. Otherwise, its performance may deteriorate.

Procedure 1. Log in to the management console.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 57 Virtual Private Cloud User Guide 2 Security

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Network ACLs. 5. Locate the target network ACL and click its name to switch to the page showing details of that particular network ACL. 6. On the Inbound Rules or Outbound Rules tab, click Add Rule to add an inbound or outbound rule. You can click + to add more rules.

Table 2-14 Parameter descriptions Parameter Description Example Value

Type This parameter is available only after the IPv4 IPv6 function is enabled. The network ACL type. This parameter is mandatory. You can select a value from the drop-down list. Currently, only IPv4 and IPv6 are supported.

Action The action in the network ACL. This Allow parameter is mandatory. You can select a value from the drop-down list. Currently, the value can be Allow or Deny.

Protocol The protocol supported by the network TCP ACL. This parameter is mandatory. You can select a value from the drop-down list. The value can be TCP, UDP, All, or ICMP. If ICMP or All is selected, you do not need to specify port information.

Source The source from which the traffic is 0.0.0.0/0 allowed. The source can be an IP address or IP address range. The default value is 0.0.0.0/0, which indicates that traffic from all IP addresses is allowed. For example: ● Single IP address: 192.168.10.10/32 (IPv4); 2002:50::44/127 (IPv6) ● IP address range: 192.168.1.0/24 (IPv4); 2407:c080:802:469::/64 (IPv6) ● All IP addresses: 0.0.0.0/0 (IPv4); ::/0 (IPv6)

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 58 Virtual Private Cloud User Guide 2 Security

Parameter Description Example Value

Source Port The source port number or port number 22, or 22-30 Range range. The value ranges from 1 to 65535. For a port number range, enter two port numbers connected by a hyphen (-). For example, 1-100. You must specify this parameter if TCP or UDP is selected for Protocol.

Destination The destination to which the traffic is 0.0.0.0/0 allowed. The destination can be an IP address or IP address range. The default value is 0.0.0.0/0, which indicates that traffic to all IP addresses is allowed. For example: ● Single IP address: 192.168.10.10/32 (IPv4); 2002:50::44/127 (IPv6) ● IP address range: 192.168.1.0/24 (IPv4); 2407:c080:802:469::/64 (IPv6) ● All IP addresses: 0.0.0.0/0 (IPv4); ::/0 (IPv6)

Destination The destination port number or port 22, or 22-30 Port Range number range. The value ranges from 1 to 65535. For a port number range, enter two port numbers connected by a hyphen (-). For example, 1-100. You must specify this parameter if TCP or UDP is selected for Protocol.

Description Supplementary information about the N/A network ACL rule. This parameter is optional. The description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).

7. Click OK. 2.2.5 Associating Subnets with a Network ACL

Scenarios

On the page showing network ACL details, associate desired subnets with a network ACL. After a network ACL is associated with a subnet, the network ACL denies all traffic to and from the subnet until you add rules to allow traffic.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 59 Virtual Private Cloud User Guide 2 Security

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Network ACLs. 5. Locate the target network ACL and click its name to switch to the page showing details of that particular network ACL. 6. On the displayed page, click the Associated Subnets tab. 7. On the Associated Subnets page, click Associate.

Figure 2-15 Associate Subnet

8. On the displayed page, select the subnets to be associated with the network ACL, and click OK.

NO TE

Subnets that have already been associated with network ACLs will not be displayed on the page for you to select. One-click subnet association and disassociation are not currently supported. Furthermore, a subnet can only be associated with one network ACL. If you want to reassociate a subnet that has already been associated with another network ACL, you must first disassociate the subnet from the original network ACL. 2.2.6 Disassociating a Subnet from a Network ACL

Scenarios

Disassociate a subnet from a network ACL when necessary.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 60 Virtual Private Cloud User Guide 2 Security

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Network ACLs. 5. Locate the target network ACL and click its name to switch to the page showing details of that particular network ACL. 6. On the displayed page, click the Associated Subnets tab. 7. On the Associated Subnets page, locate the row that contains the target subnet and click Disassociate in the Operation column. 8. Click Yes in the displayed dialog box.

Disassociating subnets from a network ACL

Select multiple subnets and click Disassociate above the subnet list to disassociate the subnets from the current network ACL at a time. 2.2.7 Changing the Sequence of a Network ACL Rule

Scenarios

If you need a rule to take effect before or after a specific rule, you can insert that rule before or after the specific rule.

If multiple network ACL rules conflict, only the rule with the highest priority takes effect.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Network ACLs. 5. Locate the target network ACL and click its name to switch to the page showing details of that particular network ACL. 6. On the Inbound Rules or Outbound Rules tab, locate the target rule, click More in the Operation column, and select Insert Rule Above or Insert Rule Below.

Figure 2-16 Inserting a rule

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 61 Virtual Private Cloud User Guide 2 Security

7. In the displayed dialog box, configure required parameters and click OK. The rule is inserted. The procedure for inserting an outbound rule is the same as that for inserting an inbound rule. 2.2.8 Modifying a Network ACL Rule

Scenarios Modify an inbound or outbound network ACL rule based on your network security requirements.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Network ACLs. 5. Locate the target network ACL and click its name to switch to the page showing details of that particular network ACL. 6. On the Inbound Rules or Outbound Rules tab, locate the row that contains the target rule and click Modify in the Operation column. In the displayed dialog box, configure parameters as prompted. Table 2-15 lists the parameters to be configured.

Table 2-15 Parameter descriptions Parameter Description Example Value

Type This parameter is available only after the IPv4 IPv6 function is enabled. The network ACL type. This parameter is mandatory. You can select a value from the drop-down list. Currently, only IPv4 and IPv6 are supported.

Action The action in the network ACL. This Allow parameter is mandatory. You can select a value from the drop-down list. Currently, the value can be Allow or Deny.

Protocol The protocol supported by the network TCP ACL. This parameter is mandatory. You can select a value from the drop-down list. The value can be TCP, UDP, All, or ICMP. If ICMP or All is selected, you do not need to specify port information.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 62 Virtual Private Cloud User Guide 2 Security

Parameter Description Example Value

Source The source from which the traffic is 0.0.0.0/0 allowed. The source can be an IP address or IP address range. The default value is 0.0.0.0/0, which indicates that traffic from all IP addresses is allowed. For example: ● Single IP address: 192.168.10.10/32 (IPv4); 2002:50::44/127 (IPv6) ● IP address range: 192.168.1.0/24 (IPv4); 2407:c080:802:469::/64 (IPv6) ● All IP addresses: 0.0.0.0/0 (IPv4); ::/0 (IPv6)

Source Port The source port number or port number 22, or 22-30 Range range. The value ranges from 1 to 65535. For a port number range, enter two port numbers connected by a hyphen (-). For example, 1-100. You must specify this parameter if TCP or UDP is selected for Protocol.

Destination The destination to which the traffic is 0.0.0.0/0 allowed. The destination can be an IP address or IP address range. The default value is 0.0.0.0/0, which indicates that traffic to all IP addresses is allowed. For example: ● Single IP address: 192.168.10.10/32 (IPv4); 2002:50::44/127 (IPv6) ● IP address range: 192.168.1.0/24 (IPv4); 2407:c080:802:469::/64 (IPv6) ● All IP addresses: 0.0.0.0/0 (IPv4); ::/0 (IPv6)

Destination The destination port number or port 22, or 22-30 Port Range number range. The value ranges from 1 to 65535. For a port number range, enter two port numbers connected by a hyphen (-). For example, 1-100. You must specify this parameter if TCP or UDP is selected for Protocol.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 63 Virtual Private Cloud User Guide 2 Security

Parameter Description Example Value

Description Supplementary information about the N/A network ACL rule. This parameter is optional. The description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).

7. Click Confirm. 2.2.9 Enabling or Disabling a Network ACL Rule

Scenarios Enable or disable an inbound or outbound rule based on your network security requirements.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Network ACLs. 5. Locate the target network ACL and click its name to switch to the page showing details of that particular network ACL. 6. On the Inbound Rules or Outbound Rules tab, locate the row that contains the target rule, and click Enable or Disable in the Operation column. 7. Click Yes in the displayed dialog box. The rule is enabled or disabled. The procedure for enabling or disabling an outbound rule is the same as that for enabling or disabling an inbound rule. 2.2.10 Deleting a Network ACL Rule

Scenarios Delete an inbound or outbound rule based on your network security requirements.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Network ACLs. 5. Locate the target network ACL and click its name to switch to the page showing details of that particular network ACL.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 64 Virtual Private Cloud User Guide 2 Security

6. On the Inbound Rules or Outbound Rules tab, locate the row that contains the target rule and click Delete in the Operation column. 7. Click Yes in the displayed dialog box.

Deleting multiple network ACL rules at a time

You can also select multiple network ACL rules and click Delete above the network ACL rule list to delete multiple rules at a time. 2.2.11 Exporting and Importing Network ACL Rules

Scenarios

You can export inbound and outbound rules of a specific network ACL as an Excel file then import these rules for another network ACL. Importing and exporting rules across regions are supported.

It is recommended that you import no more than 40 rules each time. Importing rules will not delete existing rules. Duplicate rules are not allowed.

Exporting Network ACL Rules 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Network ACLs. 5. Locate the target network ACL and click its name to switch to the page showing details of that particular network ACL.

6. Click to export the inbound and outbound network ACL rules. The exported rules are stored in an Excel file. You need to download the file to a local directory.

Importing Network ACL Rules 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Network ACLs. 5. Locate the target network ACL and click its name to switch to the page showing details of that particular network ACL.

6. Click . 7. Select the Excel file containing the exported network ACL rules and click Import to import the rules.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 65 Virtual Private Cloud User Guide 2 Security

2.2.12 Viewing a Network ACL

Scenarios View details about a network ACL.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Network ACLs. 5. Locate the target network ACL and click its name to switch to the page showing details of that particular network ACL. 6. On the displayed page, click the Inbound Rules, Outbound Rules, and Associated Subnets tabs one by one to view details about inbound rules, outbound rules, and subnet associations. 2.2.13 Modifying a Network ACL

Scenarios Modify the name and description of a network ACL.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Network ACLs. 5. Locate the target network ACL and click its name to switch to the page showing details of that particular network ACL. 6. On the displayed page, click on the right of Name and edit the network ACL name. 7. Click √ to save the new network ACL name. 8. Click on the right of Description and edit the network ACL description. 9. Click √ to save the new network ACL description. 2.2.14 Enabling or Disabling a Network ACL

Scenarios After a network ACL is created, you may need to enable it based on network security requirements. You can also disable an enabled network ACL if need. Before enabling a network ACL, ensure that subnets have been associated with the network ACL and that inbound and outbound rules have been added to the network ACL.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 66 Virtual Private Cloud User Guide 2 Security

When a network ACL is disabled, custom rules will become invalid. Disabling a network ACL may interrupt network traffic. For information about the default network ACL rules, see Default Network ACL Rules.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Network ACLs. 5. Locate the row that contains the target network ACL in the right pane, click More in the Operation column, and click Enable or Disable. 6. Click Yes in the displayed dialog box. 2.2.15 Deleting a Network ACL

Scenarios

Delete a network ACL when it is no longer required.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > Network ACLs. 5. Locate the target network ACL in the right pane, click More in the Operation column, and click Delete. 6. Click Yes.

NO TE

After a network ACL is deleted, associated subnets are disassociated and added rules are deleted from the network ACL.

2.3 Differences Between Security Groups and Network ACLs

You can configure security groups and network ACL to increase the security of ECSs in your VPC.

● Security groups operate at the ECS level. ● Network ACLs operate at the subnet level.

For details, see Figure 2-17.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 67 Virtual Private Cloud User Guide 2 Security

Figure 2-17 Security groups and network ACLs

Table 2-16 describes the differences between security groups and network ACLs.

Table 2-16 Differences between security groups and network ACLs Category Security Group Network ACL

Targets Operates at the ECS level. Operates at the subnet level.

Rules Only supports Allow rules. Supports Allow and Deny rules.

Priority If security group rules conflict, If rules conflict, the rule with the the overlapping elements of highest priority takes effect. these rules take effect.

Usage Automatically applies to ECSs Applies to all ECSs in the subnets in the security group that is associated with the network ACL. selected during ECS creation. Selecting a network ACL is not You must select a security allowed during subnet creation. group when creating ECSs. You must create a network ACL, associate subnets with it, add inbound and outbound rules, and enable network ACL. The network ACL then takes effect for the associated subnets and ECSs in the subnets.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 68 Virtual Private Cloud User Guide 2 Security

Category Security Group Network ACL

Packets Only packet filtering based on Only packet filtering based on the the 3-tuple (protocol, port, 5-tuple (protocol, source port, and peer IP address) is destination port, source IP address, supported. and destination IP address) is supported.

2.4 IP Address Group

2.4.1 IP Address Group Overview An IP address group is a collection of IP addresses that use the same security group rule. You can use an IP address group to manage IP addresses that have the same security requirements or whose security requirements change frequently. An IP address group frees you from repeatedly modifying security group rules and simplifies rule management. You need to create an IP address group and add IP addresses to the group. Then, you can select this IP address group when adding a security group rule. The rule you add will then apply to all IP addresses in the IP address group.

NO TE

IP address groups are currently available in regions CN North-Beijing4, CN South- Guangzhou, and CN South-Guiyang1. 2.4.2 Creating an IP Address Group

Scenarios Create an IP address group and add IP addresses that need to be centrally managed to this group.

NO TE

IP address groups are currently available in regions CN North-Beijing4, CN South- Guangzhou, and CN South-Guiyang1.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > IP Address Groups. 5. Click Create IP Address Group. 6. Configure the required parameters. Table 2-17 lists the IP address group parameters.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 69 Virtual Private Cloud User Guide 2 Security

Table 2-17 Parameter descriptions

Paramet Description Example Value er

Name The IP address group name. This ipGroup-f7de parameter is mandatory. The IP address group name contains a maximum of 64 characters, which may consist of letters, digits, underscores (_), hyphens (-), and periods (.). The name cannot contain spaces. You can customize the name of an IP address group that is uniquely identified by its ID.

IP The IP addresses or IP address ranges 192.168.10.10 Address included in the IP address group. You 192.168.52.0/24 can add a maximum of 20 IP addresses or IP address ranges, and 192.168.1.1 each must be on a separate line. For example: 192.168.10.10 (IP address) 192.168.52.0/24 (IP address range) 192.168.1.1-192.168.1.50 (IP address range)

Descripti Supplementary information about the N/A on IP address group. This parameter is optional. The IP address group description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).

7. Click OK. 2.4.3 Associating an IP Address Group with a Security Group Rule

Scenarios

Select an IP address group when adding a security group rule so that the rule applies to all IP addresses in the IP address group.

NO TE

IP address groups are currently available in regions CN North-Beijing4, CN South- Guangzhou, and CN South-Guiyang1.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 70 Virtual Private Cloud User Guide 2 Security

Procedure

Add a security group rule by referring to Adding a Security Group Rule. Pay attention to the following:

1. Select IP address group from drop-down list for Source. 2. Select the target IP address group.

After the preceding steps, the IP address group can be associated with the security group rule. 2.4.4 Managing an IP Address Group

Scenarios

Modify or delete an IP address group.

NO TE

● IP address groups are currently available in regions CN North-Beijing4, CN South- Guangzhou, and CN South-Guiyang1. ● After an IP address group is modified, the source addresses of its associated security group rules will also change. ● Deleting an IP address group will also delete the security group rules associated with the IP address group.

Modifying an IP Address Group 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > IP Address Groups. 5. On the displayed page, click Modify in the Operation column to modify the name, IP address, and description of the IP address group.

Deleting an IP Address Group 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Access Control > IP Address Groups. 5. On the IP Address Groups page, locate the target IP address group and click Delete in the Operation column. In the displayed dialog box, click Yes. Deleting an IP address group will also delete the security group rules associated with the IP address group.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 71 Virtual Private Cloud User Guide 3 EIP

3 EIP

3.1 EIP Overview

EIP

The Elastic IP (EIP) service enables you to use static public IP addresses and scalable bandwidths to connect your cloud resources to the Internet. EIPs can be bound to or unbound from ECSs, BMSs, virtual IP addresses, NAT gateways, or load balancers. Various billing modes are provided to meet diverse service requirements.

Each EIP can be used by only one cloud resource at a time.

Figure 3-1 Accessing the Internet using an EIP

Advantages ● Flexibility

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 72 Virtual Private Cloud User Guide 3 EIP

An EIP can be flexibly associated with or disassociated from the ECS, BMS, NAT gateway, load balancer, or virtual IP address. The bandwidth can be adjusted according to service changes. ● Flexible billing Pay-per-use (based on bandwidth usage or amount of traffic) and yearly/ monthly billing modes are available. ● Shared bandwidth EIPs can use shared bandwidth to lower bandwidth costs. ● Immediate use EIP associations, disassociations, and bandwidth adjustments take effect immediately.

NO TE

For details about how to submit a service ticket, see Submitting a Service Ticket.

3.2 Assigning an EIP and Binding It to an ECS

Scenarios You can assign an EIP and bind it to an ECS so that the ECS can access the Internet.

Assigning an EIP 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Elastic IP. 4. On the displayed page, click Buy EIP. 5. Set the parameters as prompted.

Table 3-1 Parameter descriptions Parameter Description Example Value

Billing Mode The following billing modes are Pay-per-use available: ● Yearly/Monthly ● Pay-per-use

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 73 Virtual Private Cloud User Guide 3 EIP

Parameter Description Example Value

Region Regions are geographic areas CN-Hong Kong that are physically isolated from each other. The networks inside different regions are not connected to each other, so resources cannot be shared across different regions. For lower network latency and faster access to your resources, select the region nearest you.

EIP Type ● Dynamic BGP: Dynamic BGP Dynamic BGP provides automatic failover and chooses the optimal path when a network connection fails. ● Static BGP: Static BGP offers more routing control and protects against route flapping, but an optimal path cannot be selected in real time when a network connection fails. For details, see What Are the Differences Between Static BGP and Dynamic BGP?

Billed By This parameter is available only Bandwidth when you set Billing Mode to Pay-per-use. ● Bandwidth: You specify a maximum bandwidth and pay for the amount of time you use the bandwidth. This is suitable for scenarios with heavy or stable traffic. ● Traffic: You specify a maximum bandwidth and pay for the total traffic you use. This is suitable for scenarios with light or sharply fluctuating traffic. ● Shared Bandwidth: The bandwidth can be shared by multiple EIPs. This is suitable for scenarios with staggered traffic.

Bandwidth The bandwidth size in Mbit/s. 100

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 74 Virtual Private Cloud User Guide 3 EIP

Parameter Description Example Value

Bandwidth Name The name of the bandwidth. bandwidth

Required Duration The duration for which the 1 month purchased EIP will use. The duration must be specified if the Billing Mode is set to Yearly/Monthly.

Quantity The number of EIPs you want to 1 purchase. The quantity must be specified if the Billing Mode is set to Pay-per-use.

Tag The EIP tags. Each tag contains ● Key: a key and value pair. Ipv4_key1 The tag key and value must ● Value: meet the requirements listed in 192.168.12.10 Table 3-2.

Enterprise Project The enterprise project to which default the EIP belongs. An enterprise project facilitates project-level management and grouping of cloud resources and users. The name of the default project is default.

Table 3-2 EIP tag requirements Parameter Requirement Example Value

Key ● Cannot be left blank. Ipv4_key1 ● Must be unique for each EIP. ● Can contain a maximum of 36 characters. ● Can contain letters, digits, underscores (_), and hyphens (-).

Value ● Can contain a maximum of 43 192.168.12.10 characters. ● Can contain letters, digits, underscores (_), periods (.), and hyphens (-).

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 75 Virtual Private Cloud User Guide 3 EIP

NO TE

● If you are buying an EIP billed on a pay-per-use basis and you want to use a shared bandwidth, you can only select an existing shared bandwidth from the Bandwidth Name drop-down list. If there are no shared bandwidths to select, purchase a shared bandwidth first. ● A dedicated bandwidth cannot be changed to a shared bandwidth and vice versa. However, you can purchase shared bandwidth for pay-per-use EIPs. ● After an EIP is added to a shared bandwidth, the EIP will use the shared bandwidth. ● After an EIP is removed from the shared bandwidth, the EIP will use the dedicated bandwidth. 6. Click Next. 7. Click Submit.

Binding an EIP 1. On the EIPs page, locate the row that contains the target EIP, and click Bind. 2. Select the instance to which you want to bind the EIP. 3. Click OK.

Helpful Links ● How Do I Assign or Retrieve a Specific EIP? ● How Do I Access an ECS from the Internet After an EIP Is Bound to the ECS? ● Can I Bind an EIP to an ECS, to Another ECS? ● Will the EIP Bound to an ECS Be Changed After the ECS Is Stopped and Then Started? ● How Do I Check Whether the Bandwidth Exceeds the Limit? ● Why Does Internet Access Fail Even If My ECS Is Bound with an EIP?

3.3 Unbinding an EIP from an ECS and Releasing the EIP

Scenarios

If you no longer need an EIP, unbind it from the ECS and release the EIP to avoid wasting network resources.

Notes and Constraints ● You can only release unbound EIPs. ● You cannot buy an EIP that has been released if it is currently in use by another user. ● The price of a pay-per-use EIP includes the retention fee and the bandwidth price. If you unbind an EIP but do not release it, the EIP will continue to be billed and the price includes the retention fee and the bandwidth price. The

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 76 Virtual Private Cloud User Guide 3 EIP

moment you bind an EIP to an instance, the retention fee is no longer included in the EIP price.

Procedure Unbinding a single EIP 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Elastic IP. 4. On the displayed page, locate the row that contains the target EIP, and click Unbind. 5. Click Yes in the displayed dialog box. Releasing a single EIP 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Elastic IP. 4. On the displayed page, locate the row that contains the target EIP, click More and then Release in the Operation column. 5. Click Yes in the displayed dialog box. Unbinding multiple EIPs at once 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Elastic IP. 4. On the displayed page, select the EIPs to be unbound. 5. Click the Unbind button located above the EIP list. 6. Click Yes in the displayed dialog box. Releasing multiple EIPs at once 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Elastic IP. 4. On the displayed page, select the EIPs to be released. 5. Click the Release button located above the EIP list. 6. Click Yes in the displayed dialog box.

3.4 Managing EIP Tags

Scenarios Tags can be added to EIPs to facilitate EIP identification and administration. You can add a tag to an EIP when assigning the EIP. Alternatively, you can add a tag to

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 77 Virtual Private Cloud User Guide 3 EIP

an assigned EIP on the EIP details page. A maximum of 10 tags can be added to each EIP.

A tag consists of a key and value pair. Table 3-3 lists the tag key and value requirements.

Table 3-3 EIP tag requirements

Parameter Requirement Example Value

Key ● Cannot be left blank. Ipv4_key1 ● Must be unique for each EIP. ● Can contain a maximum of 36 characters. ● Can contain letters, digits, underscores (_), and hyphens (-).

Value ● Can contain a maximum of 43 192.168.12.10 characters. ● Can contain letters, digits, underscores (_), periods (.), and hyphens (-).

Procedure

Searching for EIPs by tag key and value on the page showing the EIP list 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Elastic IP. 4. In the upper right corner of the EIP list, click Search by Tag. 5. In the displayed area, enter the tag key and value of the EIP you are looking for. You must specify both the tag key and value. The system will display the EIPs that contain the tag you specified. 6. Click + to add another tag key and value. You can add multiple tag keys and values to refine your search results. If you add more than one tag to search for EIPs, the system will display only the EIPs that contain all of the tags you specified. 7. Click Search. The system displays the EIPs you are looking for based on the entered tag keys and values.

Adding, deleting, editing, and viewing tags on the Tags tab of an EIP 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Elastic IP.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 78 Virtual Private Cloud User Guide 3 EIP

4. On the displayed page, locate the EIP whose tags you want to manage, and click the EIP name. 5. On the page showing EIP details, click the Tags tab and perform desired operations on tags. – View tags. On the Tags tab, you can view details about tags added to the current EIP, including the number of tags and the key and value of each tag. – Add a tag. Click Add Tag in the upper left corner. In the displayed Add Tag dialog box, enter the tag key and value, and click OK. – Edit a tag. Locate the row that contains the tag you want to edit, and click Edit in the Operation column. Enter the new tag key and value, and click OK. – Delete a tag. Locate the row that contains the tag you want to delete, and click Delete in the Operation column. In the displayed dialog box, click Yes.

3.5 Modifying an EIP Bandwidth

Scenarios For a pay-per-use EIP, you can change the bandwidth name, size, and whether it is billed by bandwidth or traffic. For a yearly/monthly EIP, you can change the bandwidth name and size.

Impact on Fees

Table 3-4 Impact on fees Current Change Impact on Fees Billing Scenario Mode

Pay-per- Change to be The change will take effect immediately. use billed by traffic or billed by bandwidth.

Yearly/ Increase the The increased bandwidth size will take effect Monthly bandwidth. immediately and the price difference will be billed accordingly.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 79 Virtual Private Cloud User Guide 3 EIP

Current Change Impact on Fees Billing Scenario Mode

Decrease the The decreased bandwidth size will take effect in the bandwidth. first billing cycle after a successful renewal. ● Renewals cannot be canceled after the payment has been made. ● After a successful renewal in case of a decreased bandwidth size, the bandwidth cannot be modified again within the first billing cycle.

Pay-per- Change the You can change the billing mode from pay-per-use use billing mode to yearly/monthly on the EIP console or in the billing from pay- center. After the change is successful, the new billing per-use to mode will take effect immediately. For details, see yearly/ How Do I Change the Billing Mode? monthly.

Yearly/ Change the You can change the billing mode from yearly/ Monthly billing mode monthly to pay-per-use in the billing center. The new from yearly/ billing mode takes effect only when the yearly/ monthly to monthly mode expires. For details, see How Do I pay-per-use. Change the Billing Mode?

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Elastic IP. 4. Locate the row that contains the target EIP in the EIP list, click More in the Operation column, and select Modify Bandwidth. 5. Modify the bandwidth parameters as prompted.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 80 Virtual Private Cloud User Guide 3 EIP

Figure 3-2 Modifying pay-per-use bandwidth

Figure 3-3 Modifying monthly/yearly bandwidth

6. Click Next. 7. Click Submit.

Helpful Links ● How Do I Change the Bandwidth Billing Option from Bandwidth to Traffic or from Traffic to Bandwidth? ● What Are Inbound Bandwidth and Outbound Bandwidth? ● Can I Increase My Yearly/Monthly Bandwidth Size and Then Decrease It?

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 81 Virtual Private Cloud User Guide 3 EIP

3.6 Exporting EIP Information

Scenarios The information of all EIPs under your account can be exported in an Excel file to a local directory. The file records the ID, status, type, bandwidth name, and bandwidth size of EIPs.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Elastic IP.

4. On the displayed page, click in the upper right corner of the EIP list. The system will automatically export all EIPs in the current region of your account to an Excel file and download the file to a local directory.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 82 Virtual Private Cloud User Guide 4 Shared Bandwidth

4 Shared Bandwidth

4.1 Shared Bandwidth Overview Shared bandwidth allows multiple EIPs to share the same bandwidth. All ECSs, BMSs, and load balancers that have EIPs bound in the same region can share a bandwidth. When you host a large number of applications on the cloud, if each EIP uses an independent bandwidth, a lot of bandwidths are required, which significantly increases bandwidth costs. If all EIPs share the same bandwidth, you can lower bandwidth cost and easily perform system O&M. ● Lowered Bandwidth Costs Region-level bandwidth sharing and multiplexing reduce bandwidth usage and O&M costs. ● Flexible Operations You can add EIPs that are billed on a pay-per-use basis to a shared bandwidth or remove them from a shared bandwidth regardless of the instances to which they are bound. ● Flexible Billing Modes The yearly/monthly and pay-per-use billing modes are provided. You can use a shared bandwidth in either of the following ways: ● Assign a shared bandwidth and add your pay-per-use EIPs to the bandwidth. – Buying a Shared Bandwidth – Adding EIPs to a Shared Bandwidth ● Assign a shared bandwidth, set Billed By to Shared Bandwidth and select the shared bandwidth when you assign EIPs. – Buying a Shared Bandwidth – Assigning an EIP and Binding It to an ECS

Notes and Constraints ● The minimum size of a shared bandwidth that can be purchased is 5 Mbit/s. You can only add pay-per-use EIPs to a shared bandwidth.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 83 Virtual Private Cloud User Guide 4 Shared Bandwidth

● Each account can have a maximum of 5 shared bandwidths. If you need more shared bandwidths, submit a service ticket to request a quota increase. ● If a yearly/monthly shared bandwidth is deleted upon expiration, EIPs sharing the bandwidth will be removed from the bandwidth and be billed based on the mode before they are added to the shared bandwidth.

NO TE

● A dedicated bandwidth cannot be changed to a shared bandwidth and vice versa. However, you can purchase a shared bandwidth for pay-per-use EIPs. ● Add an EIP to a shared bandwidth and then the EIP will use the shared bandwidth. ● Remove the EIP from the shared bandwidth and then the EIP will use the dedicated bandwidth. ● For details about how to submit a service ticket, see Submitting a Service Ticket.

4.2 Buying a Shared Bandwidth

Scenarios When you host a large number of applications on the cloud, if each EIP uses dedicated bandwidth, a lot of bandwidths are required, which incurs high costs. If all EIPs share the same bandwidth, your network operation costs will be lowered and your system O&M as well as resource statistics will be simplified. Buy a shared bandwidth for use with EIPs.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Elastic IP. 4. In the navigation pane on the left, choose Elastic IP and Bandwidth > Shared Bandwidths. 5. In the upper right corner, click Buy Shared Bandwidth. On the displayed page, configure parameters as prompted.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 84 Virtual Private Cloud User Guide 4 Shared Bandwidth

Table 4-1 Parameter descriptions Parameter Description Example Value

Billing Mode The billing mode of a shared bandwidth. Yearly/Monthly The billing mode can be: ● Yearly/Monthly: You pay for the bandwidth by year or month before using it. No other charges apply during the validity period of the bandwidth. ● Pay-per-use: You pay for the bandwidth based on the amount of time you use the bandwidth.

Region Regions are geographic areas that are CN-Hong Kong physically isolated from each other. The networks inside different regions are not connected to each other, so resources cannot be shared across different regions. For lower network latency and faster access to your resources, select the region nearest you.

Billed By The billing method for the shared Bandwidth bandwidth. The billing can be by bandwidth.

Bandwidth The bandwidth size in Mbit/s. The value 10 ranges from starting with 5 Mbit/s. The maximum bandwidth can be 2000 Mbit/s.

Enterprise The enterprise project to which the EIP default Project belongs. An enterprise project facilitates project- level management and grouping of cloud resources and users. The name of the default project is default.

Bandwidth The name of the shared bandwidth. Bandwidth-001 Name

Required The duration for which the purchased EIP 2 months Duration will use. The duration must be specified if the Billing Mode is set to Yearly/ Monthly.

6. Click Next.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 85 Virtual Private Cloud User Guide 4 Shared Bandwidth

4.3 Adding EIPs to a Shared Bandwidth

Scenarios

Add EIPs to a shared bandwidth and the EIPs can then share that bandwidth. You can add multiple EIPs to a shared bandwidth at the same time.

Notes and Constraints ● Currently, yearly/monthly EIPs cannot be added to a shared bandwidth. ● After an EIP is added to a shared bandwidth, the original bandwidth used by the EIP will become invalid and the EIP will start to use the shared bandwidth. ● The EIP's original dedicated bandwidth will be deleted and will no longer be billed. ● To add a yearly/monthly EIP to a shared bandwidth, you need to first change its billing mode to pay-per-use.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Elastic IP. 4. In the navigation pane on the left, choose Elastic IP and Bandwidth > Shared Bandwidths. 5. In the shared bandwidth list, locate the row that contains the shared bandwidth to which you want to add EIPs. In the Operation column, choose Add EIP, and select the EIPs to be added. 6. Click OK.

Helpful Links

What Are the Differences Between a Dedicated Bandwidth and a Shared Bandwidth? Can a Dedicated Bandwidth Be Changed to a Shared Bandwidth or the Other Way Around?

4.4 Removing EIPs from a Shared Bandwidth

Scenarios

Remove EIPs that are no longer required from a shared bandwidth if needed.

Notes and Constraints

A yearly/monthly EIP cannot be removed from a shared bandwidth purchased during OBT.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 86 Virtual Private Cloud User Guide 4 Shared Bandwidth

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Elastic IP. 4. In the navigation pane on the left, choose Elastic IP and Bandwidth > Shared Bandwidths. 5. In the shared bandwidth list, locate the row that contains the bandwidth from which EIPs are to be removed, choose More > Remove EIP in the Operation column, and select the EIPs to be removed in the displayed dialog box. 6. Set the EIP bandwidth after the EIP is removed. You can configure the EIP billing mode and bandwidth size. 7. Click OK.

4.5 Modifying a Shared Bandwidth

Scenarios

You can modify the name, billing mode, and size of a shared bandwidth, which takes effect immediately.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Elastic IP. 4. In the navigation pane on the left, choose Elastic IP and Bandwidth > Shared Bandwidths. 5. In the shared bandwidth list, locate the row that contains the shared bandwidth you want to modify, click Modify Bandwidth in the Operation column, and modify the bandwidth settings. 6. Click Next. 7. Click Submit.

4.6 Deleting a Shared Bandwidth

Scenarios

Delete a shared bandwidth billed on a pay-per-use basis if it is no longer required.

Notes and Constraints

A yearly/monthly shared bandwidth cannot be directly deleted. It can only be unsubscribed in the User Center.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 87 Virtual Private Cloud User Guide 4 Shared Bandwidth

Prerequisites Before deleting a shared bandwidth, remove all the EIPs associated with it. For details, see Removing EIPs from a Shared Bandwidth.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Elastic IP. 4. In the navigation pane on the left, choose Elastic IP and Bandwidth > Shared Bandwidths. 5. In the shared bandwidth list, locate the row that contains the pay-per-use shared bandwidth you want to delete, click More in the Operation column, and then click Delete. 6. In the displayed dialog box, click Yes.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 88 Virtual Private Cloud User Guide 5 Shared Data Package

5 Shared Data Package

5.1 Shared Data Package Overview Shared data package provides a quota for data usage. Such packages are cost- effective and easy to use. Shared data packages take effect immediately after your purchase. If you have subscribed to pay-per-use EIPs using bandwidth billed by traffic in a region and buy a shared data package in the same region, the EIPs will use the shared data package. After the package quota is used up or the package expires, the EIPs will continue to be billed on a pay-per-use basis.

● Two types of packages are available: dynamic BGP and static BGP. Dynamic BGP data packages will be used by dynamic BGP EIPs, and static BGP data packages will be used by static BGP EIPs. ● Shared data packages can be purchased yearly or monthly. Packages purchased for a year are more cost effective. You can purchase multiple shared data packages. The data package with the shortest validity period will be used first.

Notes and Constraints ● A shared data package cannot be unsubscribed. ● By default, a shared data package takes effect for all pay-per-use EIPs billed by traffic. A shared data package cannot take effect for specific EIPs or for shared bandwidths.

5.2 Buying a Shared Data Package

Scenarios Buy a shared data package for pay-per-use EIPs billed by traffic. Shared data packages take effect immediately after your purchase. If you have subscribed to pay-per-use EIPs billed by traffic in a region and buy a shared data package in the same region, the EIPs will use the shared data package. After the package quota is used up or the package expires, the EIPs will continue to be billed on a pay-per- use basis.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 89 Virtual Private Cloud User Guide 5 Shared Data Package

Shared data packages cannot be unsubscribed and cannot be used for shared bandwidths. They cover the data usage of all pay-per-use EIPs billed by traffic in the same region. You cannot specify the EIPs you want to have covered by a shared data package.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Elastic IP. 4. In the navigation pane on the left, choose Elastic IP and Bandwidth > Shared Data Packages. 5. In the upper right corner, click Buy Shared Data Package. On the displayed page, configure parameters as prompted.

Table 5-1 Parameter descriptions

Parameter Description Example Value

Region Regions are geographic areas that are CN-Hong Kong physically isolated from each other. The networks inside different regions are not connected to each other, so resources cannot be shared across different regions. For lower network latency and faster access to your resources, select the region nearest you.

Type The shared data package type. Set this Static BGP parameter based on the bandwidth type of the EIP. The following two types of packages are available: ● Dynamic BGP: A dynamic BGP data package can only be used by dynamic BGP EIPs billed by traffic on a pay- per-use basis. ● Static BGP: A static BGP data package can only be used by static BGP EIPs billed by traffic on a pay-per-use basis.

Package The validity period of the shared data 1 month Validity package. Select a validity period based on service requirements. A shared data package cannot be unsubscribed and takes effect immediately after you purchase it. Expired shared data packages will longer be available for use.

Specification The size of the shared data package in 10 GB GB.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 90 Virtual Private Cloud User Guide 5 Shared Data Package

Parameter Description Example Value

Usage The validity period of the shared data Default Duration package.

6. Click Next.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 91 Virtual Private Cloud User Guide 6 Route Table

6 Route Table

6.1 Route Table Overview A route table contains a set of rules that are used to determine where network traffic is directed. You can add custom routes to a VPC so that ECSs that have no EIP in the VPC can access the Internet.

Background The way you can access the route table module varies by region. ● If the route table module is not decoupled from the VPC module in your selected region, access the route table module by clicking the Route Tables tab on the VPC details page. ● If the route table module is decoupled from the VPC module in your selected region, access the route table module by clicking Route Tables in the left navigation pane of the VPC console.

Figure 6-1 Entry to the route table module

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 92 Virtual Private Cloud User Guide 6 Route Table

This section applies to the regions where you have to visit the route table module through the VPC details page. Otherwise, refer to Route Table (Module Accessible from the Left Navigation Pane).

6.2 Example Custom Route in a VPC

A custom route in a VPC routes traffic originating from ECSs in a VPC to a specified ECS also in that VPC. A custom route in a VPC can be used in the following scenarios:

● When ECSs in a VPC need to access the Internet, add a custom route to enable the ECSs to access the Internet through the ECS that has an EIP bound. When adding the custom route, set Destination to the default value 0.0.0.0/0 and Next Hop to the private or virtual IP address of the ECS that has an EIP bound in the VPC. ● When ECSs in a VPC need to access the container network, add a route to enable the ECSs to access the container network through an ECS with the container network configured. When adding the custom route, set Destination to default value 0.0.0.0/0 or a network segment on the container network and Next Hop to the private or virtual IP address of the ECS with the container network configured in the VPC.

The destination of each route must be unique.

Accessing the Internet Through a Custom Route

Example scenario

There are two ECSs in a VPC, ECS1 and ECS2. ECS1 has an EIP bound, but ECS2 does not. You can add a custom route to enable ECS2 to access the Internet through ECS1.

Figure 6-2 Accessing the Internet through a custom route

Configuration

1. Table 6-1 lists the example custom route configuration. The destination is default value 0.0.0.0/0, and the next hop is the ECS1 private or virtual IP address bound with an EIP.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 93 Virtual Private Cloud User Guide 6 Route Table

Table 6-1 Custom route

Destinat Next Hop ion

0.0.0.0/0 ECS1 private or virtual IP address

NO TE

● When you use a custom route to access the Internet, the destination can only be set to default value 0.0.0.0/0. It cannot be set to a specific public network segment. ● If the next hop is a virtual IP address, the virtual IP address must have an EIP bound. Otherwise, access to the Internet through this virtual IP address is not possible. 2. Configure ECS1 as an SNAT server by following the instructions provided in Configuring an SNAT Server.

Accessing the Container Network on an ECS Through a Custom Route Example scenario

There are two ECSs in a VPC, ECS1 and ECS2, and a container network has been configured for ECS1. If ECS2 needs to access the container network, you can add a custom route.

Figure 6-3 Accessing the container network on an ECS through a custom route

Configuration

1. When adding the custom route, set Destination to default value 0.0.0.0/0 or a network segment on the container network and Next Hop to the private or virtual IP address of the ECS with the container network configured in the VPC.

Table 6-2 Custom route

Destination Next Hop

0.0.0.0/0 The private or virtual IP address of ECS1

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 94 Virtual Private Cloud User Guide 6 Route Table

2. Configure ECS1 as an SNAT server by following the instructions provided in Configuring an SNAT Server.

6.3 Example Custom Route Outside a VPC A custom route outside a VPC routes traffic originating outside the VPC to specified ECSs in the VPC. When adding this type of route, you can set Destination to the default value 0.0.0.0/0 or a specific network segment. However, the network segment cannot conflict with subnet CIDR blocks in the VPC. The destination of each custom route must be unique.

Custom Route Between VPCs Example scenario If a VPC peering connection has been created linking two VPCs, VPC1 and VPC2, but only VPC1 has Internet access, you can add a custom route to allow the ECSs in VPC2 to access the Internet through an ECS that has an EIP bound in VPC1.

Figure 6-4 Custom Route Between VPCs

Configuration 1. Create a VPC peering connection between VPC1 and VPC2. Figure 6-5 shows the VPC peering connection configuration.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 95 Virtual Private Cloud User Guide 6 Route Table

Figure 6-5 VPC peering connection between VPC1 and VPC2

Table 6-3 and Table 6-4 list the routes used to configure the VPC peering connection.

Table 6-3 Route of a VPC peering connection in the route table associated with Subnet A

Destination Next Hop

192.168.10.0/24 pc-01

Table 6-4 Route of a VPC peering connection in the route table associated with Subnet X

Destination Next Hop

192.168.1.0/24 pc-01

0.0.0.0/0 pc-01

NO TE

In the preceding route tables, value pc-01 indicates the VPC peering connection ID. The value is automatically generated and cannot be configured. 2. Table 6-5 lists the custom route table configuration.

Table 6-5 Custom route in the VPC1 default route table

Destination Next Hop

0.0.0.0/0 The private or virtual IP address of ECS1

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 96 Virtual Private Cloud User Guide 6 Route Table

NO TE

● When you use a custom route to access the Internet, the destination can only be set to default value 0.0.0.0/0. It cannot be set to a specific public network segment. ● If the next hop is a virtual IP address, the virtual IP address must have an EIP bound. Otherwise, access to the Internet through this virtual IP address is not possible. 3. Configure ECS1 as an SNAT server by following the instructions provided in Configuring an SNAT Server.

Custom Route Between a VPC and a Direct Connect Connection Example scenario You can add a custom route to forward all packets from a Direct Connect connection to specified servers in the VPC, but a custom route needs to be added to the VPC. Table 6-6 provides the details needed to configure the route.

Figure 6-6 Custom route between a VPC and a Direct Connect connection

Configuration 1. Table 6-6 lists the custom route configuration. The destination is default value 0.0.0.0/0, and the next hop is the ECS private or virtual IP address.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 97 Virtual Private Cloud User Guide 6 Route Table

Table 6-6 VPC custom route table Destination Next Hop

0.0.0.0/0 The private or virtual IP address of ECS

2. Configure ECS1 as an SNAT server by following the instructions provided in Configuring an SNAT Server.

6.4 Configuring an SNAT Server

Scenarios To use the route table function provided by the VPC service, you need to configure SNAT on an ECS to enable other ECSs that do not have EIPs bound in a VPC to access the Internet through this ECS. The configured SNAT takes effect for all subnets in a VPC.

Prerequisites ● You have an ECS where SNAT is to be configured. ● The ECS where SNAT is to be configured runs the Linux OS. ● The ECS where SNAT is to be configured has only one network interface card (NIC).

Differences Between SNAT Servers and NAT Gateways The NAT Gateway service provides network address translation (NAT) for servers, such as ECSs, BMSs, and Workspace desktops, in a VPC or servers that connect to a VPC through Direct Connect or VPN in local data centers. A NAT gateway allows these servers to access the Internet using EIPs or to provide services for the Internet. The NAT Gateway service is easier to configure and use than SNAT. This service can be flexibly deployed across subnets and AZs and supports different NAT gateway specifications. You can click NAT Gateway under Networking on the management console to try this service. For details, see the NAT Gateway User Guide.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Computing, click Elastic Cloud Server. 4. On the displayed page, locate the target ECS in the ECS list and click the ECS name to switch to the page showing ECS details. 5. On the displayed ECS details page, click the NICs tab. 6. Click the NIC IP address. In the displayed area showing the NIC details, disable the source/destination check function.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 98 Virtual Private Cloud User Guide 6 Route Table

By default, the source/destination check is enabled. When this check is enabled, the system checks whether source IP addresses contained in the packets sent by ECSs are correct. If the IP addresses are incorrect, the system does not allow the ECSs to send the packets. This mechanism prevents packet spoofing, thereby improving system security. If SNAT is used, the SNAT server needs to forward packets. This mechanism prevents the packet sender from receiving returned packets. Therefore, you need to disable the source/ destination check for SNAT servers. 7. Bind an EIP. – Bind an EIP with the private IP address of the ECS. For details, see Assigning an EIP and Binding It to an ECS. – Bind an EIP with the virtual IP address of the ECS. For details, see Binding a Virtual IP Address to an EIP or ECS. 8. On the ECS console, use the remote login function to log in to the ECS where you plan to configure SNAT. 9. Run the following command and enter the password of user root to switch to user root: su - root 10. Run the following command to check whether the ECS can successfully connect to the Internet: NO TE

Before running the command, you must disable the response iptables rule on the ECS where SNAT is configured and enable the security group rules. ping www.huawei.com The ECS can access the Internet if the following information is displayed: [root@ ~]# ping www.huawei.com PING www.a.shifen.com (xxx.xxx.xxx.xxx) 56(84) bytes of data. 64 bytes from xxx.xxx.xxx.xxx: icmp_seq=1 ttl=51 time=9.34 ms 64 bytes from xxx.xxx.xxx.xxx: icmp_seq=2 ttl=51 time=9.11 ms 64 bytes from xxx.xxx.xxx.xxx: icmp_seq=3 ttl=51 time=8.99 ms 11. Run the following command to check whether IP forwarding of the Linux OS is enabled: cat /proc/sys/net//ip_forward In the command output, 1 indicates it is enabled, and 0 indicates it is disabled. The default value is 0. – If IP forwarding in Linux is enabled, go to step 14. – If IP forwarding in Linux is disabled, perform step 12 to enable IP forwarding in Linux. Many OSs support packet routing. Before forwarding packets, OSs change source IP addresses in the packets to OS IP addresses. Therefore, the forwarded packets contain the IP address of the public sender so that the response packets can be sent back along the same path to the initial packet sender. This method is called SNAT. The OSs need to keep track of the packets where IP addresses have been changed to ensure that the destination IP addresses in the packets can be rewritten and that packets can be forwarded to the initial packet sender. To achieve these purposes, you need to enable the IP forwarding function and configure SNAT rules. 12. Use the vi editor to open the /etc/sysctl.conf file, change the value of net.ipv4.ip_forward to 1, and enter :wq to save the change and exit.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 99 Virtual Private Cloud User Guide 6 Route Table

13. Run the following command to make the change take effect: sysctl -p /etc/sysctl.conf 14. Configure SNAT. Run the following command to enable all ECSs on the network segment (for example, 192.168.1.0/24) to access the Internet using the SNAT function: Figure 6-7 shows the example command. iptables -t nat -A POSTROUTING -o eth0 -s subnet -j SNAT --to nat- instance-ip

Figure 6-7 Configuring SNAT

NO TE

● To ensure that the rule will not be lost after the restart, write the rule into the /etc/rc.local file. 1. Run the following command to switch to the /etc/sysctl.conf file: vi /etc/rc.local 2. Perform 14 to configure SNAT. 3. Run the following command to save the configuration and exit: :wq 4. Run the following command to add the execute permission for the rc.local file: # chmod +x /etc/rc.local ● To ensure that the configuration takes effect, run the iptables -L command to check whether the configured rules conflict with each other. 15. Run the following command to check whether the operation is successful: If information similar to Figure 6-8 (for example, 192.168.1.0/24) is displayed, the operation was successful. iptables -t nat --list

Figure 6-8 Verifying configuration

16. Add a route. For details, see section Adding a Custom Route.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 100 Virtual Private Cloud User Guide 6 Route Table

Set the destination to 0.0.0.0/0, and the next hop to the private or virtual IP address of the ECS where SNAT is deployed. For example, the next hop is 192.168.1.4.

After these operations are complete, if the network communication still fails, check your security group and network ACL configuration to see whether required traffic is allowed.

6.5 Adding a Custom Route

Scenarios

When ECSs in a VPC need to access the Internet, add a custom route to enable the ECSs to access the Internet through the ECS that has an EIP bound.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Virtual Private Cloud. 5. On the Virtual Private Cloud page, locate the VPC to which a route is to be added and click the VPC name. 6. On the Route Tables tab, click Add Route. 7. Set route details on the displayed page.

Figure 6-9 Add Route

– Destination indicates the destination CIDR block. The default value is 0.0.0.0/0. If the traffic originates from a VPC, the destination can be a subnet CIDR block in this VPC. If the traffic originates from outside the VPC, the destination CIDR block cannot conflict with any of the subnet CIDR blocks in this VPC. The destination of each route must be unique. – Next Hop: indicates the IP address of the next hop. Set it to a private IP address or a virtual IP address in a VPC.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 101 Virtual Private Cloud User Guide 6 Route Table

NO TE

If the next hop is a virtual IP address, an EIP must be bound to the virtual IP address. Otherwise, access to the Internet through this virtual IP address is not possible. (A custom route is used to forward traffic from the virtual IP address to the Internet.) 8. Click OK.

6.6 Viewing a Route Table

Scenarios

You can view details about a route table.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Virtual Private Cloud. 5. On the Virtual Private Cloud page, locate the VPC that is associated with the route table to be queried and click the VPC name. 6. View details about the route table.

6.7 Modifying a Route

Scenarios

Change the destination and next hop of the route.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Virtual Private Cloud. 5. On the Virtual Private Cloud page, locate the VPC to which the route to be modified belongs and click the VPC name. 6. Click the Route Tables tab. On the displayed page, locate the row that contains the route to be modified, and click Modify in the Operation column. Modify the route information in the displayed dialog box. 7. Click OK.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 102 Virtual Private Cloud User Guide 6 Route Table

6.8 Deleting a Route

Scenarios Delete a route if it is no longer required.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Virtual Private Cloud. 5. On the Virtual Private Cloud page, locate the VPC that the route to be deleted belongs to and click the VPC name. 6. Click the Route Tables tab. On the displayed page, locate the row that contains the route to be deleted, and click Delete in the Operation column. 7. Click Yes in the displayed dialog box.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 103 Virtual Private Cloud 7 Route Table (Module Accessible from the Left User Guide Navigation Pane)

7 Route Table (Module Accessible from the Left Navigation Pane)

7.1 Route Table Overview

Background The way you can access the route table module varies by region. ● If the route table module is not decoupled from the VPC module in your selected region, access the route table module by clicking the Route Tables tab on the VPC details page. ● If the route table module is decoupled from the VPC module in your selected region, access the route table module by clicking Route Tables in the left navigation pane of the VPC console.

Figure 7-1 Entry to the route table module

This section applies to the regions where you can visit the route table module directly from the navigation pane. Otherwise, refer to Route Table.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 104 Virtual Private Cloud 7 Route Table (Module Accessible from the Left User Guide Navigation Pane)

Route Table

A route table contains a set of routes that are used to determine where network traffic from your subnets in a VPC is directed. Each subnet must be associated with a route table. A subnet can only be associated with one route table at a time, but you can associate multiple subnets with the same route table.

Default Route Table and Custom Route Table

When you create a VPC, the system automatically generates a default route table for the VPC. If you create a subnet in the VPC, the subnet automatically associates with the default route table. You can add, delete, and modify routes in the default route table, but you cannot delete the route table. When you create a VPN, Cloud Connect, or Direct Connect connection, the default route table automatically delivers a route that cannot be deleted or modified. If you want to modify or delete the route, you can associate your subnet with a custom route table and replicate the route to the custom route table to modify or delete it.

If you do not want to use the default route table, you can now create a custom route table and associate it with the subnet. You can delete the custom route table if it is no longer required.

NO TE

● The custom route table associated with a subnet affects only the outbound traffic. The default route table determines the inbound traffic. ● To use a custom route table, you need to submit a service ticket. You need to click Increase quota on the Create Route Table page or choose More > Service Tickets > Create Service Ticket in the upper right corner of the page. For more information, see Submitting a Service Ticket .

For details about how to create a custom route table, see section Creating a Custom Route Table.

Route

A route is configured with the destination, next hop type, and next hop to determine where network traffic is directed. Routes are classified into system routes and custom routes.

● System routes: These routes are automatically added by the system and cannot be modified or deleted. After a route table is created, the system automatically adds the following system routes to the route table, so that instances in a VPC can communicate with each other. – Routes whose destination is 100.64.0.0/10 or 198.19.128.0/20. – Routes whose destination is a subnet CIDR block.

NO TE

In addition to the preceding system routes, the system automatically adds a route whose destination is 127.0.0.0/8. This is the local loopback address. ● Custom routes: These are routes that you can add, modify, and delete. The destination of a custom route cannot overlap with that of a system route.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 105 Virtual Private Cloud 7 Route Table (Module Accessible from the Left User Guide Navigation Pane)

You can add a custom route and configure the destination, next hop type, and next hop in the route to determine where network traffic is directed. Table 7-1 lists the supported types of next hops.

Table 7-1 Next hop type

Next Description Hop Type

ECS Traffic intended for the destination is forwarded to an ECS in the VPC.

Extension Traffic intended for the destination is forwarded to the NIC extension NIC of an ECS in the VPC.

VPN Traffic intended for the destination is forwarded to a VPN gateway gateway.

Cloud Traffic intended for the destination is forwarded to a cloud connectio connection. n

Direct Traffic intended for the destination is forwarded to a Direct Connect Connect gateway. gateway

NAT Traffic intended for the destination is forwarded to a NAT gateway gateway.

VPC Traffic intended for the destination is forwarded to a VPC peering peering connection. connectio n

Virtual IP Traffic intended for the destination is forwarded to a virtual IP address address and then sent to active and standby ECSs to which the virtual IP address is bound.

NO TE

● When you add a custom route to a default route table, the next hop type cannot be set to VPN gateway or Direct Connect gateway. ● If you specify the destination when creating a service, a system route is delivered. If you do not specify a destination when creating a service, a custom route that can be modified or deleted is delivered. For example, you do not need to specify a destination when creating a NAT gateway, and the system automatically delivers a custom route that you can modify or delete. However, when you create a VPN gateway, you need to specify the remote subnet, that is, the destination of a route. In this case, the system delivers a system route. You cannot modify the route destination on the Route Tables page, because the destination will be inconsistent with the configured remote subnet. To modify the route destination, go to the specific service page and modify the remote subnet, then the route destination will be changed accordingly.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 106 Virtual Private Cloud 7 Route Table (Module Accessible from the Left User Guide Navigation Pane)

Custom Route Table Configuration Process Figure 7-2 shows the process of creating and configuring a custom route table.

Figure 7-2 Route table configuration process

1. For details about how to create a custom route table, see Creating a Custom Route Table. 2. For details about how to add a custom route, see Adding a Custom Route. 3. For details about how to associate a subnet with a route table, see Associating a Subnet with a Route Table. After the association, the routes in the route table control the routing for the subnet.

Notes and Constraints ● A maximum of 200 routes can be added to each route table. ● The default route table cannot be deleted. ● The system route cannot be modified or deleted. ● The routes delivered by the VPN, Cloud Connect, and Direct Connect services to the default route table cannot be modified or deleted. ● When you add a custom route to a default route table, the next hop type cannot be set to VPN gateway or Direct Connect gateway.

7.2 Creating a Custom Route Table

Scenarios You can create a custom route table if you do not want to use the default one. To use a custom route table, you need to submit a service ticket. You need to click Increase quota on the Create Route Table page or choose More > Service

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 107 Virtual Private Cloud 7 Route Table (Module Accessible from the Left User Guide Navigation Pane)

Tickets > Create Service Ticket in the upper right corner of the page. For more information, see Submitting a Service Ticket.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Route Tables. 5. In the upper right corner, click Create Route Table. On the displayed page, configure parameters as prompted.

Table 7-2 Parameter descriptions

Parameter Description Example Value

Name The name of the route table. This rtb-001 parameter is mandatory. The name can contain a maximum of 64 characters, which may consist of letters, digits, underscores (_), hyphens (-), and periods (.). The name cannot contain spaces.

VPC The VPC that the route table belongs to. vpc-001 This parameter is mandatory.

Description Supplementary information about the - route table. This parameter is optional. The description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).

Route The route information. This parameter is - Settings optional. You can add a route when creating the route table or after the route table is created. For details, see Adding a Custom Route. You can click + to add more routes.

6. Click OK. A message is displayed. You can determine whether to associate the route table with subnets immediately as prompted. If you want to associate immediately, perform the following operations: a. Click Associate Subnet. The route table details page is displayed. b. Click Associate Subnet and select the target subnets to be associated. c. Click OK.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 108 Virtual Private Cloud 7 Route Table (Module Accessible from the Left User Guide Navigation Pane)

7.3 Adding a Custom Route

Scenarios Each route table contains a default system route, which indicates that ECSs in a VPC can communicate with each other. You can add custom routes as required to forward the traffic destined for the destination to the specified next hop.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Route Tables. 5. In the route table list, click the name of the route table to which you want to add a route. 6. Click Add Route and set parameters as prompted. You can click + to add more routes.

Figure 7-3 Add Route

Table 7-3 Parameter descriptions Parameter Description Example Value

Destination The destination CIDR block. 192.168.0.0/16 The destination of each route must be unique. The destination cannot overlap with any subnet CIDR block in the VPC.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 109 Virtual Private Cloud 7 Route Table (Module Accessible from the Left User Guide Navigation Pane)

Parameter Description Example Value

Next Hop Set the type of the next hop. For details ECS Type about the supported resource types, see Table 7-1. NOTE When you add a custom route to or modify a custom route in a default route table, the next hop type cannot be set to VPN gateway or Direct Connect gateway.

Next Hop Set the next hop. The resources in the ecs-001 drop-down list box are displayed based on the selected next hop type.

Description Supplementary information about the - route. This parameter is optional. The description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).

7. Click OK.

7.4 Associating a Subnet with a Route Table

Scenarios After a route table is associated with a subnet, the routes in the route table control the routing for the subnet and apply to all cloud resources in the subnet. Determine the impact on services before performing this operation.

Notes and Constraints A subnet can only be associated with one route table.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Route Tables. 5. In the route table list, locate the row that contains the target route table and click Associate Subnet in the Operation column. 6. Select the subnet to be associated.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 110 Virtual Private Cloud 7 Route Table (Module Accessible from the Left User Guide Navigation Pane)

Figure 7-4 Associate Subnet

7. Click OK.

7.5 Changing the Route Table Associated with a Subnet

Scenarios

You can change the route table associated with the subnet to another one in the VPC. If the route table for a subnet is changed, routes in the new route table will apply to all cloud resources in the subnet. Determine the impact on services before performing this operation.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Route Tables. 5. In the route table list, click the name of the target route table. 6. On the Associated Subnets tab page, click Change Route Table in the Operation column and select a new route table as prompted. 7. Click OK. After the route table for a subnet is changed, routes in the new route table will apply to all cloud resources in the subnet.

7.6 Viewing a Route Table

Scenarios

You can view the basic information, routes, and associated subnets of a route table.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 111 Virtual Private Cloud 7 Route Table (Module Accessible from the Left User Guide Navigation Pane)

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Route Tables. 5. In the route table list, click the name of the target route table.

7.7 Deleting a Route Table

Scenarios

You can delete custom route tables but cannot delete the default route table.

Prerequisites

Before deleting a route table, ensure that no subnet has been associated with the custom route table. If there is an associated subnet, associate the subnet with another route table by clicking Change Route Table and then delete the custom route table.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Route Tables. 5. In the route table list, locate the row that contains the route table to be deleted and click Delete in the Operation column. 6. Click Yes in the displayed dialog box.

7.8 Modifying a Route

Scenarios

Modify an existing route.

Notes and Constraints ● The system route cannot be modified. ● The routes delivered by the VPN, Direct Connect, and Cloud Connect services to the default route table cannot be modified.

Procedure 1. Log in to the management console.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 112 Virtual Private Cloud 7 Route Table (Module Accessible from the Left User Guide Navigation Pane)

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Route Tables. 5. In the route table list, click the name of the target route table. 6. Locate the row that contains the route to be modified and click Modify in the Operation column. 7. Modify the route information in the displayed dialog box.

Table 7-4 Parameter descriptions

Parameter Description Example Value

Destination The destination CIDR block. 192.168.0.0/16 The destination of each route must be unique. The destination cannot overlap with any subnet CIDR block in the VPC.

Next Hop Set the type of the next hop. For details ECS Type about the supported resource types, see Table 7-1. NOTE When you add a custom route to or modify a custom route in a default route table, the next hop type cannot be set to VPN gateway or Direct Connect gateway.

Next Hop Set the next hop. The resources in the ecs-001 drop-down list box are displayed based on the selected next hop type.

Description Supplementary information about the - route. This parameter is optional. The description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).

8. Click OK.

7.9 Deleting a Route

Scenarios

Delete a custom route if it is no longer required.

Notes and Constraints ● The system route cannot be deleted. ● The routes delivered by the VPN, Direct Connect, and Cloud Connect services to the default route table cannot be deleted.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 113 Virtual Private Cloud 7 Route Table (Module Accessible from the Left User Guide Navigation Pane)

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Route Tables. 5. In the route table list, click the name of the target route table. 6. Locate the row that contains the route to be deleted and click Delete in the Operation column. 7. Click Yes in the displayed dialog box.

7.10 Replicating a Route

Scenarios You can replicate a created route as required.

Notes and Constraints ● The gateway VPC endpoint routes delivered by the VPC Endpoint service to the default route table cannot be replicated. ● The routes delivered by the VPN service to the default route table cannot be replicated. ● The routes delivered to the default route table by the Direct Connect service that is enabled by call or email cannot be replicated.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Route Tables. 5. In the route table list, locate the row that contains the target route table and click Replicate Route in the Operation column. 6. Select the target route table and then the route to be replicated as prompted. The routes listed on the page are those that do not exist in the target route table. You can select one or more routes to replicate to the target route table. 7. Click OK.

7.11 Exporting Route Table Information

Scenarios Information about all route tables under your account can be exported as an Excel file to a local directory. This file records the name, ID, VPC, type, and number of associated subnets of the route tables.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 114 Virtual Private Cloud 7 Route Table (Module Accessible from the Left User Guide Navigation Pane)

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. Under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Route Tables.

5. On the displayed page, click in the upper right of the route table list. The system will automatically export information about all route tables under your account in the current region as an Excel file to a local directory.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 115 Virtual Private Cloud User Guide 8 VPC Peering Connection

8 VPC Peering Connection

8.1 VPC Peering Connection Overview A VPC peering connection is a network connection between two VPCs in one region that enables you to route traffic between them using private IP addresses. ECSs in either VPC can communicate with each other just as if they were in the same region. You can create a VPC peering connection between your own VPCs, or between your VPC and another account's VPC within the same region. However, you cannot create a VPC peering connection between VPCs in different regions.

Figure 8-1 VPC peering connection

Notes and Constraints ● VPC peering connections created between VPCs that have overlapping subnet CIDR blocks may not take effect. ● You cannot have more than one VPC peering connection between any two VPCs at the same time. ● You cannot create a VPC peering connection between VPCs in different regions. ● Even if VPC 1 and VPC 2 are connected using a VPC peering connection, ECSs in VPC 2 cannot access the Internet through the EIP of VPC 1. If you want to

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 116 Virtual Private Cloud User Guide 8 VPC Peering Connection

allow the ECSs in VPC 2 to access the Internet through the EIP of VPC 1, you can use a NAT gateway or configure an SNAT server. For details, see Having an ECS Without a Public IP Address Access the Internet. ● If you request a VPC peering connection with a VPC of another account, the peer account must accept the request to activate the connection. If you request a VPC peering connection with a VPC of your own, the system automatically accepts the request and activates the connection. ● After a VPC peering connection is established, the local and peer tenants must add routes in the local and peer VPCs to enable communication between the two VPCs. ● VPC A is peered with both VPC B and VPC C. If VPC B and VPC C have overlapping CIDR blocks, you cannot configure routes with the same destinations for VPC A. ● To ensure security, do not accept VPC peering connections from unknown accounts. ● Either owner of a VPC in a peering connection can delete the VPC peering connection at any time. If a VPC peering connection is deleted by one of its owners, all information about this connection will also be deleted immediately, including routes added for the VPC peering connection. ● If VPCs connected by a VPC peering connection have overlapping CIDR blocks, the connection can only enable communication between specific (non- overlapping) subnets in the VPCs. If subnets in the two VPCs of a VPC peering connection have overlapping CIDR blocks, the peering connection will not take effect. When you create a VPC peering connection, ensure that the VPCs involved do not contain overlapping subnets. ● You cannot delete a VPC that has VPC peering connection routes configured. ● A VPC peering connection can be created between VPCs in same region even if one is created on the HUAWEI CLOUD Chinese Mainland console and another on the HUAWEI CLOUD international console.

8.2 VPC Peering Connection Configuration Plans

To enable two VPCs to communicate with each other, you can create a VPC peering connection between them. As long as the two VPCs do not overlap, you can configure routes that point to entire VPCs for the VPC peering connection. If the two VPCs have overlapping CIDR blocks, you can only configure routes that point to specific subnets of the VPCs for the VPC peering connection.

● Configurations with Routes to Entire VPCs – There can be two or more VPCs peered together using VPC peering connections. – Regardless of how many VPCs are connected, if you need to configure routes that point to entire VPCs in a VPC peering connection, none of the VPCs involved in the connection can have overlapping CIDR blocks. Otherwise, the VPC peering connection will be unable to take effect because the routes will be unreachable. – The destination of the route that points to an entire VPC is the CIDR block of the peer VPC, and the next hop is the VPC peering connection ID.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 117 Virtual Private Cloud User Guide 8 VPC Peering Connection

If VPC 1 and VPC 2 have different CIDR blocks, you can create a VPC peering connection route that points to the entire VPC. Figure 8-2 shows a VPC peering connection created between two VPCs.

Figure 8-2 VPC peering connection between VPC 1 and VPC 2

Routes are required to enable communication between VPC 1 and VPC 2 in the figure. Figure 8-3 shows the routes configured for the VPC peering connection between VPC 1 and VPC 2. After the routes are configured, VPC 1 and VPC 2 can communicate with each other.

Figure 8-3 Route table for the VPC peering connection between VPC 1 and VPC 2

● Configurations with Routes to Specific Subnets If VPCs connected by a VPC peering connection have overlapping CIDR blocks, the connection can only enable communication between specific (non- overlapping) subnets in the VPCs. If subnets in the two VPCs of a VPC peering connection have overlapping CIDR blocks, the peering connection will not take effect. When you create a VPC peering connection, ensure that the VPCs involved do not contain overlapping subnets. For example, VPC 1 and VPC 2 have matching CIDR blocks, but the subnets in the two VPCs do not overlap. A VPC peering connection can be created between pairs of subnets that do not overlap with each other. The route table is used to control the specific subnets that the VPC peering connection is created for. Figure 8-4 shows a VPC peering connection created between two subnets. Routes are required to enable communication between Subnet A in VPC 1 and Subnet X in VPC 2 in the figure.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 118 Virtual Private Cloud User Guide 8 VPC Peering Connection

Figure 8-4 VPC peering connection between Subnet A and Subnet X

Figure 8-5 shows the routes configured for the VPC peering connection between Subnet A and Subnet X. After the routes are configured, Subnet A and Subnet X can communicate with each other.

Figure 8-5 Route table for the VPC peering connection between Subnet A and Subnet X

If two VPCs have overlapping subnets, the VPC peering connection created between the two subnets does not take effect, and the subnets cannot communicate with each other. As shown in Figure 8-6, Subnet B and Subnet X have matching CIDR blocks. Therefore, subnet A preferentially accesses subnet B that is in its same VPC and a VPC peering connection cannot be created between Subnet A and Subnet X.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 119 Virtual Private Cloud User Guide 8 VPC Peering Connection

Figure 8-6 Invalid VPC peering connection

If peering connections are used to link VPC 1 to multiple VPCs, for example, VPC 2, VPC 3, and VPC 4, the subnet CIDR blocks of VPC 1 cannot overlap with those of VPC 2, VPC 3, and VPC 4. If VPC 2, VPC 3, and VPC 4 have overlapping subnets, a VPC peering connection can be created between only one of these overlapping subnets and a subnet of VPC 1. If a VPC peering connection is created between a subnet and the other N subnets, none of the subnets can have overlapping CIDR blocks.

8.3 Creating a VPC Peering Connection with Another VPC in Your Account

Scenarios To create a VPC peering connection, first create a request to peer with another VPC. You can request a VPC peering connection with another VPC in your account, but the two VPCs must be in the same region. The system automatically accepts the request. This section describes how to create a VPC peering connection between two VPCs (VPC-01 and VPC-02) that are in the same account. Assume that the CIDR block of VPC-01 is 192.168.10.0/24 and that of VPC-02 is 192.168.2.0/24. The following figure shows the routes of the VPC peering connection.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 120 Virtual Private Cloud User Guide 8 VPC Peering Connection

Figure 8-7 Route table for the VPC peering connection between VPC-01 and VPC-02

Procedure

Figure 8-8 Creating a VPC peering connection between VPCs in your account

If you create a VPC peering connection between two VPCs in your account, the system accepts the connection by default. You need to add routes for the local and peer VPCs to enable communication between the two VPCs.

NO TE

The entry to visit the route table module varies by region. ● If the route table module is not decoupled from the VPC module in your selected region, access the route table module by clicking the Route Tables tab on the VPC details page. ● If the route table module is decoupled from the VPC module in your selected region, access the route table module by clicking Route Tables in the left navigation pane of the VPC console. If you have to visit the route table module through the VPC details page in your region, see Adding Routes for a VPC Peering Connection (Route Table Module Accessible from the VPC Details Page). If you can visit the route table module directly from the navigation pane on the VPC console in your region, see Adding Routes for a VPC Peering Connection (Route Table Module Accessible from the Left Navigation Pane).

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 121 Virtual Private Cloud User Guide 8 VPC Peering Connection

Prerequisites Two VPCs in the same region have been created.

Creating a VPC Peering Connection 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click VPC Peering. 5. In the right pane displayed, click Create VPC Peering Connection. 6. Configure parameters as prompted. You must select My account for Account. Table 8-1 lists the parameters to be configured.

Figure 8-9 Create VPC Peering Connection

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 122 Virtual Private Cloud User Guide 8 VPC Peering Connection

Table 8-1 Parameter descriptions Parameter Description Example Value

Name The name of the VPC peering peering-001 connection. The name contains a maximum of 64 characters, which consist of letters, digits, hyphens (-), and underscores (_).

Local VPC The local VPC. You can select vpc_01 one from the drop-down list.

Local VPC The CIDR block for the local 192.168.10.0/24 CIDR Block VPC.

Account The account to which the peer My account VPC belongs. ● My account: The VPC peering connection will be created between two VPCs, in the same region, in your account. ● Another account: The VPC peering connection will be created between your VPC and a VPC in another account, in the same region.

Peer Project The peer project name. The aaa project name of the current project is used by default.

Peer VPC The peer VPC. You can select vpc_02 one from the drop-down list if the VPC peering connection is created between two VPCs in your own account.

Peer VPC CIDR The CIDR block for the peer 192.168.2.0/24 Block VPC. The local and peer VPCs cannot have matching or overlapping CIDR blocks. Otherwise, the routes added for the VPC peering connection may not take effect.

7. Click OK.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 123 Virtual Private Cloud User Guide 8 VPC Peering Connection

Adding Routes for a VPC Peering Connection (Route Table Module Accessible from the VPC Details Page)

If you request a VPC peering connection with another VPC in your own account, the system automatically accepts the request. To enable communication between the two VPCs, you need to add local and peer routes for the VPC peering connection.

1. On the console homepage, under Networking, click Virtual Private Cloud. 2. In the navigation pane on the left, click VPC Peering. 3. Locate the target VPC peering connection in the connection list. 4. Click the name of the VPC peering connection to switch to the page showing details about the connection. 5. In the displayed Local Routes area, click Add Local Route. In the displayed dialog box, add a local route. Table 8-2 lists the parameters to be configured.

Figure 8-10 Add Local Route

Table 8-2 Route parameter description

Parameter Description Example Value

Destination The destination 192.168.2.0/24 address. Set it to the peer VPC or subnet CIDR block.

Next Hop The next hop address. d1a7863b-9d5e-4d27-8 The default value is the eaf-ab14d2a9148b VPC peering connection ID. Keep the default value.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 124 Virtual Private Cloud User Guide 8 VPC Peering Connection

6. Click OK to switch to the page showing the VPC peering connection details. 7. On the displayed page, click the Peer Routes tab. 8. In the displayed Peer Routes area, click Add Peer Route and add a route. 9. Click OK to add the route. After a VPC peering connection is created, the two VPCs can communicate with each other through private IP addresses. You can run the ping command to check whether the two VPCs can communicate with each other. Before running the ping command, ensure that the security group allows inbound ICMP traffic. For details, see Adding a Security Group Rule.

Adding Routes for a VPC Peering Connection (Route Table Module Accessible from the Left Navigation Pane) If you request a VPC peering connection with another VPC in your own account, the system automatically accepts the request. To enable communication between the two VPCs, you need to add local and peer routes on the Route Tables page for the VPC peering connection. 1. On the console homepage, under Networking, click Virtual Private Cloud. 2. In the navigation pane on the left, choose Route Tables. 3. Search for or create a route table for the local VPC and add the local route. Table 8-3 describes the route parameters.

Figure 8-11 Add Local Route

Table 8-3 Parameter descriptions Parameter Description Example Value

Destination The CIDR block for the peer VPC. 192.168.2.0/24

Next Hop The next hop type. Select VPC peering VPC peering Type connection. connection

Next Hop The next hop address. Select the name of peering-001 the current VPC peering connection.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 125 Virtual Private Cloud User Guide 8 VPC Peering Connection

Parameter Description Example Value

Description Supplementary information about the N/A route. This parameter is optional. The route description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).

4. Search for or create a route table for the peer VPC and add the peer route. After a VPC peering connection is created, the two VPCs can communicate with each other through private IP addresses. You can run the ping command to check whether the two VPCs can communicate with each other. Before running the ping command, ensure that the security group allows inbound ICMP traffic. For details, see Adding a Security Group Rule.

Helpful Links Why Does Communication Fail Between VPCs That Are Connected by a VPC Peering Connection?

8.4 Creating a VPC Peering Connection with a VPC in Another Account

Scenarios The VPC service also allows you to create a VPC peering connection with a VPC in another account. The two VPCs must be in the same region. If you request a VPC peering connection with a VPC in another account in the same region, the owner of the peer account must accept the request to activate the connection. This service is free of charge and your account and the peer account will not be charged for this. This section describes how to create a VPC peering connection between two VPCs (VPC-01 and VPC-03) that are in different accounts. Assume that the CIDR block of VPC-01 is 192.168.10.0/24 and that of VPC-03 is 192.168.3.0/24. The following figure shows the routes of the VPC peering connection.

Figure 8-12 Route table for the VPC peering connection between VPC-01 and VPC-03

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 126 Virtual Private Cloud User Guide 8 VPC Peering Connection

Procedure

Figure 8-13 Creating a VPC peering connection with a VPC in another account

If you create a VPC peering connection between your VPC and a VPC that is in another account, the VPC peering connection will be in the Awaiting acceptance state. After the owner of the peer account accepts the connection, the connection status changes to Accepted. The owners of both the local and peer accounts must configure the routes required by the VPC peering connection to enable communication between the two VPCs.

NO TE

The entry to visit the route table module varies by region. ● If the route table module is not decoupled from the VPC module in your selected region, access the route table module by clicking the Route Tables tab on the VPC details page. ● If the route table module is decoupled from the VPC module in your selected region, access the route table module by clicking Route Tables in the left navigation pane of the VPC console. If you have to visit the route table module through the VPC details page in your region, see Adding Routes for a VPC Peering Connection (Route Table Module Accessible from the VPC Details Page). If you can visit the route table module directly from the navigation pane in your region, see Adding Routes for a VPC Peering Connection (Route Table Module Accessible from the Left Navigation Pane).

Creating a VPC Peering Connection 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click VPC Peering.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 127 Virtual Private Cloud User Guide 8 VPC Peering Connection

5. In the right pane displayed, click Create VPC Peering Connection. 6. Configure parameters as prompted. You must select Another account for Account.

Figure 8-14 Creating a VPC peering connection

Table 8-4 Parameter descriptions

Parameter Description Example Value

Name The name of the VPC peering peering-002 connection. The name contains a maximum of 64 characters, which consist of letters, digits, hyphens (-), and underscores (_).

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 128 Virtual Private Cloud User Guide 8 VPC Peering Connection

Parameter Description Example Value

Local VPC The local VPC. You can select vpc_01 one from the drop-down list.

Account The account to which the VPC to Another account peer with belongs. ● My account: The VPC peering connection will be created between two VPCs, in the same region, in your account. ● Another account: The VPC peering connection will be created between your VPC and a VPC in another account, in the same region.

Peer Project This parameter is available only N/A ID when Another account is selected. For details about how to obtain the peer project ID, see Obtaining the Peer Project ID.

Peer VPC ID This parameter is available only 65d062b3-40fa-4204-8 when Another account is 181-3538f527d2ab selected. For details about how to obtain the peer VPC ID, see Obtaining the Peer VPC ID.

7. Click OK.

NO TE

If a message indicating that correct VPC ID and project ID should be entered is displayed, the VPC peering connection may fail to be created because the VPCs are not in the same region. You can use Cloud Connect to enable communication between VPCs in different regions. For details, see Cloud Connect.

Accepting a VPC Peering Connection Request

To request a VPC peering connection with a VPC in another account, the owner of the peer account must accept the request to activate the connection.

NO TE

To ensure security, do not accept VPC peering connections from unknown accounts. 1. The owner of the peer account logs in to the management console. 2. On the console homepage, under Networking, click Virtual Private Cloud. 3. In the navigation pane on the left, click VPC Peering.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 129 Virtual Private Cloud User Guide 8 VPC Peering Connection

4. In the list of requests to be handled, locate the row that contains the target VPC peering connection and click Accept Request in the Operation column.

Figure 8-15 List of requests to be handled

5. Click Yes in the displayed dialog box.

Refusing a VPC Peering Connection The owner of the peer account can reject any VPC peering connection request that they receive. If a VPC peering connection request is rejected, the connection will not be established. You must delete the rejected VPC peering connection request before creating a VPC peering connection between the same VPCs as those in the rejected request. 1. The owner of the peer account logs in to the management console. 2. On the console homepage, under Networking, click Virtual Private Cloud. 3. In the navigation pane on the left, click VPC Peering. 4. In the list of requests to be handled, locate the row that contains the target VPC peering connection and click Reject Request in the Operation column. 5. Click Yes in the displayed dialog box.

Adding Routes for a VPC Peering Connection (Route Table Module Accessible from the VPC Details Page) If you request a VPC peering connection with a VPC in another account, the owner of the peer account must accept the request. To enable communication between the two VPCs, you need to add routes for the VPC peering connection. The owner of the local account can add only the local route because the owner does not have the required permission to perform operations on the peer VPC. The owner of the peer account must add the peer route. The procedure for adding a local route and a peer route is the same. 1. Log in to the management console. 2. On the console homepage, under Networking, click Virtual Private Cloud. 3. In the navigation pane on the left, click VPC Peering. 4. Locate the target VPC peering connection in the connection list. 5. Click the name of the VPC peering connection to switch to the page showing details about the connection. 6. Click Add Local Route to add local route information. For parameter description, see Table 8-5.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 130 Virtual Private Cloud User Guide 8 VPC Peering Connection

Figure 8-16 Add Local Route

Table 8-5 Route parameter descriptions

Parameter Description Example Value

Destination The destination 192.168.3.0/24 address. Set it to the peer VPC or subnet CIDR block.

Next Hop The next hop address. ba5db563-8673-488b- The default value is the addf-854cabb7fc56 VPC peering connection ID. Keep the default value.

7. Click OK. The routes are added for the VPC peering connection.

After a VPC peering connection is created, the two VPCs can communicate with each other through private IP addresses. You can run the ping command to check whether the two VPCs can communicate with each other. Before running the ping command, ensure that the security group allows inbound ICMP traffic. For details, see Adding a Security Group Rule.

Adding Routes for a VPC Peering Connection (Route Table Module Accessible from the Left Navigation Pane)

If you request a VPC peering connection with a VPC in another account, the owner of the peer account must accept the request. To enable communication between the two VPCs, the owners of both the local and peer accounts need to add routes on the Route Tables page for the VPC peering connection. The owner of the local account can add only the local route because the owner does not have the required permission to perform operations on the peer VPC. The owner of the peer account must add the peer route. The procedure for adding a local route and a peer route is the same.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 131 Virtual Private Cloud User Guide 8 VPC Peering Connection

1. On the console homepage, under Networking, click Virtual Private Cloud. 2. In the navigation pane on the left, choose Route Tables. 3. Search for or create a route table for the local VPC and add the local route. Table 8-6 describes the route parameters.

Figure 8-17 Add Local Route

Table 8-6 Parameter descriptions

Parameter Description Example Value

Destination The CIDR block for the peer VPC. 192.168.3.0/24

Next Hop The next hop type. Select VPC peering VPC peering Type connection. connection

Next Hop The next hop address. Select the name peering-002 of the current VPC peering connection.

Description Supplementary information about the - route. This parameter is optional. The description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).

4. Click OK. The routes are added for the VPC peering connection.

After a VPC peering connection is created, the two VPCs can communicate with each other through private IP addresses. You can run the ping command to check whether the two VPCs can communicate with each other. Before running the ping command, ensure that the security group allows inbound ICMP traffic. For details, see Adding a Security Group Rule.

Obtaining the Peer Project ID 1. The owner of the peer account logs in to the management console. 2. Select My Credentials from the username drop-down list. 3. On the Projects tab, obtain the required project ID.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 132 Virtual Private Cloud User Guide 8 VPC Peering Connection

Obtaining the Peer VPC ID 1. The owner of the peer account logs in to the management console. 2. On the console homepage, under Networking, click Virtual Private Cloud. 3. In the navigation pane on the left, click Virtual Private Cloud. 4. Click the target VPC name and view VPC ID on the VPC details page.

Helpful Links

Why Does Communication Fail Between VPCs That Are Connected by a VPC Peering Connection?

8.5 Viewing VPC Peering Connections

Scenarios

The owners of both the local and peer accounts can view information about the created VPC peering connections and those that are still waiting to be accepted.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click VPC Peering. 5. In the displayed pane on the right, view information about the VPC peering connections. You can search for specific VPC peering connections by connection status or by name. 6. Click the VPC peering connection name. On the displayed page, view detailed information about the VPC peering connection.

8.6 Modifying a VPC Peering Connection

Scenarios

The owners of both the local and peer accounts can modify a VPC peering connection in any state. The VPC peering connection name can be changed.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click VPC Peering.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 133 Virtual Private Cloud User Guide 8 VPC Peering Connection

5. In the displayed pane on the right, view information about the VPC peering connections. You can search for specific VPC peering connections by connection status or by name. 6. Locate the target VPC peering connection and click Modify in the Operation column. In the displayed dialog box, modify information about the VPC peering connection. 7. Click OK.

8.7 Deleting a VPC Peering Connection

Scenarios

The owners of both the local and peer accounts can delete a VPC peering connection in any state. After a VPC peering connection is deleted, routes configured for the connection will be automatically deleted as well.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click VPC Peering. 5. In the displayed pane on the right, view information about the VPC peering connections. You can search for specific VPC peering connections by connection status or by name. 6. Locate the target VPC peering connection and click Delete in the Operation column. 7. Click Yes in the displayed dialog box.

8.8 Viewing Routes Configured for a VPC Peering Connection

Scenarios

After routes are added for a VPC peering connection, the owners of both the local and peer accounts can view information about the routes on the page showing details about the VPC peering connection.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click VPC Peering.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 134 Virtual Private Cloud User Guide 8 VPC Peering Connection

5. Locate the target VPC peering connection in the connection list. 6. Click the name of the VPC peering connection to switch to the page showing details about the connection. 7. On the displayed page, click the Local Routes tab and view information about the local route added for the VPC peering connection. 8. On the page showing details about the VPC peering connection, click the Peer Routes tab and view information about the peer route added for the VPC peering connection.

NO TE

If you have established a VPC peering connection but the two VPCs cannot communicate with each other, perform the preceding steps to check whether the local and peer routes are correctly configured.

8.9 Deleting a VPC Peering Route

Scenarios After routes are added for a VPC peering connection, the owners of both the local and peer accounts can delete the routes on the page showing details about the peering connection or on the Route Tables page.

NO TE

The entry to visit the route table module varies by region. ● If the route table module is not decoupled from the VPC module in your selected region, access the route table module by clicking the Route Tables tab on the VPC details page. ● If the route table module is decoupled from the VPC module in your selected region, access the route table module by clicking Route Tables in the left navigation pane of the VPC console. If you have to visit the route table module through the VPC details page in your region, see Procedure (Route Table Module Accessible from the VPC Details Page). If you can visit the route table module directly from the navigation pane in your region, see Procedure (Route Table Module Accessible from the Left Navigation Pane).

Procedure (Route Table Module Accessible from the VPC Details Page) 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click VPC Peering. 5. Locate the target VPC peering connection in the connection list. 6. Click the name of the VPC peering connection to switch to the page showing details about the connection. 7. On the displayed page, click the Local Routes tab and view information about the local route added for the VPC peering connection. 8. On the Local Routes page, locate the target local route, and click Delete in the Operation column.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 135 Virtual Private Cloud User Guide 8 VPC Peering Connection

9. Click Yes in the displayed dialog box. 10. On the page showing details about the VPC peering connection, click the Peer Routes tab and view information about the peer route added for the VPC peering connection. 11. On the Peer Routes page, locate the target peer route, and click Delete in the Operation column. 12. Click Yes in the displayed dialog box.

Procedure (Route Table Module Accessible from the Left Navigation Pane) 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose Route Tables. 5. Locate the target route table in the route table list. 6. Click the name of the target route table to go to the route table details page. 7. Locate the row that contains the route to be deleted and click Delete in the Operation column. 8. Click Yes in the displayed dialog box.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 136 Virtual Private Cloud User Guide 9 VPC Flow Log (OBT)

9 VPC Flow Log (OBT)

9.1 VPC Flow Log Overview A VPC flow log records information about the traffic going to and from a VPC. VPC flow logs help you monitor network traffic, analyze network attacks, and determine whether security group and network ACL rules require modification. VPC flow logs must be used together with the Log Tank Service (LTS). Before you create a VPC flow log, you need to create a log group and a log stream in LTS. Figure 9-1 shows the process for configuring the VPC flow log function.

Figure 9-1 Configuring the VPC flow log function

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 137 Virtual Private Cloud User Guide 9 VPC Flow Log (OBT)

The VPC flow log function itself is free of charge, but you may be charged for other resources used. For example, the storage of VPC flow log records will be charged. For details, see Log Tank Service User Guide. VPC flow logs are currently available for open beta test in regions CN East- Shanghai1, AP-Singapore, CN South-Guangzhou, and AP-Bangkok. You can try this function only after you obtain the OBT permissions.

Notes and Constraints ● Currently, only S2, M2, HC2, H2, D2, P1, G3, PI1, S3, C3, M3, H3, IR3, I3, S6, E3, C3ne, M3ne, G5, P2v, M6 and D6 ECSs are supported. For details about ECS types, see ECS Types. ● By default, you can create a maximum of 10 VPC flow logs. ● By default, a maximum of 400,000 flow log records are supported.

9.2 Creating a VPC Flow Log

Scenarios A VPC flow log records information about the traffic going to and from a VPC.

NO TE

VPC flow logs are currently available for open beta test in regions CN East-Shanghai1, AP- Singapore, CN South-Guangzhou, and AP-Bangkok. You can try this function only after you obtain the OBT permissions.

Prerequisites Ensure that the following operations have been performed on the LTS console: ● Create a log group. ● Create a log stream. For more information about the LTS service, see the Log Tank Service User Guide.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose VPC Flow Logs. 5. In the upper right corner, click Create VPC Flow Log. On the displayed page, configure parameters as prompted.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 138 Virtual Private Cloud User Guide 9 VPC Flow Log (OBT)

Table 9-1 Parameter descriptions

Parameter Description Example Value

Name The VPC flow log name. flowlog-495d The name can contain a maximum of 64 characters, which may consist of letters, digits, underscores (_), hyphens (-), and periods (.). The name cannot contain spaces.

Resource The type of resources whose traffic is to NIC Type be logged. You can select NIC, Subnet, or VPC.

Resource The specific NIC whose traffic is to be N/A logged. NOTE We recommend that you select an ECS that is in the running state. If an ECS in the stopped state is selected, restart the ECS after creating the VPC flow log for accurately recording the information about the traffic going to and from the ECS NIC.

Filter ● All traffic: specifies that both All accepted and rejected traffic of the specified resource will be logged. ● Accepted traffic: specifies that only accepted traffic of the specified resource will be logged. Accepted traffic refers to the traffic permitted by the security group or network ACL. ● Rejected traffic: specifies that only rejected traffic of the specified resource will be logged. Rejected traffic refers to the traffic denied by the network ACL.

Log Group The log group created in LTS. lts-group-wule

Log Stream The log stream created in LTS. lts-topic-wule

Description Supplementary information about the N/A VPC flow log. This parameter is optional. The VPC flow log description can contain a maximum of 255 characters and cannot contain angle brackets (< or >).

NO TE

Only two flow logs, each with a different filter, can be created for a single resource under the same log group and log stream. Each VPC flow log must be unique.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 139 Virtual Private Cloud User Guide 9 VPC Flow Log (OBT)

6. Click OK.

9.3 Viewing a VPC Flow Log

Scenarios

View information about your flow log record.

The capture window is approximately 10 minutes, which indicates that a flow log record will be generated every 10 minutes. After creating a VPC flow log, you need to wait about 10 minutes before you can view the flow log record.

NO TE

● VPC flow logs are currently available for open beta test in regions CN East-Shanghai1, AP-Singapore, CN South-Guangzhou, and AP-Bangkok. You can try this function only after you obtain the OBT permissions. ● If an ECS is in the stopped state, its flow log records will not be displayed.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose VPC Flow Logs. 5. Locate the target VPC flow log and click View Log Record in the Operation column to view information about the flow log record in LTS. The flow log record is in the following format: Example 1: The following is an example of a flow log record in which data was recorded during the capture window: 1 5f67944957444bd6bb4fe3b367de8f3d 1d515d18-1b36-47dc-a983-bd6512aed4bd 192.168.0.154 192.168.3.25 38929 53 17 1 96 1548752136 1548752736 ACCEPT OK Value 1 indicates the VPC flow log version. Traffic with a size of 96 bytes to NIC 1d515d18-1b36-47dc-a983-bd6512aed4bd during the past 10 minutes (from 16:55:36 to 17:05:36 on January 29, 2019) was allowed. A data packet was transmitted over the UDP protocol from source IP address 192.168.0.154 and port 38929 to destination IP address 192.168.3.25 and port 53. Example 2: The following is an example of a flow log record in which no data was recorded during the capture window: 1 5f67944957444bd6bb4fe3b367de8f3d 1d515d18-1b36-47dc-a983-bd6512aed4bd ------1431280876 1431280934 - NODATA Example 3: The following is an example of a flow log record in which data was skipped during the capture window: 1 5f67944957444bd6bb4fe3b367de8f3d 1d515d18-1b36-47dc-a983-bd6512aed4bd ------1431280876 1431280934 - SKIPDATA Table 9-2 describes the fields of a flow log record.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 140 Virtual Private Cloud User Guide 9 VPC Flow Log (OBT)

Table 9-2 Log field description Field Description Example Value

version Specifies the VPC flow log 1 version.

project-id Specifies the project ID. 5f67944957444bd6bb4fe3b3 67de8f3d

interface-id Specifies the ID of the NIC 1d515d18-1b36-47dc-a983- for which the traffic is bd6512aed4bd recorded.

srcaddr Specifies the source IP 192.168.0.154 address.

dstaddr Specifies the destination IP 192.168.3.25 address.

srcport Specifies the source port of 38929 the traffic.

dstport Specifies the destination 53 port of the traffic.

protocol Specifies the Internet 17 Assigned Numbers Authority (IANA) protocol number of the traffic. For details, see Assigned Numbers.

packets Specifies the number of 1 packets transferred during the capture window.

bytes Specifies the number of 96 bytes transferred during the capture window.

start Specifies the time, in Unix 1548752136 seconds, of the start of the capture window.

end Specifies the time, in Unix 1548752736 seconds, of the end of the capture window.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 141 Virtual Private Cloud User Guide 9 VPC Flow Log (OBT)

Field Description Example Value

action Specifies the action ACCEPT associated with the traffic: ● ACCEPT: The recorded traffic was allowed by the security groups or network ACLs. ● REJECT: The recorded traffic was denied by the network ACLs.

log-status Specifies the logging status OK of the VPC flow log: ● OK: Data is logging normally to the chosen destinations. ● NODATA: There was no traffic of the Filter setting to or from the NIC during the capture window. ● SKIPDATA: Some flow log records were skipped during the capture window. This may be caused by an internal capacity constraint or an internal error. Example: When Filter is set to Accepted traffic, if there is accepted traffic, the value of log-status is OK. If there is no accepted traffic, the value of log-status is NODATA regardless of whether there is rejected traffic. If some accepted traffic is abnormally skipped, the value of log- status is SKIPDATA.

You can enter a keyword on the log stream details page on the LTS console to search for flow log records.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 142 Virtual Private Cloud User Guide 9 VPC Flow Log (OBT)

9.4 Enabling or Disabling VPC Flow Log

Scenarios After a VPC flow log is created, the VPC flow log is automatically enabled. If you do not need to record traffic data, you can disable the corresponding VPC flow log. The disabled VPC flow log can be enabled again.

NO TE

VPC flow logs are currently available for open beta test in regions CN East-Shanghai1, AP- Singapore, CN South-Guangzhou, and AP-Bangkok. You can try this function only after you obtain the OBT permissions.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose VPC Flow Logs. 5. Locate the VPC flow log to be enabled or disabled, and click Enable or Disable in the Operation column. 6. Click Yes.

9.5 Deleting a VPC Flow Log

Scenarios Delete a VPC flow log that is not required. Deleting a VPC flow log will not delete the existing flow log records in LTS.

NO TE

● VPC flow logs are currently available for open beta test in regions CN East-Shanghai1, AP-Singapore, CN South-Guangzhou, and AP-Bangkok. You can try this function only after you obtain the OBT permissions. ● If a NIC that uses a VPC flow log is deleted, the flow log will be automatically deleted. However, the flow log records are not deleted.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, choose VPC Flow Logs. 5. Locate the row that contains the VPC flow log to be deleted and click Delete in the Operation column.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 143 Virtual Private Cloud User Guide 9 VPC Flow Log (OBT)

6. Click Yes in the displayed dialog box.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 144 Virtual Private Cloud User Guide 10 Virtual IP Address

10 Virtual IP Address

10.1 Virtual IP Address Overview

What Is a Virtual IP Address? A virtual IP address can be shared among multiple ECSs. An ECS can have both private and virtual IP addresses, and you can access the ECS through either IP address. A virtual IP address has the same network access capabilities as a private IP address, including layer 2 and layer 3 communication in VPCs, access between VPCs using VPC peering connections, as well as access through EIPs, VPN connections, and Direct Connect connections. A virtual IP address can be bound to multiple ECSs deployed in active/standby mode. You can bind an EIP to the virtual IP address. When the EIP is accessed from the Internet, the virtual IP address has made it possible to either the active or standby ECS, making ECSs highly fault tolerant.

Networking Virtual IP addresses are used for high availability as they make active/standby ECS switchover possible. This way if one ECS goes down for some reason, the other one can take over and services continue uninterrupted. ECSs can be configured for HA or as load balancing clusters. ● Networking mode 1: HA If you want to improve service availability and avoid single points of failure, you can deploy ECSs in the active/standby mode or deploy one active ECS and multiple standby ECSs. In this arrangement, the ECSs all use the same virtual IP address. If the active ECS becomes faulty, a standby ECS takes over services from the active ECS and services continue uninterrupted.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 145 Virtual Private Cloud User Guide 10 Virtual IP Address

Figure 10-1 Networking diagram of the HA mode

– In this configuration, a single virtual IP address is bound to two ECSs in the same subnet. – Keepalived is then used to configure the two ECSs to work in the active/ standby mode. Follow industry standards for configuring Keepalived. The details are not included here. ● Networking mode 2: HA load balancing cluster If you want to build a high-availability load balancing cluster, use Keepalived and configure LVS nodes as direct routers.

Figure 10-2 HA load balancing cluster

– Bind a single virtual IP address to two ECSs. – Configure the two ECSs as LVS nodes working as direct routers and use Keepalived to configure the nodes in the active/standby mode. The two ECSs will evenly forward requests to different backend servers. – Configure two more ECSs as backend servers. – Disable the source/destination check for the two backend servers. – Check whether the source/destination check is disabled on the active and standby LVS ECSs. For details, see Disabling Source and Destination Check (HA Load Balancing Cluster Scenario).

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 146 Virtual Private Cloud User Guide 10 Virtual IP Address

If you bind an ECS to a virtual IP address on the management console, the source/destination check is automatically disabled. If you bind an ECS to a virtual IP address by calling APIs, you need to manually disable the source/destination check. Follow industry standards for configuring Keepalived. The details are not included here.

Application Scenarios ● Accessing the virtual IP address through an EIP If your application has high availability requirements and needs to provide services through the Internet, it is recommended that you bind an EIP to a virtual IP address. ● Using a VPN, Direct Connect, or VPC peering connection to access a virtual IP address To ensure high availability and access to the Internet, use a VPN for security and Direct Connect for a stable connection. The VPC peering connection is needed so that the VPCs in the same region can communicate with each other.

Notes and Constraints ● Virtual IP addresses are not recommended when multiple NICs in the same subnet are configured on an ECS. It is too easy for there to be route conflicts on the ECS, which would cause communication failure using the virtual IP address. ● A virtual IP address can only be bound to ECSs in the same subnet. ● IP forwarding must be disabled on the standby ECS. For details, see Disabling IP Forwarding on the Standby ECS. ● The virtual IP address can use only the default security group, which cannot be changed to a custom security group. ● It is recommended that no more than eight virtual IP addresses be bound to an ECS. ● It is recommended that no more than 10 ECSs be bound to a virtual IP address. ● Virtual IP addresses and extension NICs cannot be used to directly access HUAWEI CLOUD services, such as DNS. You can use VPCEP to access these services. For details, see Buying a VPC Endpoint.

10.2 Assigning a Virtual IP Address

Scenarios If an ECS requires a virtual IP address or if a virtual IP address needs to be reserved, you can assign a virtual IP address from the subnet.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 147 Virtual Private Cloud User Guide 10 Virtual IP Address

NO TE

You can perform operations on virtual IP addresses through the subnet module. However, the entry to visit the subnet module varies by region. ● If the subnet module is not decoupled from the VPC module in your selected region, access the subnet module by clicking the Subnets tab on the VPC details page. ● If the subnet module is decoupled from the VPC module in your selected region, access the subnet module directly after you click Subnets on the navigation pane of the VPC console.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud.

If you have to visit the subnet module through the VPC details page, perform steps 4 to 7. If you can visit the subnet module directly from the navigation pane on the left, perform steps 8 to 10.

Figure 10-3 Visiting the subnet module

4. In the navigation pane on the left, click Virtual Private Cloud. 5. On the Virtual Private Cloud page, locate the VPC containing the subnet where a virtual IP address is to be assigned, and click the VPC name. 6. On the Subnets tab, click the name of the subnet where a virtual IP address is to be assigned. 7. Click the Virtual IP Addresses tab and click Assign Virtual IP Address. 8. In the navigation pane on the left, click Subnets. 9. In the subnet list, click the name of the subnet where a virtual IP address is to be assigned. 10. Click the IP Addresses tab and click Assign Virtual IP Address. 11. Select a virtual IP address assignment mode. – Automatic: The system assigns an IP address automatically. – Manual: You can specify an IP address.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 148 Virtual Private Cloud User Guide 10 Virtual IP Address

12. Select Manual and enter a virtual IP address. 13. Click OK. You can then query the assigned virtual IP address in the IP address list.

10.3 Binding a Virtual IP Address to an EIP or ECS

Scenarios You can bind a virtual IP address to an EIP so that you can access the ECSs can be deployed in active/standby mode for improve fault tolerance.

NO TE

You can perform operations on virtual IP addresses through the subnet module. However, the entry to visit the subnet module varies by region. ● If the subnet module is not decoupled from the VPC module in your selected region, access the subnet module by clicking the Subnets tab on the VPC details page. ● If the subnet module is decoupled from the VPC module in your selected region, access the subnet module directly after you click Subnets on the navigation pane of the VPC console.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. If you have to visit the subnet module through the VPC details page, perform steps 4 to 7. If you can visit the subnet module directly from the navigation pane on the left, perform steps 8 to 10.

Figure 10-4 Visiting the subnet module

4. In the navigation pane on the left, click Virtual Private Cloud. 5. On the Virtual Private Cloud page, locate the VPC containing the virtual IP address and click the VPC name.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 149 Virtual Private Cloud User Guide 10 Virtual IP Address

6. On the Subnets tab, click the name of the subnet that the virtual IP address belongs to. 7. Click the Virtual IP Addresses tab, locate the row that contains the virtual IP address to be bound to an EIP or ECS, and choose Bind to EIP or Bind to Server in the Operation column. 8. In the navigation pane on the left, click Subnets. 9. In the subnet list, click the name of the subnet that the virtual IP address belongs to. 10. Click the IP Addresses tab, locate the row that contains the target virtual IP address, and click Bind to EIP or Bind to Server in the Operation column. 11. Select the desired EIP, or ECS and its NIC.

NO TE

● If the ECS has multiple NICs, bind the virtual IP address to the primary NIC. ● Multiple virtual IP addresses can be bound to an ECS NIC. 12. Click OK. 13. Manually configure a virtual IP address for an ECS that has been bound with the virtual IP address. After a virtual IP address is bound to an ECS NIC, you need to manually configure the virtual IP address on the ECS. Linux ECS (CentOS 7.2 64-bit is used as an example here.) a. Run the following command to check the NIC to which the virtual IP address is to be bound and the NIC connection: nmcli connection

Figure 10-5 Checking the NIC and its connection

In the preceding command output, eth0 in the DEVICE column indicates the NIC to which the virtual IP address is bound, and System eth0 in the NAME column indicates the corresponding connection. b. Run the following command to modify the corresponding connection and add the virtual IP address: nmcli connection modify "CONNECTION" ipv4.addresses VIP

Figure 10-6 Configuring virtual IP address

c. Restart the ECS and run the ip address command to check whether the virtual IP address has been configured.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 150 Virtual Private Cloud User Guide 10 Virtual IP Address

Figure 10-7 Checking whether the virtual IP address has been configured

In the preceding command output, 192.168.1.137 is the virtual IP address. Windows ECS (Windows 7 is used as an example here.) a. Choose Control Panel > Network and Internet > Network Connections. Right-click the corresponding local connection and then click Properties. b. On the Network tab page, select Internet Protocol Version 4 (TCP/ IPv4). c. Click Properties. d. Select Use the following IP address and set IP address to the private IP address of the ECS, for example, 192.168.10.41.

Figure 10-8 Configuring private IP address

e. Click Advanced. f. On the IP Settings tab, click Add in the IP addresses area. Add the virtual IP address. For example, 192.168.10.137.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 151 Virtual Private Cloud User Guide 10 Virtual IP Address

Figure 10-9 Configuring virtual IP address

g. Click OK. h. In the Start menu, open the Windows command line window and run the following command to check whether the virtual IP address has been configured: ipconfig /all

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 152 Virtual Private Cloud User Guide 10 Virtual IP Address

Figure 10-10 Checking whether the virtual IP address has been configured

In the preceding command output, IPv4 Address is the virtual IP address 192.168.10.137, indicating that the virtual IP address of the ECS NIC has been correctly configured.

Helpful Links ● Why Cannot the Virtual IP Address Be Pinged After It Is Bound to an ECS NIC? ● What Are the Differences Between EIP, Private IP Address, Floating IP Address, and Virtual IP Address?

10.4 Using an EIP to Access a Virtual IP Address

Prerequisites ● You have configured the ECS networking based on Networking and ensure that the ECS has been bound with a virtual IP address. ● You have assigned an EIP.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Elastic IP. 4. Locate the row that contains the EIP to be bound to the virtual IP address, and click Bind in the Operation column.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 153 Virtual Private Cloud User Guide 10 Virtual IP Address

5. Select the target virtual IP address and click OK.

10.5 Using a VPN to Access a Virtual IP Address

Procedure 1. Configure the ECS networking based on Networking. 2. Create a VPN. The VPN can be used to access the virtual IP address of the ECS.

10.6 Using a Direct Connect Connection to Access the Virtual IP Address

Procedure 1. Configure the ECS networking based on Networking. 2. Create a Direct Connect connection. The created Direct Connect connection can be used to access the virtual IP address of the ECS.

10.7 Using a VPC Peering Connection to Access the Virtual IP Address

Procedure 1. Configure the ECS networking based on Networking. 2. Create a VPC peering connection. The VPC peering connection can be used to access the virtual IP address of the ECS.

10.8 Disabling IP Forwarding on the Standby ECS For a Linux ECS: 1. Log in to standby ECS and run the following command to check whether the IP forwarding is enabled: cat /proc/sys/net/ipv4/ip_forward In the command output, 1 indicates it is enabled, and 0 indicates it is disabled. The default value is 0. – If the command output is 1, perform 2 and 3 to disable IP forwarding. – If the command output is 0, no further action is required. 2. Use the vi editor to open the /etc/sysctl.conf file, change the value of net.ipv4.ip_forward to 0, and enter :wq to save the change and exit. You can

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 154 Virtual Private Cloud User Guide 10 Virtual IP Address

also use the sed command to modify the configuration. A command example is as follows: sed -i '/net.ipv4.ip_forward/s/1/0/g' /etc/sysctl.conf 3. Run the following command to make the change take effect: sysctl -p /etc/sysctl.conf For a Windows ECS: 1. Click Start, scroll down and expand the Windows System folder, click Command Prompt, and run the following command: ipconfig /all In the command output, if the value of IP Routing Enabled is No, the IP forwarding function is disabled. 2. Press Windows and R keys together to open the Run box, and enter regedit to open the Registry Editor. 3. Set the value of IPEnableRouter under HKEY_LOCAL_MACHINE\SYSTEM \CurrentControlSet\Services\Tcpip\Parameters to 0. – If the value is set to 0, IP forwarding will be disabled. – If the value is set to 1, IP forwarding will be enabled.

10.9 Disabling Source and Destination Check (HA Load Balancing Cluster Scenario) 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. Under Computing, click Elastic Cloud Server. 4. In the ECS list, click the ECS name. 5. On the displayed ECS details page, click the NICs tab. 6. Check that Source/Destination Check is disabled.

Figure 10-11 Disabling source/destination check

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 155 Virtual Private Cloud User Guide 10 Virtual IP Address

10.10 Releasing a Virtual IP Address

Scenarios If you no longer need a virtual IP address or a reserved virtual IP address, you can release it to avoid wasting resources.

NO TE

You can perform operations on virtual IP addresses through the subnet module. However, the entry to visit the subnet module varies by region. ● If the subnet module is not decoupled from the VPC module in your selected region, access the subnet module by clicking the Subnets tab on the VPC details page. ● If the subnet module is decoupled from the VPC module in your selected region, access the subnet module directly after you click Subnets on the navigation pane of the VPC console.

Prerequisites Before deleting a virtual IP address, ensure that the virtual IP address has been unbound from the following resources:

● ECS ● EIP

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud.

If you have to visit the subnet module through the VPC details page, perform steps 4 to 7. If you can visit the subnet module directly from the navigation pane on the left, perform steps 8 to 10.

Figure 10-12 Visiting the subnet module

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 156 Virtual Private Cloud User Guide 10 Virtual IP Address

4. In the navigation pane on the left, click Virtual Private Cloud. 5. On the Virtual Private Cloud page, locate the VPC containing the subnet from which a virtual IP address is to be released, and click the VPC name. 6. On the Subnets tab, click the name of the subnet from which a virtual IP address is to be released. 7. Click the Virtual IP Addresses tab, locate the row that contains the virtual IP address to be released, click More in the Operation column, and select Release. 8. In the navigation pane on the left, click Subnets. 9. In the subnet list, click the name of the subnet that the virtual IP address belongs to. 10. Click the IP Addresses tab, locate the row that contains the virtual IP address to be released, click More in the Operation column, and select Release.

Figure 10-13 Releasing a virtual IP address

11. Click Yes in the displayed dialog box.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 157 Virtual Private Cloud User Guide 11 Layer 2 Connection Gateway (OBT)

11 Layer 2 Connection Gateway (OBT)

11.1 L2CG Overview

L2CG A Layer 2 connection gateway (L2CG) is a virtual tunnel gateway that works with a Direct Connect or VPN connection to establish network communication between cloud and on-premises networks. The gateway allows you to migrate data center or private cloud services to the cloud without changing subnets and IP addresses. A Direct Connect or VPN connection establishes a Layer 3 network tunnel between cloud andon-premises networks, but the subnets on the cloud and on-premises networks must not overlap. If the cloud and on-premises networks are on the same subnet and need to communicate with each other, you can use a L2CG to enable the communication at a Layer 2 network. Figure 11-1 shows the networking diagram of a L2CG.

Figure 11-1 L2CG networking

A L2CG is a tunnel gateway of a VPC and corresponds to a tunnel gateway of your data center. A L2CG can work together with a Direct Connect or VPN connection to establish a Layer 2 network between a VPC and your data center. A Layer 2 connection connects a VPC subnet to a L2CG and specifies the L2CG to connect to the tunnel gateway in an enterprise data center. This enables the VPC subnet to communicate with the subnet in the enterprise data center at the Layer 2 network.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 158 Virtual Private Cloud User Guide 11 Layer 2 Connection Gateway (OBT)

L2CGs are currently available for open beta test in LA-Santiago. You can use this function after obtaining the open beta test permissions.

L2CG Configuration Process

Figure 11-2 L2CG configuration process

1. Create a Direct Connect or VPN connection. Create a Direct Connect or VPN connection to enable cloud and on-premises communication at the Layer 3 network. For details, see Direct Connect or Virtual Private Network User Guide. 2. Buy a L2CG. Specify a VPC and a local subnet of a Direct Connect or VPN connection to create a L2CG and assign a local tunnel IP address. 3. Create a Layer 2 connection. Specify a subnet on the cloud and a tunnel IP address on your data center side to create a Layer 2 connection. 4. Configure a tunnel in your data center. Configure a VXLAN tunnel on the gateway in your data center.

Application Scenario A L2CG establishes a Layer 2 network between an on-premises data center and a VPC, helping you seamlessly migrate services to the cloud.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 159 Virtual Private Cloud User Guide 11 Layer 2 Connection Gateway (OBT)

● You can migrate your services to the cloud without changing IP addresses, reducing service awareness and accelerating migration. ● Your data center and a VPC can communicate at a Layer 2 network. A virtual IP address allows the cloud-based and on-premises networks to back each other up, coping with single points of failures (SPOFs) and forming a hybrid cloud networking. ● You can migrate service systems to the cloud using the gray mode. You can seamlessly migrate core services to the cloud in batches. VM-based migration is supported to prevent adverse services.

Notes and Constraints ● By default, each account can create a maximum of five L2CGs. (Only one L2CG can be created during the OBT.) To request a quota increase, submit a service ticket. ● A L2CG requires a Direct Connect or VPN connection. Therefore, you need to create a Direct Connect or VPN connection first. ● A VXLAN tunnel is required between a L2CG and your data center. The switch of your data center must support the VXLAN tunnel. ● You can attach a VPC to multiple L2CGs. However, you can attach each L2CG to only one VPC. ● Each L2CG supports a maximum of six Layer 2 connections to connect cloud and on-premises networks. ● The remote tunnel VNI and tunnel IP address of each Layer 2 connection using the same L2CG must be unique. ● A subnet that has been associated with a Layer 2 connection cannot be used by any other Layer 2 connection or L2CG. ● You cannot modify or delete L2CGs and Layer 2 connections whose status is creating, deleting, or modifying. ● You cannot forward unknown unicast, broadcast, and multicast (except VRRP) IP packets from your data center to the cloud. ● The used IP addresses (except the subnet gateway IP address) on and off the cloud cannot conflict with each other. ● On-premises servers cannot use VPC peering connections, load balancers, route tables, and NAT gateways on the cloud. ● Each Layer 2 connection of a L2CG requires two IP addresses (interface IP address and tunnel IP address) in the Layer 2 subnet. The two IP addresses must be different from the used IP addresses of your data center. ● Each L2CG requires three IP addresses in the tunnel subnet.

11.2 Buying a L2CG

Scenarios

To enable Layer 2 communications between a VPC and your data center, you need to buy a L2CG.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 160 Virtual Private Cloud User Guide 11 Layer 2 Connection Gateway (OBT)

NO TE

L2CGs are currently available for open beta test in LA-Santiago. You can use this function after obtaining the open beta test permissions.

Prerequisites ● You have created the VPC and subnet that the L2CG is to be attached to. ● The VPC has been attached to a Direct Connect virtual gateway or VPN gateway. (This is not mandatory if Tunnel Connection is set to Custom.)

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Layer 2 Connection Gateway. 5. On the displayed page, click Buy.

Figure 11-3 Buy Layer 2 Connection Gateway

6. Set the parameters as prompted. For details, see Table 11-1.

Table 11-1 Parameter descriptions Parameter Description Example Value

Billing L2CGs are billed based on a pay-per-use basis. Pay-per-use Mode

Region Specifies the region where the L2CG belongs. CN North- Beijing1

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 161 Virtual Private Cloud User Guide 11 Layer 2 Connection Gateway (OBT)

Parameter Description Example Value

Active AZ Specifies the AZ where the active L2CG is AZ1 located. An active AZ carries traffic. Select the AZ in which the ECS on the cloud is deployed to ensure quick and uninterrupted access to the ECS.

Standby AZ Specifies the AZ where the standby L2CG is AZ2 located. A standby AZ is used for backup and disaster recovery. It is recommended that the standby AZ be different from the active AZ.

Type Specifies the type of the L2CG. Enhanced There are three types, including basic, standard, and enhanced. (Only enhanced L2CGs are available during the OBT.)

Tunnel Specifies the connection used to connect a Direct Connection L2CG to a data center. The value can be Connect Direct Connect.

Connection Select a virtual gateway if you set Tunnel vgw-01 Gateway Connection to Direct Connect.

VPC Specifies the VPC that the L2CG is to be vpc-01 attached to.

Tunnel Specifies the subnet of the VPC that the L2CG subnet-01 Subnet is to be attached to. The subnet communicates with an on- premises network using a Direct Connect connection.

Tunnel IP Specifies an IP address in the tunnel subnet, Automatical Address which can be automatically assigned or ly assign manually specified.

Name Specifies the L2CG name. l2cg-01 The name is a string of no more than 64 characters that can contain letters, digits, underscores (_), and hyphens (-).

Description Provides supplementary information about the - L2CG. The description can contain a maximum of 255 characters.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 162 Virtual Private Cloud User Guide 11 Layer 2 Connection Gateway (OBT)

After the preceding parameters are set, the L2CG price will be displayed. You can click Pricing Details on the page to view details. 7. Click Next. On the displayed page, you can check the L2CG information. 8. Click Submit. This operation takes 3 to 6 minutes to complete. 9. View the status on the Layer 2 Connection Gateway page. If the status is Running, the L2CG is created.

11.3 Viewing a L2CG

Scenarios

After a L2CG is created, you can view its details.

NO TE

L2CGs are currently available for open beta test in LA-Santiago. You can use this function after obtaining the open beta test permissions.

Prerequisites

A L2CG has been created successfully.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Layer 2 Connection Gateway. 5. On the displayed page, click the name of the target L2CG to view its details.

11.4 Modifying a L2CG

Scenarios

After a L2CG is created, you can modify its name or description.

NO TE

L2CGs are currently available for open beta test in LA-Santiago. You can use this function after obtaining the open beta test permissions.

Prerequisites

A L2CG has been created successfully.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 163 Virtual Private Cloud User Guide 11 Layer 2 Connection Gateway (OBT)

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Layer 2 Connection Gateway. 5. On the displayed page, click the name of the target L2CG.

6. On the Layer 2 Connection Gateway page, click next to the target parameter. 7. Modify the name or description of the L2CG as prompted.

8. Click .

11.5 Deleting a L2CG

Scenarios You can delete L2CGs to release resources or save costs.

NO TE

L2CGs are currently available for open beta test in LA-Santiago. You can use this function after obtaining the open beta test permissions.

Prerequisites Layer 2 connections created for the L2CG to be deleted are not in the connecting or deleting status.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Layer 2 Connection Gateway. 5. On the displayed page, click the name of the target L2CG. 6. In the upper right corner of the L2CG details page, click Delete. 7. In the displayed dialog box, click Yes. This operation takes 10 to 30 seconds to complete.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 164 Virtual Private Cloud User Guide 11 Layer 2 Connection Gateway (OBT)

11.6 Creating a Layer 2 Connection

Scenarios

To enable Layer 2 communications between ECSs in a VPC and your data center subnet, you need to create a Layer 2 connection for your L2CG.

NO TE

L2CGs are currently available for open beta test in LA-Santiago. You can use this function after obtaining the open beta test permissions.

Prerequisites

A L2CG has been created successfully.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Layer 2 Connection Gateway. 5. On the displayed page, click the name of the target L2CG. 6. On the right of the Layer 2 Connection Gateway page, click Create Connection.

Figure 11-4 Create Connection

7. Set the parameters as prompted. For details, see Table 11-2.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 165 Virtual Private Cloud User Guide 11 Layer 2 Connection Gateway (OBT)

Table 11-2 Parameter descriptions

Parameter Description Example Value

Layer 2 The L2CG name. l2cg-01 Connection Gateway

VPC The VPC that the L2CG is to be attached vpc-01 to.

Layer 2 The subnet used for communication subnet-01 Connection between the cloud and data center at a Subnet Layer 2 network.

Interface IP The IP address of L2CG interface that the Automatical Address VPC subnet is connected to. The IP ly assign address can be automatically assigned or manually specified.

Remot Tunnel The VXLAN tunnel ID required by a data - e VNI center to connect to a L2CG, similar to Access the VLAN network identifier, which is Inform used to uniquely identify the VXLAN ation Tunnel The IP address of the VXLAN tunnel for - IP the data center to connect to the L2CG. Addres s

Tunnel The port of the VXLAN tunnel for the 4789 Port data center to connect to the L2CG. The default port is 4789.

Name The Layer 2 connection name. l2conn-01

8. After confirming that the parameters are correct, click Create. This operation takes 20 to 60 seconds to complete. 9. View the connection status on the Layer 2 Connection Gateway page. If the status is Not connected or Connected, the Layer 2 connection has been successfully created.

11.7 Viewing a Layer 2 Connection

Scenarios

After a Layer 2 connection is created, you can view details about the connection.

NO TE

L2CGs are currently available for open beta test in LA-Santiago. You can use this function after obtaining the open beta test permissions.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 166 Virtual Private Cloud User Guide 11 Layer 2 Connection Gateway (OBT)

Prerequisites A Layer 2 connection has been created successfully.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Layer 2 Connection Gateway. 5. On the displayed page, click the name of the target L2CG. 6. On the Layer 2 Connection Topology page, click the Layer 2 connection to be viewed.

11.8 Deleting a Layer 2 Connection

Scenarios You can delete a Layer 2 connection if it is not needed any more.

NO TE

L2CGs are currently available for open beta test in LA-Santiago. You can use this function after obtaining the open beta test permissions.

Prerequisites Layer 2 connections to be deleted are not in the connecting or deleting status.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Networking, click Virtual Private Cloud. 4. In the navigation pane on the left, click Layer 2 Connection Gateway. 5. On the displayed page, click the name of the target L2CG. 6. On the Layer 2 Connection Topology page, click the Layer 2 connection to be deleted and click Delete Connection. 7. In the displayed dialog box, click Yes. This operation takes 10 to 30 seconds to complete.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 167 Virtual Private Cloud User Guide 11 Layer 2 Connection Gateway (OBT)

11.9 Configuring a Tunnel Gateway in Your Data Center

Scenarios This section describes how to configure tunnels on VXLAN tunnel switches in an on-premises data center. This section provides configuration references for common networking scenarios in your data center. Huawei CE6850 series switches are used as an example.

NO TE

L2CGs are currently available for open beta test in LA-Santiago. You can use this function after obtaining the open beta test permissions.

Procedure Scenario: Layer 2 subnet gateway and VXLAN tunnel on different switches In the following example, the tunnel IP address on the cloud is 10.0.6.3, the IP address of the tunnel switch in the on-premises data center is 2.2.2.2, and the tunnel VNI is 5010. To configure the tunnel gateway of your data center, configure the tunnel switch to divert the traffic of the VLAN corresponding to the Layer 2 subnet to the tunnel.

Figure 11-5 Layer 2 subnet gateway and VXLAN tunnel on different switches

1. Log in to the tunnel switch and run the system-view command to switch to the system view. 2. Switch the loopback 0 interface view and configure the tunnel IP address. Configuration example: interface loopback 0 ip address 2.2.2.2 255.255.255.255

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 168 Virtual Private Cloud User Guide 11 Layer 2 Connection Gateway (OBT)

3. Run the quit command to exit the interface view and return to the system view. 4. Switch to the bridge domain (BD) view and configure the VXLAN VNI for the BD. Configuration example: bridge-domain 10 vxlan vni 5010 5. Run the quit command to exit the BD view and return to the system view. 6. Create a Layer 2 sub-interface and use the sub-interface to divert traffic from the VLAN of the specific Layer 2 network to the tunnel. Configuration example: interface 10ge 1/0/2.1 mode l2 encapsulation dot1q vid 100 bridge-domain 10 7. Run the interface nve command to create an NVE interface, switch to the NVE interface view, and configure the IP address (2.2.2.2) for the source VTEP of the VXLAN tunnel. Configuration example: interface nve1 source 2.2.2.2 8. Run the vni command in the NVE interface view to configure an ingress replication list for VNI 5010. Configuration example: vni 5010 head-end peer-list 10.0.6.3 9. Run the following command in the system view to check the VXLAN configuration. display vxlan vni 5010 verbose

Figure 11-6 VXLAN configuration status

If the value of State is up, the tunnel status is normal. To check more configurations, see the product documentation of the corresponding switch model.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 169 Virtual Private Cloud User Guide 12 Monitoring

12 Monitoring

12.1 Supported Metrics

Description This section describes the namespace, list, and measurement dimensions of EIP and bandwidth metrics that you can check on Cloud Eye. You can use APIs or the Cloud Eye console to query the metrics of the monitored metrics and alarms generated for EIPs and bandwidths.

Namespace SYS.VPC

Monitoring Metrics

Table 12-1 EIP and bandwidth metrics Metric Metri Description Value Measurement Monitoring c Range Object & Interval Name Dimension (Raw Data)

upstream Outbo Network rate ≥ 0 Object: 1 minute _bandwid und of outbound bit/s Bandwidth or th Band traffic EIP width (Previously Dimensiona: called "Upstream bandwidth_id, Bandwidth") publicip_id Unit: bit/s

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 170 Virtual Private Cloud User Guide 12 Monitoring

Metric Metri Description Value Measurement Monitoring c Range Object & Interval Name Dimension (Raw Data)

downstre Inbou Network rate ≥ 0 Object: 1 minute am_band nd of inbound bit/s Bandwidth or width Band traffic EIP width (Previously Dimension: called "Downstream bandwidth_id, Bandwidth") publicip_id Unit: bit/s

upstream Outbo Usage of 0% to Object: 1 minute _bandwid und outbound 100% Bandwidth or th_usage Band bandwidth in EIP width the unit of Dimension: Usage percent. bandwidth_id, publicip_id

up_strea Outbo Network traffic ≥ 0 Object: 1 minute m und going out of bytes Bandwidth or Traffic the cloud EIP platform Dimension: (Previously called bandwidth_id, "Upstream publicip_id Traffic") Unit: byte

down_str Inbou Network traffic ≥ 0 Object: 1 minute eam nd going into the bytes Bandwidth or Traffic cloud platform EIP (Previously Dimension: called "Downstream bandwidth_id, Traffic") publicip_id Unit: byte

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 171 Virtual Private Cloud User Guide 12 Monitoring

Metric Metri Description Value Measurement Monitoring c Range Object & Interval Name Dimension (Raw Data)

a: If a service has multiple dimensions, all dimensions are mandatory when you use APIs to query the metrics. ● Query a monitoring metric: dim.0=bandwidth_id,530cd6b0-86d7-4818-837f-935f6a27414d&dim. 1=publicip_id,3773b058-5b4f-4366-9035-9bbd9964714a ● Query monitoring metrics in batches: "dimensions": [ { "name": "bandwidth_id", "value": "530cd6b0-86d7-4818-837f-935f6a27414d" } { "name": "publicip_id", "value": "3773b058-5b4f-4366-9035-9bbd9964714a" } ],

Dimensions Key Value

publicip_id EIP ID

bandwidth_id Bandwidth ID

12.2 Viewing Metrics

Scenarios View related metrics to see bandwidth and EIP usage information.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Management & Deployment, click Cloud Eye. 4. Click Cloud Service Monitoring on the left of the page, and choose Elastic IP and Bandwidth.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 172 Virtual Private Cloud User Guide 12 Monitoring

5. Locate the row that contains the target bandwidth or EIP and click View Metric in the Operation column to check the bandwidth or EIP monitoring information. You can view data during the last one, three, or twelve hours.

12.3 Creating an Alarm Rule

Scenarios You can configure alarm rules to customize the monitored objects and notification policies. You can learn your resource statuses at any time.

Procedure 1. Log in to the management console.

2. Click in the upper left corner and select the desired region and project. 3. On the console homepage, under Management & Deployment, click Cloud Eye. 4. In the left navigation pane on the left, choose Alarm Management > Alarm Rules. 5. On the Alarm Rules page, click Create Alarm Rule and set required parameters to create an alarm rule, or modify an existing alarm rule. 6. After the parameters are set, click Create. After the alarm rule is created, the system automatically notifies you if an alarm is triggered for the VPC service.

NO TE

For more information about VPC alarm rules, see the Cloud Eye User Guide.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 173 Virtual Private Cloud User Guide A Change History

A Change History

Release Date What's New

2021-05-20 This issue is the thirty-first official release, which incorporates the following changes: Added FAQ "Why Am I Stilled Be Billed After All VPCs Are Deleted?"

2021-03-24 This issue is the thirtieth official release, which incorporates the following changes: ● Added "Network Service Overview" in section "Service Overview". ● Added FAQ "Why Cannot I Access Websites Using IPv6 Addresses After IPv4/IPv6 Dual Stack Is Configured?"

2021-03-01 This issue is the twenty-ninth official release, which incorporates the following changes: Added sections "Adding a Secondary CIDR Block to a VPC" and "Removing a Secondary CIDR Block from a VPC".

2020-12-17 This issue is the twenty-eighth official release, which incorporates the following changes: ● Added restrictions in section "Notes and Constraints". ● Added a figure to illustrate the VPC peering connection.

2020-11-03 This issue is the twenty-seventh official release, which incorporates the following changes: ● Adjusted sections under VPC and Subnet. ● Added "Denying Access from a Specific IP Address" to section "Network ACL". ● Deleted FAQ "Will the EIP Bound to an ECS Be Changed After the ECS Is Stopped and Then Started?"

2020-10-23 This issue is the twenty-sixth official release, which incorporates the following change: Optimized sections under "Security Group".

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 174 Virtual Private Cloud User Guide A Change History

Release Date What's New

2020-09-18 This issue is the twenty-fifth official release, which incorporates the following changes: ● Modified the steps in section "Changing the Security Group of an ECS". ● Added the L2CG function.

2020-09-07 This issue is the twenty-fourth official release, which incorporates the following changes: ● Added FAQ "What Should I Do If My Security Group Rules Do Not Take Effect?" ● Deleted FAQ "How Do I Handle the VPC Peering Connection Failure?" ● Modified FAQ "Why Does Communication Fail Between VPCs That Are Connected by a VPC Peering Connection?" ● Modified FAQ "Why Cannot the Virtual IP Address Be Pinged After It Is Bound to an ECS NIC?"

2019-07-23 This issue is the twenty-third official release, which incorporates the following change: Added parameter IP address group to security group sections and added section "IP Address Group".

2020-06-09 This issue is the twenty-second official release, which incorporates the following changes: ● Added FAQ "Why Can't I Ping an ECS with Two NICs Configured?" ● Added IPv4/IPv6 dual stack function.

2020-05-20 This issue is the twenty-first official release, which incorporates the following changes: ● Added FAQ "Why Does My Server Can Be Accessed from the Internet But Cannot Access the Internet?" ● Added section "Cloning a Security Group". ● Modified FAQ "How Can I Delete a Subnet That Is Being Used by Other Resources?"

2020-04-15 This issue is the twentieth official release, which incorporates the following changes: ● Added FAQ "Can an EIP Be Bound to a Cloud Resource in Another Region?" ● Added FAQ "How Do I Query the Region of My EIPs?" ● Added FAQ "Can I Transfer an EIP to Another Account?" ● Added FAQ "Can I Assign a Specific EIP?" ● Added FAQ "Will an EIP Be Changed After I Assign It?" ● Added FAQ "How Do I Change an EIP for an Instance?" ● Added FAQ "How Do I Switch to a Private DNS Server?"

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 175 Virtual Private Cloud User Guide A Change History

Release Date What's New

2020-03-30 This issue is the nineteenth official release, which incorporates the following changes: ● Added basic information to sections "Security Group Overview" and "Network ACL Overview". ● Added FAQ "Does a Security Group Rule or a Network ACL Rule Immediately Take Effect for Its Original Traffic After It Is Modified?" ● Added section "Billing". ● Added category "Billing and Payments" to FAQs.

2020-03-20 This issue is the eighteenth official release, which incorporates the following change: Deleted FAQ "Which Security Group Rule Has Priority When Multiple Security Group Rules Conflict?"

2020-02-18 This issue is the seventeenth official release, which incorporates the following changes: ● Added FAQ "How Is an EIP Charged?" ● Optimized FAQ "Can I Bind One EIP to Multiple ECSs?"

2019-12-23 This issue is the sixteenth official release, which incorporates the following changes: Updated the document based on the navigation path and function changes of Subnets and Route Tables.

2019-12-03 This issue is the fifteenth official release, which incorporates the following change: Optimized description and figures in section "Service Overview".

2019-11-20 This issue is the fourteenth official release, which incorporates the following changes: ● Added FAQ "What Is the EIP Assignment Policy?" ● Added FAQ "What Are the Differences Between Static BGP and Dynamic BGP?"

2019-10-15 This issue is the thirteenth official release, which incorporates the following changes: ● Added section "VPC Flow Log (OBT)". ● Updated the screenshots of adding security group rules. ● Added FAQ "Why Is Access from a Specific IP Address Still Allowed After a Network ACL Rule That Denies the Access from the IP Address Has Been Added?"

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 176 Virtual Private Cloud User Guide A Change History

Release Date What's New

2019-10-09 This issue is the twelfth official release, which incorporates the following changes: ● Added FAQ "Can I Bind an EIP to an ECS, to Another ECS?" ● Added FAQ "Will the EIP Bound to an ECS Be Changed After the ECS Is Stopped and Then Started?"

2019-09-26 This issue is the eleventh official release, which incorporates the following changes: ● Optimized the sections in "VPC Peering Connection". ● Added section "Common Ports Used by ECSs". ● Added FAQ "Why Are Some Ports in the Public Cloud Inaccessible?"

2019-09-12 This issue is the tenth official release, which incorporates the following changes: ● Deleted section "Deleting a VPN". ● Added FAQ "What Is the Relationship Between Bandwidth and Upload or Download Rate?" ● Added content to FAQ "What Are the Restrictions on Deleting a Security Group?"

2019-08-15 This issue is the ninth official release, which incorporates the following changes: ● Added the example of allowing external access to a specified port in the section "Security Group Configuration Examples". ● Added billing information in section "Modifying EIP Bandwidth". ● Added FAQ "How Do I Change the Billing Mode?" ● Added FAQ "How Do I Change the Bandwidth Billing Option from Bandwidth to Traffic or from Traffic to Bandwidth?" ● Added FAQ "Can I Increase My Yearly/Monthly Bandwidth Size and Then Decrease It?"

2019-02-28 This issue is the eighth official release, which incorporates the following change: ● Added section Shared Data Package.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 177 Virtual Private Cloud User Guide A Change History

Release Date What's New

2018-12-30 This issue is the seventh official release, which incorporates the following changes: ● Modified the description about how to switch to the security group, network ACL, EIP, and shared bandwidth pages based on the changes made on the management console. ● Added section "Network ACL Overview". ● Added section "Network ACL Configuration Examples".

2018-11-30 This issue is the sixth official release, which incorporates the following changes: ● Updated the document based on changes made to the network ACL GUI. – Added description about how to delete multiple network ACL rules at a time and how to disassociate multiple subnets from a network ACL at a time. – Changed parameter Any to All. ● Modified FAQ "Why Does My ECS Fail to Obtain an IP Address?"

2018-09-30 This issue is the fifth official release, which incorporates the following changes: ● Added description about how to create multiple subnets at a time to section "Creating a VPC". ● Added description about how to add multiple network ACL rules at a time and parameter Description to section "Adding a Network ACL Rule".

2018-08-15 This issue is the fourth official release, which incorporates the following changes: ● Added sections under "Shared Bandwidth". ● Optimized sections under "Service Overview." ● Optimized sections under "Security Group".

2018-05-30 This issue is the third official release, which incorporates the following changes: ● Added section "Monitoring". ● Optimized the words on button labels to ensure consistency.

2018-04-28 This issue is the second official release, which incorporates the following changes: ● Added section Exporting VPC Information. ● Modified EIP description.

2017-12-31 This issue is the first official release.

Issue 31 (2021-05-20) Copyright © Huawei Technologies Co., Ltd. 178