Updated on 2024-01-16 GMT+08:00

Planning Networks and Resources

To attach both Direct Connect and VPN connections to an enterprise router to allow them to work in an active/standby pair, you need to:
  • Network Planning: Plan CIDR blocks of VPCs and their subnets, Direct Connect connection, VPN connection, enterprise router, and routes.
  • Resource Planning: Plan the quantity, names, and other parameters of cloud resources, including VPCs, Direct Connect connection, VPN connection, and enterprise router.

Network Planning

Figure 1 shows the network diagram of Direct Connect and VPN connections that work in an active/standby pair. Table 2 describes the network planning.

Figure 1 Network diagram of Direct Connect and VPN connections working in an active/standby pair
Direct Connect and VPN connections work in an active/standby pair. If the Direct Connect connection is normal, it is preferentially selected for traffic forwarding.
  • Only preferred routes are displayed in the enterprise router route table. The routes of a virtual gateway attachment have a higher priority than those of a VPN gateway attachment. Therefore, routes of the VPN gateway attachment will not be displayed in the route table.
  • By default, the Direct Connect connection is used for communications between the VPCs and on-premises data center. Table 1 shows the details about the traffic flows in this example.
Table 1 Network traffic flows

Path

Description

Request traffic: from VPC 1 to the on-premises data center

  1. The route table of VPC 1 has routes with the next hop set to the enterprise router to forward traffic from VPC 1 to the enterprise router.
  2. The route table of the enterprise router has a route with the next hop set to the virtual gateway attachment to forward traffic from the enterprise router to the virtual gateway.
  3. The virtual gateway is associated with the virtual interface. Traffic from the virtual gateway is forwarded to the physical connection through the remote gateway of the virtual interface.
  4. Traffic is sent to the on-premises data center over the connection.

Response traffic: from the on-premises data center to VPC 1

  1. Traffic is forwarded to the virtual interface through the connection.
  2. The virtual interface is connected to the virtual gateway. Traffic from the virtual interface is forwarded to the virtual gateway through the local gateway of the virtual interface.
  3. Traffic is forwarded from the virtual gateway to the enterprise router.
  4. The route table of the enterprise router has a route with the next hop set to the VPC 1 attachment to forward traffic from the enterprise router to VPC 1.
Table 2 Description of network planning for Direct Connect and VPN connections that work in active/standby mode

Resource

Description

VPC

VPC 1 (Service VPC) that your services are deployed:
  • The CIDR blocks of the VPC and the on-premises data center cannot overlap.
  • The VPC has a default route table.
  • Routes in the default route table:
    • Local: a system route for communications between subnets in a VPC.
    • Enterprise router: traffic from a VPC subnet can be forwarded to the enterprise router. The destination is set to the on-premises CIDR block. Table 3 shows the route.

A VPC that has a subnet used by the VPN gateway.

When you create the VPN gateway, you need to enter the subnet CIDR block. The subnet used by the VPN gateway cannot overlap with existing subnets in the VPC.

Direct Connect

  • One physical connection that you lease from a carrier to link your on-premises data center to the cloud.
  • One virtual gateway that is attached to the enterprise router.
  • One virtual interface that connects the virtual gateway with the connection.

VPN

  • One VPN gateway that is attached to the enterprise router.
  • One customer gateway that is the gateway of the on-premises data center.
  • Two VPN connections that connect the VPN gateway and the customer gateway and work in active/standby mode.

Enterprise router

After Default Route Table Association and Default Route Table Propagation are enabled and an attachment is created, the system will automatically:
  • VPC:
    • Associate the VPC attachment with the default route table of the enterprise router.
    • Propagate the VPC attachment to the default route table of the enterprise router. The route table automatically learns the VPC CIDR block as the destination of a route. For details, see Table 4.
  • Direct Connect
    • Associate the virtual gateway attachment with the default route table of the enterprise router.
    • Propagate the virtual gateway attachment to the default route table of the enterprise router. The route table automatically learns the route information of the virtual gateway attachment. For details, see Table 4.
  • VPN
    • Associate the VPN gateway attachment with the default route table of the enterprise router.
    • Propagate the VPN gateway attachment to the default route table of the enterprise router. The route table automatically learns the route information of the VPN gateway attachment. For details, see Table 4.

ECS

One ECS in the service VPC. The ECS is used to verify communications between the cloud and the on-premises data center.

If you have multiple ECSs associated with different security groups, you need to add rules to the security groups to allow network access.

Table 3 VPC route table

Destination

Next Hop

Route Type

192.168.3.0/24

Enterprise router

Static route (custom)

  • If you enable Auto Add Routes when creating a VPC attachment, you do not need to manually add static routes to the VPC route table. Instead, the system automatically adds routes (with this enterprise router as the next hop and 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 as the destinations) to all route tables of the VPC.
  • If an existing route in the VPC route tables has a destination to 10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16, the routes will fail to be added. In this case, do not to enable Auto Add Routes. After the attachment is created, manually add routes.
  • You need to add a route to the VPC route table with destination set to the on-premises CIDR block and next hop set to enterprise router.
Table 4 Enterprise router route table

Destination

Next Hop

Route Type

VPC 1 CIDR block: 172.16.0.0/16

VPC 1 attachment: er-attach-01

Propagated route

Data center CIDR block: 192.168.3.0/24

Virtual gateway attachment: vgw-demo

Propagated route

Data center CIDR block: 192.168.3.0/24

VPN gateway attachment: vpngw-demo

Propagated route

  • Only preferred routes are displayed in the enterprise router route table. If both the Direct Connect and VPN connections are working normally, the routes of the virtual gateway attachment take priority and can be viewed in the enterprise router route table. Routes (including routes that are not preferred) of the VPN gateway attachment cannot be viewed.
  • If the Direct Connect connection is faulty and services are switched to the VPN connection, you can view the propagated routes of the VPN gateway attachment in the enterprise router route table on the management console.

Resource Planning

An enterprise router, a Direct Connect connection, VPN resources, two VPCs, and an ECS are in the same region but can be in different AZs.

The following resource details are only examples. You can modify them as required.

Table 5 Details of required resources

Resource

Quantity

Description

VPC

2

A service VPC that is used to run your services and needs to be attached to the enterprise router
  • VPC name: Set it based on site requirements. In this example, vpc-for-er is used.
  • VPC IPv4 CIDR block: The CIDR block must be different from that of the on-premises data center. Set it based on site requirements. In this example, 172.16.0.0/16 is used.
  • Subnet name: Set it based on site requirements. In this example, subnet-for-er is used.
  • Subnet IPv4 CIDR block: The CIDR block must be different from that of the on-premises data center. Set it based on site requirements. In this example, 172.16.0.0/24 is used.

A VPC that has a subnet used by the VPN gateway

  • VPC name: Set it based on site requirements. In this example, vpc-for-vpn is used.
  • VPC IPv4 CIDR block: Set it based on site requirements. In this example, 10.0.0.0/16 is used.
  • Subnet name: A default subnet is created together with a VPC. Set it based on site requirements. In this example, subnet-01 is used.
  • Subnet IPv4 CIDR block: The default subnet is not used in this example. Set it based on site requirements. In this example, 10.0.0.0/24 is used.
NOTICE:

When you create a VPN gateway, you need to select the VPC and set Interconnection Subnet to a subnet that is not used by any resource in the VPC. The subnet CIDR block cannot overlap with existing subnet CIDR blocks in the VPC. In this example, the CIDR block of the interconnection subnet cannot be the same as that of the default subnet subnet-01.

Enterprise router

1

  • Name: Set it based on site requirements. In this example, er-test-01 is used.
  • ASN: Specify a different ASN from that of the on-premises data center. In this example, retain the default value 64512.
  • Default Route Table Association: Enable
  • Default Route Table Propagation: Enable
  • Auto Accept Shared Attachments: Set it based on site requirements. In this example, enable this option.
  • Three attachments on the enterprise router:
    • VPC attachment: er-attach-VPC
    • Virtual gateway attachment: er-attach-VGW
    • VPN gateway attachment: er-attach-VPN

Direct Connect

1

Connection: Create one based on site requirements.

Virtual gateway
  • Name: Set it based on site requirements. In this example, vgw-demo is used.
  • Attachment: Select Enterprise Router.
  • Enterprise Router: Select your enterprise router. In this example, the router is er-test-01.
  • BGP ASN: The ASN is the same as or different from that of the enterprise router. In this example, retain the default value 64512.
Virtual interface
  • Name: Set it based on site requirements. In this example, vif-demo is used.
  • Virtual Gateway: Select your virtual gateway. In this example, the virtual gateway is vgw-demo.
  • Local Gateway: Set it based on site requirements. In this example, 10.0.0.1/30 is used.
  • Remote Gateway: Set it based on site requirements. In this example, 10.0.0.2/30 is used.
  • Remote Subnet: Set it based on site requirements. In this example, 192.168.3.0/24 is used.
  • Routing Mode: Select BGP.
  • BGP ASN: ASN of the on-premises data center, which must be different from the ASN of the virtual gateway on the cloud. In this example, 65525 is used.

VPN

1

VPN gateway
  • Name: Set it based on site requirements. In this example, vpngw-demo is used.
  • Associate With: Select Enterprise Router.
  • Enterprise Router: Select your enterprise router. In this example, the router is er-test-01.
  • BGP ASN: The ASN must be the same as that of the virtual gateway because the Direct Connect and VPN connections back up each other. In this example, 64512 is used.
  • VPC: Select your VPC. In this example, select vpc-for-vpn.
  • Interconnection Subnet: Subnet used by the VPN gateway. The subnet cannot overlap with existing subnets in the VPC. Set it based on site requirements. In this example, 10.0.5.0/24 is used.

Customer gateway

  • Name: Set it based on site requirements. In this example, cgw-demo is used.
  • Routing Mode: Select Dynamic (BGP).
  • BGP ASN: ASN of the on-premises data center. The ASN must be the same as that of the virtual gateway because the Direct Connect and VPN connections back up each other. In this example, 65525 is used.

Two VPN connections that work in active/standby mode:

  • Name: Set it based on site requirements. In this example, the active VPN connection is vpn-demo-01, and the standby VPN connection is vpn-demo-02.
  • VPN Gateway: Select your VPN gateway. In this example, the VPN gateway is vpngw-demo.
  • EIP: Set it based on site requirements. Select the active EIP for the active VPN connection and the standby EIP for the standby VPN connection.
  • VPN Type: Select Route-based.
  • Customer Gateway: Select your customer gateway. In this example, the customer gateway is cgw-demo.
  • Interface IP Address Assignment: In this example, Automatically assign is selected.
  • Routing Mode: Select Dynamic (BGP).

ECS

1

  • ECS Name: Set it based on site requirements. In this example, ecs-demo is used.
  • Image: Select an image based on site requirements. In this example, a public image (CentOS 8.2 64bit) is used.
  • Network
    • VPC: Select your VPC. In this example, select vpc-for-er.
    • Subnet: Select a subnet. In this example, select subnet-for-er.
  • Security group: Select a security group based on site requirements. In this example, the security group uses a general-purpose web server template and its name is sg-demo.
  • Private IP address: 172.16.1.137
  • The virtual gateway and the VPN gateway must use the same ASN to prevent network loops because the Direct Connect and VPN connections back up each other. In this example, 64512 is used.
  • The ASN of the enterprise router can be the same as or different from that of the virtual gateway and the VPN gateway. In this example, 64512 is used.
  • The ASN of the on-premises data center must be different from that used on the cloud. Set this ASN of the on-premises data center based on site requirements. In this example, 65525 is used.