Updated on 2024-06-27 GMT+08:00

Overview

Scenario

There are four VPCs in region A on Huawei Cloud. VPC 1, VPC 2, and VPC 3 need to communicate with each other, and share an EIP through an SNAT rule of a NAT gateway in VPC 4 to access the Internet.

Figure 1 VPCs sharing an EIP through an SNAT rule

You can share an enterprise router with different accounts to attach VPCs of these accounts to the same enterprise router for communications.

Operation Procedure

Figure 2 shows the procedure for using an enterprise router and a NAT gateway to allow VPCs in the same region to share an EIP to access the Internet.

Figure 2 Flowchart for enabling VPCs in the same region to share an EIP to access the Internet
Table 1 Steps for enabling VPCs in the same region to share an EIP to access the Internet

No.

Procedure

Description

1

Network and Resource Planning

Plan required CIDR blocks and the number of resources.

2

Creating Resources

  1. Create an enterprise router.
  2. Create four VPCs and three ECSs. One of the VPCs will be used to host a NAT gateway
  3. Assign an EIP and create a public NAT gateway in VPC 4.

3

Configuring Networks

  1. Create VPC attachments for the enterprise router:
    1. Attach the four VPCs to the enterprise router.
    2. In the route tables of the VPCs, add routes for traffic to route through the enterprise router.
  2. Add SNAT rules for the VPCs to the NAT gateway.

4

Verifying Network Connectivity

Log in to an ECS and run the ping command to verify the network connectivity.