Updated on 2024-11-07 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 active/standby mode, 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 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 the active/standby mode. Table 2 describes the network planning.

Figure 1 Network diagram of Direct Connect and VPN connections working in active/standby mode
Direct Connect and VPN connections work in the active/standby mode. 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 the data center. Table 1 shows the details about the traffic flows in this example.
Table 1 Network traffic flows

Path

Description

Request from VPC 1 to the on-premises data center

  1. The route table of VPC 1 has routes with 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 next hop set to virtual gateway attachment to forward traffic from the enterprise router to the virtual gateway.
  3. The virtual gateway is connected to 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 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 next hop set to 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 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 subnet CIDR block of the data center. 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, you are advised 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 CIDR block of the on-premises data center 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 they 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

Service VPC that your services are deployed 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 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 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 creating a VPN gateway, you need to set VPC to this VPC and Interconnection Subnet to a subnet of this VPC. Ensure that the configured interconnection subnet has four or more assignable IP addresses.

Enterprise router

1

  • Name: Set it based on site requirements. In this example, er-test-01 is used.
  • ASN: The ASN must be different from that of the data center. In this example, retain the default value 64512.
  • Default Route Table Association: Select Enable.
  • Default Route Table Propagation: Select Enable.
  • Auto Accept Shared Attachments: Set it based on site requirements. In this example, Enable is selected.
  • 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 can be 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 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: Specify the subnet used for communication between the VPN gateway and VPC. Ensure that the selected interconnection subnet has four or more assignable IP addresses. Set this parameter based on the site requirements. In this example, the value is 10.0.5.0/24.

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 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 data center must be different from that of the cloud. Set this ASN of the data center based on site requirements. In this example, 65525 is used.