To forward TCP requests from clients to a Network Load Balancer (NLB) instance in scenarios that require high reliability and 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
An NLB instance is created. For more information, see Create and manage an NLB instance.
A server group is created. For more information, see Create and manage a server group.
Procedure
You can use one of the following methods to create a TCP listener:
Create a TCP listener: the standard configuration method. You can enable the Listen by Port Range feature and configure advanced settings for a listener based on your business requirements.
Create a TCP listener (quick configuration): the quick configuration method. You need to only specify a listener protocol, a listener port, and a server group.
Create a TCP listener
- Log on to the NLB console.
In the top navigation bar, select the region in which the NLB instance is deployed.
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.
In the Configure Listener step, configure the parameters and click Next. The following table describes the parameters.
Parameter
Description
Quick Create Listener
Select a listener protocol. In this example, TCP is selected.
Multi-port Listening/Forwarding
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.
NoteYou 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
Specify the first and last port to define the listener port range if you want to enable the listener to listen by port range.
ImportantThe listener port range cannot be modified after the listener is created.
Listener Port
Specify a 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.
NoteIf 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
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.
ImportantThis 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. If Proxy Protocol is enabled, client IP addresses are passed to the backend servers over the proxy protocol.
For more information, see Enable NLB to preserve client IP addresses.
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.
In the Confirm step, confirm the configurations and click Submit.
Create a TCP listener (quick configuration)
If you select this method, you only need to specify a listener protocol, a listener port, and a server group.
In the left-side navigation pane, choose .
On the Instances page, find the instance that you want to manage and click its ID.
Click the Listener tab. On the Listener tab, click Quick Create Listener.
In the Quick Create Listener dialog box, configure the following parameters and click OK.
Parameter
Description
Quick Create Listener
Select a listener protocol. In this example, TCP is selected.
Listener Port
Specify 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
Select Server Type and select a server group from the drop-down list next to Server Type.
References
CreateListener: creates a TCP, UDP, or TCP/SSL listener for an NLB instance.
DeleteListener: deletes a listener from an NLB instance.
ListListeners: queries the list of listeners added to an NLB instance.
UpdateListenerAttribute: updates the configurations of a listener on an NLB instance.
StartListener: enables a listener for an NLB instance.
StopListener: disables a listener for an NLB instance.
GetListenerAttribute: queries the details of a listener for an NLB instance.
GetListenerHealthStatus: queries the health check status of a listener for an NLB instance.