To forward UDP requests from clients in scenarios that have high requirements for real-time interaction but can tolerate a relatively low reliability, such as video chat and real-time quote services, you can add a UDP listener to your Network Load Balancer (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 UDP listener:
Manual creation: You can create a UDP listener and configure advanced features based on business requirements.
Quick creation: You can use a template to quickly create a UDP listener. You only need to specify a listener protocol, a listener port, and a backend server group.
Manual creation
- 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 following parameters and click Next.
Parameter
Description
Listener Protocol
Select a listener protocol. In this example, UDP 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 a specific port range, and redirects requests destined for the ports to the backend servers.
NoteEach 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
If you enable the listener to listen by port range, specify the first port and the last port to define the listener port range.
Listener Port
Specify a port on which the NLB instance listens. The NLB instance uses the port to receive requests and forward the requests to 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 specify 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
Specify a timeout period for idle UDP connections. If no request is received within the timeout period, NLB closes the current connection. When a 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. After Proxy Protocol is enabled, client IP addresses are passed to backend servers.
For more information, see Obtain client IP addresses.
In the Select Server Group step, select Server Type or IP, select a server group, view the backend servers, and then click Next.
In the Configuration Review 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.
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
Listener Protocol
Select a listener protocol. In this example, UDP 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
Select Server Type or IP, and then select a server group.
References
CreateListener: creates a TCP or UDP listener, or a listener that uses SSL over TCP for an NLB instance.
DeleteListener: deletes an NLB listener.
ListListeners: queries the listeners added to an NLB instance.
UpdateListenerAttribute: updates the configuration of an NLB listener.
StartListener: enables an NLB listener.
StopListener: disables an NLB listener.
GetListenerAttribute: queries the details about an NLB listener.
GetListenerHealthStatus: queries the health status of an NLB listener.