Help Center/ Direct Connect/ Best Practices/ Accessing a VPC over Two Direct Connect Connections Terminated at Two Locations Through Static Routes (Virtual Gateway)
Updated on 2026-07-10 GMT+08:00

Accessing a VPC over Two Direct Connect Connections Terminated at Two Locations Through Static Routes (Virtual Gateway)

Overview

Your on-premises data center can access a VPC in the same region through two Direct Connect connections, a virtual gateway, and static routes. The two connections work in active/active and load balancing mode and can automatically switch over in the event of a failure, eliminating single points of failure.

Application Scenarios

To meet high service availability requirements, you can use two physical Direct Connect connections terminated at different Direct Connect locations in the same Huawei Cloud region. The two connections work in load balancing and active-active forwarding mode to access the same VPC. In normal cases, both connections carry service traffic at the same time. If one connection fails, traffic is automatically switched to the other connection to ensure service continuity.

Solution Architecture

The on-premises network is connected to a VPC in the CN-Hong Kong region over two Direct Connect connections, with one terminated at Hong Kong-Sha Tin and the other terminated at HK-Sai Kung-Mobile. Each connection uses its own virtual interface, but both are associated with the same virtual gateway. Static routes are used for dual-connection load balancing and redundancy.

The following table lists the CIDR blocks used in this example.

Item

CIDR Block

On-premises network

10.1.123.0/24

Local and remote gateways (addresses for interconnection)

10.0.0.0/30 and 10.0.0.4/30

VPC

192.168.0.0/16

Figure 1 Accessing a VPC using two connections that are terminated at two locations and use static routes

Advantages

  • High reliability: Dual connections work in load balancing mode, and automatic failover is supported in case of a single point of failure (SPOF), ensuring service continuity.
  • Easy deployment: Static routes are easy to configure, and BGP is not required, simplifying O&M.
  • High performance: Both connections are used concurrently and their bandwidths are aggregated to deliver higher total throughput.
  • Secure isolation: Communications over Direct Connect connections are over the private network, eliminating security risks associated with the Internet.

Constraints

Before using Direct Connect, ensure that your devices and network meet the following requirements. You can submit a service ticket or contact your account manager for assistance.
  • Your on-premises network must use a single-mode fiber with a 1GE, 10GE, 40GE, or 100GE optical module to connect to the access device in Huawei Cloud.
  • Auto-negotiation for the ports must be disabled. Port speed and full-duplex mode must be manually configured.
  • 802.1Q VLAN encapsulation is supported on your on-premises network.
  • CIDR blocks used by Direct Connect connections cannot conflict with that of the cloud and on-premises networks.
  • Bidirectional Forwarding Detection (BFD) must be enabled for non-directly connected connections. You can submit a service ticket to enable BFD.

Resource and Cost Planning

The following table describes the resource planning in the best practice.

Table 1 Resource and cost planning

Region

Resource

Description

Quantity

Price

CN-Hong Kong

VPC

VPC subnet: 192.168.0.0/16

1

Free

Connection

Connection dc-connect1 is associated with virtual gateway vgw-test and virtual interface vif-test1.

  • Location: Hong Kong-Sha Tin
  • Local subnet of virtual gateway vgw-test: 192.168.0.0/16
  • Local gateway of virtual interface vif-test1: 10.0.0.1/30
  • Remote gateway of virtual interface vif-test1: 10.0.0.2/30
  • Remote subnet of virtual interface vif-test1: 10.1.123.0/24

2

Direct Connect Product Pricing Details

Connection dc-connect2 is associated with virtual gateway vgw-test and virtual interface vif-test2.

  • Location: HK-Sai Kung-Mobile
  • Local subnet of virtual gateway vgw-test: 192.168.0.0/16
  • Local gateway of virtual interface vif-test2: 10.0.0.5/30
  • Remote gateway of virtual interface vif-test2: 10.0.0.6/30
  • Remote subnet of virtual interface vif-test2: 10.1.123.0/24

Virtual gateway

Local subnet in the associated VPC: 192.168.0.0/16

1

Virtual interface

Each of the two connections has its own virtual interface, while both virtual interfaces are associated with the same virtual gateway.

2

Process Flowchart

In this scenario, the on-premises network connects to the VPC over two connections that are terminated at two locations in the same region, and static routes are used to route traffic between the on-premises network and the VPC.

Step 1: Create a Connection

  1. Go to the Connections page.
  2. In the upper left corner of the page, click and select a region and project.
  3. Click Create Connection. Configure the following parameters:
    • Region: CN-Hong Kong
    • Connection Name: dc-connect1
    • Location: Hong Kong-Sha Tin
    • Port Type: 1GE
    • Leased Line Bandwidth (Mbit/s): 100

    Configure other parameters based on service requirements.

  4. Submit the request for review.
  5. Contact the carrier for cabling after your request is approved.
  6. Confirm the cabling on the console after the cabling is complete.
  7. Confirm the Direct Connect configuration and complete the payment.
  8. Wait until the Huawei Cloud construction is complete and the status changes to Normal.

Repeat the preceding steps to create another connection named dc-connect2 and select HK-Sai Kung-Mobile as the location.

Step 2: Create a Virtual Gateway

A virtual gateway is the core gateway for a Direct Connect connection to access a VPC. Two Direct Connect connections share one virtual gateway for load balancing.

  1. Go to the Virtual Gateways page.
  2. Click Create Virtual Gateway.
    Key configuration parameters:
    • Name: vgw-test
    • VPC: Select the target VPC.
    • Local Subnet: 192.168.0.0/16
    • BGP ASN: 64512 by default

    Configure other parameters based on service requirements.

  3. Click OK and wait until the status changes to Normal.

Step 3: Create a Virtual Interface

Create a virtual interface for each connection and associate them with the same virtual gateway for dual-connection load balancing.

  1. Create virtual interface vif-test1.
    1. In the navigation pane on the left, choose Direct Connect > Virtual Interfaces.
    2. Click Create Virtual Interface.

      Key configuration parameters:

      • Name: vif-test1
      • Virtual Interface Priority: Preferred
      • Connection: dc-connect1
      • Gateway: Virtual gateway
      • Virtual Gateway: vgw-test
      • VLAN: 30
      • Bandwidth (Mbit/s): 100
      • Local Gateway (Huawei Cloud): 10.0.0.1/30
      • Remote Gateway (Customer): 10.0.0.2/30
      • Routing Mode: Static
      • Remote Subnet: 10.1.123.0/24

      Configure other parameters based on service requirements.

    3. Click Create Now.
  2. Create virtual interface vif-test2.

    Repeat the creation process and modify the following parameters:

    • Name: vif-test2
    • Connection: dc-connect2
    • VLAN: 32
    • Local Gateway: 10.0.0.5/30
    • Remote Gateway: 10.0.0.6/30
    • Remote Subnet: 10.1.123.0/24

    Retain other parameters the same as those of virtual interface vif-test1.

Step 4: Configure On-Premises Routes

Configure two equal-cost static routes on the on-premises gateway. (A Huawei-developed device is used as an example here.)

# Point to the Huawei Cloud gateway of Direct Connect connection dc-connect1.
ip route-static 192.168.0.0 255.255.0.0 10.0.0.1
# Point to the Huawei Cloud gateway of Direct Connect connection dc-connect2.
ip route-static 192.168.0.0 255.255.0.0 10.0.0.5

After a Direct Connect connection is created in self-service mode, the Direct Connect gateway on Huawei Cloud automatically delivers routes from the cloud to the on-premises network.

Testing Connectivity and Load Balancing

  1. Use the ping command to test the connectivity.

    In the on-premises data center, ping the private IP address of the ECS in the VPC to test the connectivity.

    ping 192.168.1.100
  2. Test load balancing.
    • Linux: traceroute 192.168.1.100
    • Windows: tracert 192.168.1.100

      Run the command multiple times. Check that the next hops are 10.0.0.1 and 10.0.0.5, respectively, to confirm that dual-connection load balancing is working.

  3. Test failover.

    Manually disconnect one connection and continuously perform ping tests. Check whether traffic can be quickly switched to the other connection, and services are not interrupted.

Helpful Links