All Products
Search
Document Center

Server Load Balancer:Connect an NLB instance to a same-region data center

Last Updated:Apr 01, 2026

Use Network Load Balancer (NLB) with Cloud Enterprise Network (CEN) to forward traffic from your virtual private cloud (VPC) to on-premises servers in a data center. This lets you include data center servers as NLB backend servers without migrating workloads to the cloud.

How it works

NLB identifies backend servers by private IP address. To reach on-premises servers, NLB routes traffic through a CEN transit router and a virtual border router (VBR), which connects your VPC to the data center over an Express Connect circuit.

The following diagram shows the architecture used in this guide. VPC1 is deployed in the China (Hangzhou) region and hosts an NLB instance. The on-premises data center connects to Alibaba Cloud through a VBR attached to the transit router. With this setup, the NLB instance forwards requests to data center servers as backend servers.

image

Network planning

Plan your CIDR blocks based on your requirements. Make sure that no CIDR blocks overlap.

ResourceZoneCIDR block
VPC1 (primary CIDR block: 192.168.0.0/16)192.168.0.0/16
VSW1Zone G192.168.81.238
VSW2Zone J192.168.27.21
Data center (VSW3)N/A172.16.6.0/24

VBR gateway addresses:

  • Alibaba Cloud side: 10.0.0.1

  • Customer side: 10.0.0.2

  • Subnet mask: 255.255.255.252

Limitations

  • On-premises servers must use private IP addresses. Public IP addresses are not supported.

  • Traffic between an NLB instance and its backend servers uses the system route table only. VPC custom route tables are not supported.

  • On-premises servers can be added to both internal-facing and Internet-facing NLB instances.

  • If you use an Enterprise Edition transit router, specify at least one vSwitch in each zone of the transit router so that traffic can be routed from the VPC to the transit router. For supported regions and zones, see Regions and zones that support Enterprise Edition transit routers.

Prerequisites

Before you begin, ensure that you have:

Step 1: Create a server group

Create an IP-type server group and add the on-premises server's private IP address as a backend server.

Important

Enter a private IP address for the on-premises server. Public IP addresses are not supported.

  1. Log on to the NLB console.

  2. In the top navigation bar, select the region where the NLB instance is deployed. In this example, China (Hangzhou) is selected.

  3. In the left-side navigation pane, choose NLB > Server Groups.

  4. On the Server Groups page, click Create Server Group.

  5. In the Create Server Group dialog box, configure the parameters and click Create. The following table describes the key parameters. Use default values for all other parameters. For the full parameter reference, see Create a server group.

    ParameterDescription
    Server Group TypeSelect IP.
    Server Group NameEnter a name for the server group.
    VPCSelect VPC1.
    Backend Server ProtocolSelect TCP.
    Scheduling AlgorithmSelect Weighted Round-robin.
  6. In the Server group created. dialog box, click Add Backend Server.

  7. On the Backend Servers tab, click Add IP Address.

  8. In the Add Backend Server panel, enter the private IP address of the on-premises server and click Next. In this example, 172.16.6.5 is used.

  9. In the Ports/Weights step, set the port and weight for the IP address, click OK, and then click Close. In this example, port 80 is used with the default weight.

Step 2: Create a listener

  1. Log on to the NLB console.

  2. In the top navigation bar, select the region where the NLB instance is deployed. In this example, China (Hangzhou) is selected.

  3. In the left-side navigation pane, choose NLB > Instances.

  4. On the Instances page, click the ID of the NLB instance in VPC1.

  5. Click the Listener tab, then click Quick Create Listener.

  6. In the Quick Create Listener dialog box, configure the parameters and click OK.

    ParameterDescription
    Listener ProtocolSelect TCP.
    Listener PortEnter 80.
    Server GroupSelect IP and the server group created in Step 1.

Step 3: Attach VPC1 to the CEN instance

  1. Log on to the CEN console.

  2. On the Instances page, click the ID of the CEN instance.

  3. On the Basic Information > Transit Router tab, find the transit router and click Create Connection in the Actions column.

  4. On the Connect with Peer Network Instance page, configure the parameters and click OK.

    ParameterDescription
    Instance TypeSelect VPC.
    RegionSelect China (Hangzhou).
    Transit RouterAutomatically selected for the chosen region.
    Resource Owner IDSelect Current Account.
    Billing MethodSelect Pay-As-You-Go.
    Network InstanceSelect VPC1.
    vSwitchSelect the vSwitches in the zones of the Enterprise Edition transit router. In this example, Zone H and Zone J are selected.

Step 4: Attach the VBR to the CEN instance

  1. After connecting VPC1 to the transit router, click Create More Connections.

  2. On the Connect with Peer Network Instance page, configure the parameters and click OK.

    ParameterDescription
    Instance TypeSelect Virtual Border Router (VBR).
    RegionSelect China (Hangzhou).
    Transit RouterAutomatically selected for the chosen region.
    Resource Owner IDSelect Current Account.
    Network InstanceSelect the VBR deployed in the China (Hangzhou) region.

Step 5: Add a route to the system route table of VPC1

Add a route in VPC1's system route table so that traffic destined for the data center is forwarded to the transit router.

Note

Traffic between an NLB instance and its backend servers uses the system route table only. VPC custom route tables are not supported.

  1. Log on to the VPC console.

  2. In the top navigation bar, select China (Hangzhou).

  3. On the VPC page, click the ID of VPC1.

  4. On the VPC details page, click the Resources tab, then click the number under Route Table.

  5. On the Route Tables page, find the route table with Route Table Type set to System and click its ID.

  6. On the route table details page, choose Route Entry List > Custom Route and click Add Route Entry.

  7. In the Add Route Entry panel, configure the parameters and click OK.

    ParameterDescription
    Destination CIDR BlockEnter 172.16.6.0/24 (the CIDR block of the on-premises data center).
    Next Hop TypeSelect Transit Router.
    Transit RouterSelect the VPC1 connection created in Step 3.

Step 6: Add a route to the VBR

Add a route in the VBR that points to the data center's CIDR block.

  1. Log on to the Express Connect console.

  2. In the top navigation bar, select a region, then click Virtual Border Routers (VBRs) in the left-side navigation pane.

  3. On the Virtual Border Routers (VBRs) page, click the ID of the VBR.

  4. On the VBR details page, click the Routes tab and click Add Route.

  5. In the Add Route panel, configure the parameters and click OK.

    ParameterDescription
    Next Hop TypeSelect Physical Connection Interface.
    Destination CIDR BlockEnter 172.16.6.0/24.
    Next HopSelect the Express Connect circuit.

Step 7: Add routes on the on-premises gateway device

Add routes on the on-premises gateway device that point to the CIDR blocks of the vSwitches associated with the NLB instance. This lets the data center send return traffic back through the VBR.

Note

After VPC1 is attached to the transit router, the transit router automatically learns all vSwitch routes from VPC1. No additional routes are needed on the transit router side.

Find the vSwitch CIDR blocks:

  1. Log on to the VPC console.

  2. In the top navigation bar, select China (Hangzhou).

  3. On the VPC page, click the ID of VPC1.

  4. On the VPC details page, click the Resource Management tab, then click the number under vSwitch.

  5. On the vSwitch page, find the vSwitches associated with the NLB instance and record their CIDR blocks.

Add routes on the gateway device:

On the on-premises gateway device, add a route for each vSwitch CIDR block. The following are sample configurations — actual commands may vary depending on your gateway device.

ip route 192.168.81.238 255.255.255.0 The address of the VBR at the Alibaba Cloud side
ip route 192.168.27.21 255.255.255.0 The address of the VBR at the Alibaba Cloud side

If the NLB instance is associated with additional vSwitches, add a route for each one.

Step 8: Test network connectivity

  1. Log on to ECS01 in VPC1.

  2. Run the following command to verify that ECS01 can reach the on-premises server through the NLB instance:

    telnet nlb-ygfajln3bwbfs3****.cn-hangzhou.nlb.aliyuncsslbintl.com 80

    Replace the domain name with the actual NLB instance domain name. If you receive an echo reply, the connection is working.

Related topics