Add a TCP listener to a CLB instance to forward TCP traffic to backend servers. TCP listeners suit reliability-first workloads such as file transfers, email, and remote logon.
Prerequisites
-
A CLB instance is created. Create and manage CLB instances.
Step 1: Configure the listener
Log on to the CLB console.
-
Select the region of the CLB instance.
-
Open the listener configuration wizard:
-
On the Instances page, find the CLB instance and click Configure Listener in the Actions column.
-
On the Instances page, click the instance ID to open the details page. Click the Listener tab, then click Add Listener.
-
-
In the Protocol & Listener step, configure the following parameters, then click Next.
Listener parameters
Parameter
Description
Select Listener Protocol
Select TCP.
Backend Protocol
Automatically set to TCP when the listener protocol is TCP.
Listener Port
The port that receives and forwards requests. Valid values: 1 to 65535.
Tags
Select or enter a Tag Key and Tag Value.
Advanced settings
Click Modify next to Advanced Settings to configure the following parameters.
Scheduling algorithm
Select a scheduling algorithm. Default value: Round Robin.
Algorithm
Description
Weighted Round-robin (WRR)
Distributes requests by weight. Higher-weight servers receive more requests.
Round Robin (RR)
Distributes requests sequentially to backend servers.
Consistent Hashing (CH)
Distributes requests by hash key. Two modes: Four-element (source IP, destination IP, source port, destination port) and Source IP (source IP only). Requests with the same hash key go to the same backend server.
NoteOnly high-performance CLB instances support Consistent Hashing (CH). Existing TCP listeners using Weighted Round-robin (WRR) or Round Robin (RR) cannot switch to Consistent Hashing (CH). To use Consistent Hashing (CH), create a new TCP listener.
Session persistence
Disabled by default. When enabled, CLB forwards requests from the same client IP to the same backend server.
Access control
Disabled by default. When enabled, select an ACL type and an ACL:
ACL Type
Behavior
Whitelist: Allows Specified IP Addresses to Access the SLB Instance
Forwards requests only from IP addresses or CIDR blocks in the ACL. An empty whitelist forwards all requests. Improper configuration may block legitimate traffic.
Blacklist: Forbids Specified IP Addresses to Access the SLB Instance
Blocks requests from IP addresses or CIDR blocks in the ACL. An empty blacklist forwards all requests.
NoteIPv6 instances can only be associated with IPv6 ACLs. IPv4 instances can only be associated with IPv4 ACLs. For more information, see Access control.
Bandwidth throttling for listeners
Disabled by default. Available only for bandwidth-billed CLB instances. Set a maximum bandwidth per listener to control traffic distribution. The total bandwidth of all listeners cannot exceed the instance bandwidth.
Important-
Allocating all bandwidth to some listeners makes the remaining listeners inaccessible.
-
For pay-by-data-transfer instances, listener bandwidth is unlimited by default. For more information, see Enable bandwidth sharing among listeners of a CLB instance.
Connection timeout period
Maximum idle time for a TCP connection between CLB and the client. Valid values: 10 to 900 seconds. Default value: 900.
NoteThis timeout applies to all server groups on the listener. To use a different timeout for a specific server, create a separate listener.
Proxy Protocol
Passes client IP addresses to backend servers. Retrieve client IP addresses on backend servers through a CLB Layer-4 listener.
Important-
Proxy Protocol is not compatible with PrivateLink.
-
Both proxy and backend servers must support this protocol. Enabling it without backend support causes packet parsing failures and affects availability.
Obtain client source IP address
Enabled by default. Preserves client IP addresses. Only Layer 4 listeners support this feature.
Automatically enable listener
Enabled by default. The listener starts immediately after creation.
-
Step 2: Add backend servers
Add backend servers to process client requests. You can use the default server group, a vServer group, or a primary/secondary server group. CLB server groups. This example uses the default server group.
-
In the Backend Servers step, select Default Server Group and click Add More.
-
In the Select Servers step, select the backend servers, then click Next.
-
In the Ports/Weights step, configure weights for the backend servers.
NoteDefault weight: 100. Higher weight means more requests. Weight 0 stops traffic to that server.
-
Click Add and specify the port for each backend server. Valid values: 1 to 65535. Multiple backend servers in the same CLB instance can use the same port.
-
Click Next.
Step 3: Configure health checks
CLB health checks monitor backend server availability and reduce the impact of server failures.
Health checks cannot be disabled for listeners using a primary/secondary server group.
-
(Optional) In the Health Check step, click Modify to change the health check configuration, then click Next. For more information, see Configure and manage CLB health checks.
-
In the Confirm step, review the listener configurations. Click Modify to modify if needed.
-
Click Submit. In the Configuration Successful message, click OK.
After submission, the listener appears on the Listener tab of the instance details page.
FAQ
How do I route traffic to a CLB instance with a TCP listener using a domain name?
Create an A record to resolve your domain name to the CLB instance IP address. Use an A record to resolve a domain name to an IP address.