All Products
Search
Document Center

Server Load Balancer:Add a TCP listener

Last Updated:Dec 11, 2023

To forward TCP requests from clients to a Network Load Balancer (NLB) instance, especially in scenarios that require high reliability, high data accuracy, but can tolerate a relatively low speed, such as file transfer, sending or receiving emails, and remote logon, you can add a TCP listener to the NLB instance.

Prerequisites

References

You can use one of the following methods to create a TCP listener:

  • Manual creation: You can create a TCP listener and configure advanced features based on business requirements.

  • Quick creation: You can use a template to quickly create a TCP listener. You only need to specify a listener protocol, a listener port, and a backend server group.

Manual creation

  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 NLB instance that you want to manage and use one of the following methods to open the listener configuration wizard:

    • Click Create Listener in the Actions column.

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

    • Click the instance ID. On the instance details page, click Create Listener in the wizard.

    • Click the instance ID. In the upper-right corner of the instance details page, click Create Listener.

  4. In the Configure Listener step, configure the parameters and click Next. The following table describes the parameters.

    Parameter

    Description

    Listener Protocol

    Select a listener protocol. In this example, TCP is selected.

    Listen by Port Range

    Specifies whether to enable the listener to listen by port range. If you enable this feature, the NLB instance listens on all ports in the specified listener port range, and redirects requests destined for the ports to the backend servers.

    Note
    • Each NLB instance supports only one TCP (including SSL over TCP) listener that listens by port range and one UDP listener that listens by port range.

    • You must enable the all-port forwarding feature for server groups that you want to add to listeners that have Listen by Port Range enabled.

    Listener Port Range

    The range of ports on which the NLB instance listens. If Listen by Port Range is enabled, you must specify the start and end ports for the Listener Port Range parameter.

    Listener Port

    The listener port on which the NLB instance listens. The NLB instance uses the port to receive requests and forward the requests to the backend servers.

    You can select a commonly used port or enter a port number. Valid values: 1 to 65535.

    Note
    • If Listen by Port Range is enabled, you do not need to configure this parameter.

    • For more information about how to configure listener ports for the same NLB instance, see Port settings.

    Listener Name

    Enter a name for the listener.

    Tag

    Configure the Tag Key and Tag Value parameters to add a tag. You can add one or more tags.

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

    Advanced Settings

    You can click Modify to configure the advanced settings.

    Idle Connection Timeout Period

    The timeout period for idle TCP connections. If no request is received within the specified timeout period, NLB temporarily closes the current connection. When another request is received, NLB establishes a new connection.

    Limit on New Connections

    Specifies whether to limit the number of new connections.

    Maximum New Connections per Second

    The maximum number of new connections that can be established per second in each zone. If Limit on New Connections is enabled, you must configure this parameter.

    Important

    This limit applies only to the current listener. When you access other listeners, this limit does not take effect. The value of the Maximum New Connections per Second parameter that is set for each listener prevails.

    Enable Proxy Protocol

    Specifies whether to enable Proxy Protocol. After Proxy Protocol is enabled, client IP addresses are passed to backend servers.

    For more information, see Obtain client IP addresses.

  5. In the Select Server Group step, configure the Server Type parameter, select a server group based on the specified server type, confirm the backend servers, and then click Next.

  6. In the Confirm step, confirm the configurations and click Submit.

Quick creation

If you select this method, you need to only specify a listener protocol, a listener port, and a server group.

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

  2. On the Instances page, find the NLB instance that you want to manage and click its ID.

  3. Click the Listener tab. On the Listener tab, click Quick Create Listener.

  4. In the Quick Create Listener dialog box, configure the parameters and click OK. The following table describes the parameters.

    Parameter

    Description

    Listener Protocol

    Select a listener protocol. In this example, TCP is selected.

    Listener Port

    The frontend port that is used to receive and forward requests to backend servers.

    You can select a commonly used port or enter a port number. Valid values: 1 to 65535.

    Server Group

    Configure the Server Type parameter and select a server group based on the specified server type.

References