Add a UDP listener to your Network Load Balancer (NLB) instance to forward UDP requests from clients. This is useful for applications that prioritize real-time data transmission over reliability, such as video chats or live financial market data feeds.
Prerequisites
-
An NLB instance is created. For more information, see Create and manage NLB instances.
-
A server group is created. For more information, see NLB server groups.
Procedure
This topic describes two methods to create a UDP listener. You can choose the one that best suits your needs.
-
Create a UDP listener: A comprehensive method that allows you to customize advanced settings, such as enabling the listen by port range feature.
-
Create a UDP listener (quick configuration): A streamlined method for configuring only the listener protocol, listener port, and backend server group.
Create a UDP 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 you want to manage and open the listener configuration wizard using one of the following methods:
-
In the Actions column, click Create Listener.
-
Click the instance ID, and then 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 configuration wizard.
-
Click the instance ID. In the upper-right corner of the instance details page, click Create Listener.
-
-
On the Configure Listener page, set the following parameters and click Next.
Parameter
Description
Listener Protocol
Select UDP.
Multi-port Listening/Forwarding
Select whether to use the listen by port range feature. If enabled, the NLB instance listens on all ports within the specified listener port range and forwards requests to corresponding ports on backend servers.
Backend server groups for a listener that uses this feature must have full-port forwarding enabled.
Listener Port Range
When the listen by port range feature is enabled, you must enter the start port and the end port for the Listener Port Range.
ImportantThe port range cannot be modified after the listener is created.
Listener Port
Specify the Listener Port for receiving and forwarding requests to backend servers.
You can select a common port or enter a custom port number. The valid port range is 1 to 65535.
This parameter is not required if Multi-port Listening/Forwarding is enabled.
For more information about how to configure listener ports for the same NLB instance, see Port configurations.
Listener Name
Enter a name for the listener.
Tags
Set a Tag Key and Tag Value.
After you add a tag, you can filter listeners by tag on the Listener tab.
Advanced Settings
Click Modify to expand the advanced settings.
Idle Connection Timeout Period
Specify the idle connection timeout period for UDP connections. If no request is received within the timeout period, NLB closes the connection. The next request establishes a new connection.
The valid range is 10 to 90 seconds. The default value is 90 seconds.
Limit on New Connections
Select whether to enable a limit on new connections.
Maximum New Connections per Second
If you enable this limit, set the maximum number of new connections per second for the listener in each zone. Each zone corresponds to a virtual IP address (VIP).
ImportantThis limit applies only to the current listener and does not affect other listeners.
Enable Proxy Protocol
Select whether to enable Proxy Protocol. If enabled, client IP addresses are passed to backend servers by using Proxy Protocol.
For more information, see Retrieve client IP addresses by using an NLB instance.
ImportantImportant: Proxy Protocol must be supported by both the proxy server (in this case, the NLB listener) and the backend server. If you enable this feature but your backend server cannot parse the Proxy Protocol header, request parsing may fail and impact service availability.
-
On the Select Server Group page, configure the following parameters and click Next.
Parameter
Description
Server Group Type
Select the server group type. The supported types are Server and IP.
Server Group
Select a backend server group.
Weight
Set the weight of the target server group. This setting applies only when multiple server groups are configured. The valid range is from 0 to 1,000. The default value is 1,000. A larger weight indicates that more requests are forwarded to the server group.
Add Server Group
ImportantAdding multiple server groups is a feature available only to allowlisted users. To enable it, contact your business manager.
Click Add Server Group to add multiple server groups. New connections are distributed across the server groups based on their weight settings. You can add up to 5 server groups to a listener.
When you use multiple server groups, at least one server group must have a weight greater than 0, and the scheduling algorithms of all server groups must be the same.
Each server group is scheduled independently. Backend servers with the same IP address in different server groups are treated as separate backends and receive traffic accordingly.
-
On the Configuration Review page, confirm the settings and click Submit.
Create a UDP listener (quick configuration)
This method allows you to quickly create a listener by configuring only the listener protocol, listener port, and backend server group.
-
In the left-side navigation pane, choose .
-
On the Instances page, find the instance you want to manage and click its ID.
-
On the Listener tab, click Quick Create Listener. In the dialog box that appears, configure the following parameters and click OK.
Parameter
Description
Listener Protocol
Select UDP.
Listener Port
Specify the listener port for receiving and forwarding requests to backend servers.
You can select a common port or enter a custom port number. The valid port range is 1 to 65535.
Server Group
Select a server group type and then select a backend server group of that type. You can also add multiple server groups and configure their weights. For more information, see the Create a UDP listener section.
Related topics
-
CreateListener: Creates a TCP, UDP, or TCP/SSL listener for an NLB instance.
-
DeleteListener: Deletes a listener of an NLB instance.
-
ListListeners: Lists the listeners of an NLB instance.
-
UpdateListenerAttribute: Modifies the attributes of a listener for an NLB instance.
-
StartListener: Starts a listener of an NLB instance.
-
StopListener: Stops a listener of an NLB instance.
-
GetListenerAttribute: Retrieves the attributes of a listener for an NLB instance.
-
GetListenerHealthStatus: Retrieves the health status of a listener of an NLB instance.