All Products
Search
Document Center

Server Load Balancer:Add a TCP listener

Last Updated:Jun 30, 2026

To forward TCP requests from clients on your Network Load Balancer (NLB) instance, add a TCP listener. This is especially suitable for scenarios that prioritize reliability and data accuracy, and where relatively lower speeds are acceptable, such as file transfers, sending or receiving emails, and remote logins.

Prerequisites

Procedure

This topic describes two methods for creating a TCP listener.

  • Create a TCP listener: This method allows you to configure features such as multi-port listening/forwarding and advanced settings.

  • Quickly create a TCP listener: This method quickly creates a listener by configuring only the listener protocol, listener port, and the destination server group.

Create a TCP listener

  1. Log on to the NLB console.

  2. In the top navigation bar, select the region in which the NLB instance is deployed.

  3. On the Instances page, find the target instance and open the listener configuration wizard in one of the following ways:

    • In the Actions column, click Create Listener.

    • Click the instance ID, and then click the Listener tab. On the Listener tab, click Create Listener above the listener list.

    • Click the instance ID and then click Create Listener in the configuration wizard on the instance details page.

    • Click the instance ID and then click Create Listener in the upper-right corner of the instance details page.

  4. On the Configure Listener page, set the following parameters and click Next.

    Parameter

    Description

    Listener Protocol

    Select TCP.

    Multi-port Listening/Forwarding

    Specifies whether to enable multi-port listening/forwarding. When this feature is enabled, the NLB instance listens on all ports within the specified listener port range and forwards requests to the corresponding ports on backend servers.

    The server group that you add to a multi-port listener must have multi-port forwarding enabled.

    Listener Port Range

    If multi-port listening/forwarding is enabled, enter the start port and end port for the Listener Port Range.

    Important

    The listener port range cannot be modified after the listener is created.

    Listener Port

    Specify the Listener Port that NLB uses to listen for requests and forward them to backend servers.

    You can click a common port number to automatically fill in the field, or enter a port number. The valid port range is 1 to 65535.

    This parameter is not required if Multi-port Listening/Forwarding is enabled.
    For information about the port settings of a single NLB instance, see Port settings.

    Tags

    Set the Tag Key and Tag Value.

    After you add tags, you can filter listeners by tag on the Listener tab.

    Advanced Settings

    Click Modify to expand the advanced settings.

    Idle Connection Timeout Period

    The idle timeout for a TCP connection. If no data is transmitted over the connection during the timeout period, NLB closes it. NLB establishes a new connection for the next request.

    The value must be an integer from 10 to 900. Unit: seconds. Default value: 900.

    To prevent NLB from closing idle TCP connections, you can enable the TCP Keep-Alive mechanism on the client or server and set the keep-alive interval to a value less than the idle connection timeout.

    Limit on New Connections

    Specifies whether to enable the limit on new connections.

    Maximum New Connections per Second

    After you enable the limit on new connections, set the maximum number of new connections per second per zone (VIP) for the listener.

    Important

    This limit applies only to the current listener. Traffic to other listeners is not affected. The limits for other listeners are based on their individual settings.

    Enable Proxy Protocol

    When this feature is enabled, NLB can pass the client IP address to backend servers by using Proxy Protocol.

    For more information, see Obtain client IP addresses on backend servers.

    Important

    Important: Proxy Protocol must be supported by both the proxy server (in this case, the NLB listener) and the backend server. If you enable this feature but your backend server cannot parse the Proxy Protocol header, request parsing may fail and impact service availability.

  5. On the Select Server Group page, set the following parameters and click Next.

    Parameter

    Description

    Server group type

    NLB supports server groups of the Server and IP types.

    Server group

    Select a server group of the specified type.

    Weight

    Set the weight of the server group. A higher weight directs more traffic to the server group. The value must be an integer from 0 to 1000. Default value: 1000.

    Add Server Group

    Important

    This is an allowlist-based feature. To use this feature, contact your account manager.

    Click Add Server Group to add multiple server groups. After you add multiple server groups, new connections are distributed to the server groups based on their weights. You can add up to 5 server groups to a listener.

    When you use multiple server groups, at least one server group must have a weight greater than 0, and all server groups must use the same scheduling algorithm.
    Each server group is the smallest scheduling unit. Even if backend servers with the same IP address exist in different server groups, they are treated as independent backends and receive traffic separately.
  6. On the Configuration Review page, confirm the settings and click Submit.

Quickly create a TCP listener

The quick creation method allows you to create a listener by setting only the listener protocol, listener port, and the destination server group.

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

  2. On the Instances page, find the target instance and click its ID.

  3. On the Listener tab, click Quick Create Listener. In the dialog box that appears, set the following parameters and click OK.

    Parameter

    Description

    Listener Protocol

    Select TCP.

    Listener Port

    Specify the listener port that receives and forwards requests.

    You can click a common port number to automatically fill in the field, or enter a port number. The valid port range is 1 to 65535.

    Server Group

    Select the server group type and then select a server group. You can add multiple server groups and configure their weights. For more information, see Create a TCP listener.

Related APIs