Help Center/ Elastic Load Balance/ Best Practices/ Load Balancer Selection and Service Planning/ Adding the IP Address of an On-Premises Server as a Backend Server of a Dedicated Load Balancer
Updated on 2025-08-28 GMT+08:00

Adding the IP Address of an On-Premises Server as a Backend Server of a Dedicated Load Balancer

Scenarios

You can use Direct Connect or VPN to connect on-premises servers to Huawei Cloud, and then add the IP addresses of on-premises servers as backend servers of a dedicated load balancer. In this way, the load balancer can distribute traffic to these servers.

Solution Architecture

Figure 1 Distributing traffic to an on-premises server

In this practice, a Direct Connect connection is required to connect on-premises servers to a VPC and a dedicated load balancer is required to route requests to on-premises servers.

  • Dedicated load balancer ELB-Test is running in a VPC named VPC-Test-01 (172.16.0.0/12).
  • An on-premises server (IDC-IP-Test) is deployed in the on-premises data center.
  • The IP address of IDC-IP-Test is added to the backend server group of ELB-Test.

Resource Planning

In this practice, you need to create a VPC, dedicated load balancer, EIP, Direct Connect connection, ECS, and on-premises server. For details about the resource planning, see Table 1.

This practice uses public network access as an example. You can also use a load balancer to route client requests over a private network.

Table 1 Resource planning

Resource Type

Quantity

Description

VPC and subnet

One VPC and two subnets

  • VPC-Test-01: The CIDR block is 172.16.0.0/12.
  • subnet-frontend: The CIDR block is 172.16.0.0/16.
  • subnet-backend: The CIDR block is 172.18.0.0/16.

Load balancer

1

The load balancer that is used to distribute client requests.

  • VPC: VPC-Test-01
  • Frontend subnet: subnet-frontend
  • Backend subnet: subnet-backend

Direct Connect connection

1

The connection that is used to connect the on-premises data center to a VPC.

ECS

1

ECS-client, which is used to access the on-premises server.

EIP

2

  • One EIP will be bound to the load balancer to distribute client requests over the public network.
  • The other EIP will be bound to ECS-client to access the load balancer over the public network.

On-premises server

1

IDC-IP-Test, which is deployed in the on-premises data center.

Preparations

Step 1: Connect an On-Premises Data Center to a VPC Using Direct Connect

You can create a Direct Connect connection on the console to connect your on-premises data center or on-premises private network to a VPC.

For details, see Using Direct Connect to Connect an On-Premises Data Center to the Cloud.

Step 2: Deploy a Service on the On-Premises Server

Deploy Nginx on the on-premises server IDC-IP-Test to verify network connectivity.

Figure 2 Nginx deployed on the on-premises server

Step 3: Create a Backend Server Group and Add the IP Address of the On-Premises Server as a Backend Server

  1. Go to the backend server group list page.
  2. Click Create Backend Server Group in the upper right corner.
  3. Configure the parameters based on Table 2. Retain the default values for other parameters.
    Table 2 Parameters required for configuring a backend server group

    Parameter

    Example Value

    Description

    Name

    server_group

    Specifies the name of the backend server group.

    Type

    Dedicated

    Specifies the type of the load balancer that can use the backend server group.

    Load Balancer

    Associate existing

    Specifies whether to associate a load balancer now.

    Click Associate existing and select a load balancer you have created.

    Backend Protocol

    HTTP

    Specifies the protocol that backend servers in the backend server group use to receive requests from the listeners.

    Select HTTP.

    Load Balancing Algorithm

    Weighted round robin

    Specifies the load balancing algorithm used by the load balancer to distribute traffic.

    Weighted round robin: Requests are routed to different servers based on their weights. Backend servers with higher weights receive proportionately more requests, whereas equal-weighted servers receive the same number of requests.

    For more information, see Load Balancing Algorithms.

  4. Click Next to add backend servers and configure health check.
  5. Switch to the IP as Backend Servers tab and click Add IP as Backend Server.
  6. On the displayed page, add the IP address of the on-premises server as a backend server and set the parameters as follows:
    • IP Address: Set it to 10.1.0.56 in this example, which is the private IP address of the on-premises server IDC-IP-Test.
    • Backend Port: Set this parameter based on service requirements. In this practice, port 80 is used.
    • Weight: Retain the default value 1.
  7. Click OK.
  8. Enable health check and retain the default values for other health check parameters.
  9. Click Next.
  10. Confirm the configurations and click Create Now.

Step 4: Add a Listener and Select the Created Backend Server Group

  1. Go to the load balancer list page.
  2. Locate the target load balancer and click Add Listener in the Operation column.
  3. On the Add Listener page, set Frontend Protocol to HTTP and Frontend Port to 80. Retain the default values for other parameters.
  4. Click Next: Configure Request Routing Policy and select Use existing for Backend Server Group.

    Select the backend server group created in Step 3 and click Next: Confirm.

  5. Confirm the configurations and click Submit.

Step 5: Verify Request Routing to the On-Premises Server

  1. Use the client to access the on-premises server to verify network connectivity.
    1. Remotely log in to ECS_client.

      Multiple methods are available for logging in to an ECS. For details, see Logging In to an ECS.

    2. Run the curl -v http://<IP-address>:<port> command to test network connectivity.

      In this practice, run the following command:

      curl -v http://<EIP-of-the-load-balancer>:<Listening-port>

      If the default Nginx welcome page is displayed, ELB successfully forwards the client request to the on-premises server.

  2. Use a browser to verify the network connectivity.
    Use a browser to access http://<EIP-of-the-load-balancer>. If the following page is displayed, the request is forwarded by the load balancer to the on-premises server.
    Figure 3 The Nginx default welcome page when accessed using a browser