Updated on 2025-08-30 GMT+08:00

Adding a TCP Listener

Scenarios

You can add a TCP listener, if high reliability and high accuracy are required but slow speed is acceptable. TCP works well for applications such as file transfer, email sending and receiving, and remote login.

Constraints

  • If the front protocol is TCP, the backend protocol defaults to TCP and cannot be changed.
  • If you only select the application load balancing type for your dedicated load balancer, you cannot add TCP listeners to this load balancer.

Procedure

  1. Go to the load balancer list page.
  2. On the displayed page, locate the load balancer and click its name.
  3. On the Listeners tab, click Add Listener. Configure the parameters based on Table 1.
    Table 1 Parameters for configuring a TCP listener

    Parameter

    Description

    Frontend Protocol

    Specifies the protocol that will be used by the load balancer to receive requests from clients.

    Select TCP.

    Listening Port

    Specifies a port or port ranges that will be used by the load balancer to receive requests from clients.

    • Single port: The listener listens only on the specified port.
    • Port ranges: The listener listens on all ports in the specified port ranges and routes the received packets to the corresponding ports on the backend servers, if the frontend protocol is TCP, UDP, or TLS.
    NOTE:

    Listening on port ranges is available in certain regions. You can see which regions support this option on the console.

    Name (Optional)

    Specifies the listener name.

    IPv4/IPv6 Translation

    Specifies whether to translate IPv6 addresses of the clients to IPv4 addresses or vice versa when IPv6 is enabled for the backend subnet of the load balancer.

    Only TCP and UDP listeners support this feature.

    • If this option is disabled:
      • The load balancer can only route requests to IPv4 backend servers when it uses an IPv4 address to communicate with the clients.
      • The load balancer can only route requests to IPv6 backend servers when it uses an IPv6 address to communicate with the clients.
    • If this option is enabled, the load balancer can route requests to either IPv4 or IPv6 backend servers, regardless of whether it uses an IPv4 or IPv6 address to communicate with the clients.

    If this option is enabled, client IP addresses cannot be passed to backend servers. If you are using TCP listeners, you can install the TOA plug-in to obtain client IP addresses.

    WARNING:

    Enabling or disabling this option will disconnect existing persistent connections. Clients can retry to restore the connections.

    NOTE:

    This option is available in certain regions. You can see which regions support this option on the console.

    Transfer Client IP Address

    This option is enabled for dedicated load balancers by default.

    When a TCP listener is used to forward requests, its load balancer communicates with backend servers using client IP addresses. In this case, you can check the backend server logs to obtain client IP addresses.

    Note that client IP addresses cannot be passed to IP as backend servers. And if IPv4/IPv6 translation is enabled, client IP addresses cannot be passed to all the backend servers. To obtain client IP addresses, you can install the TOA plug-in or enable ProxyProtocol. For details, see Using Dedicated Load Balancers to Transfer Client IP Address.

    ProxyProtocol

    Specifies whether to enable the ProxyProtocol option to pass the source IP addresses of the clients to backend servers.

    If you add IP addresses as backend servers, the source IP addresses of the clients cannot be passed to these servers. Enable ProxyProtocol to transfer the source IP addresses.

    WARNING:

    Ensure the backend servers support ProxyProtocol. If they do not, services may be interrupted.

    NOTE:

    This option is available in certain regions. You can see which regions support this option on the console.

    Access Control

    Specifies how access to the listener is controlled. For details, see What Is Access Control?

    All IP addresses is selected for access control by default.

    You can select Whitelist or Blacklist and choose an IP address group.
    • Whitelist: Only IP addresses in the whitelist can access the listener. Requests from the IP addresses or CIDR blocks specified in the IP address group will be forwarded by the listener.
    • Blacklist: IP addresses in the blacklist are not allowed to access the listener. Requests from the IP addresses or CIDR blocks specified in the IP address group will not be forwarded by the listener.

    More (Optional)

    Idle Timeout (s)

    Specifies the length of time for a connection to keep alive, in seconds. If no request is received within this period, the load balancer closes the connection and establishes a new one with the client when the next request arrives.

    Value range: 10–4000

    Maximum New Connections per AZ

    Specifies the maximum number of new connections that a listener can handle per second in each AZ. Unlimited is selected by default. You can select Limit request to set the maximum number of new connections.

    The value ranges from 1 to 1,000,000. If the value is greater than the number defined in the load balancer specifications, the latter is used as the limit.

    NOTE:

    This option is available in certain regions. You can see which regions support this option on the console.

    Maximum Concurrent Connections per AZ

    Specifies the maximum number of concurrent connections that a listener can handle per second in each AZ. Unlimited is selected by default. You can select Limit request to set the maximum number of concurrent connections.

    The value ranges from 1 to 1,000,000. If the value is greater than the number defined in the load balancer specifications, the latter is used as the limit.

    Reducing the concurrent connection limit does not interrupt established connections.

    NOTE:

    This option is available in certain regions. You can see which regions support this option on the console.

    Tag

    Adds tags to the listener. Each tag is a key-value pair, and the tag key is unique.

    Description

    Provides supplementary information about the listener.

    You can enter a maximum of 255 characters.

  4. Click Next: Configure Request Routing Policy.
    1. You are advised to select an existing backend server group.
    2. You can also select Create new to create a backend server group.
      1. Configure the backend server group based on Table 3.
      2. Click Next: Add Backend Server. Add backend servers and configure a health check for the backend server group.

        For details about how to add backend servers, see Backend Server Overview. For the parameters required for configuring a health check, see Table 4.

  5. Click Next: Confirm.
  6. Confirm the configurations and click Submit.