This topic describes how to add a UDP listener to an SLB instance. UDP is applicable to services that prioritize real-time content delivery over reliability, such as video chats and real-time quotes. You can add a UDP listener to forward UDP requests.

Prerequisites

An SLB instance is created. For more information, see Create an SLB instance.

Background information

Before you configure a UDP listener, note the following limits:
  • Ports 250, 4789, and 4790 of a UDP listener are reserved and therefore are unavailable for your configuration.
  • Fragmented packets are not supported.
  • The UDP listeners of an SLB instance in a classic network do not support the viewing of source IP addresses.
  • The following operations take five minutes to take effect if they are performed for a UDP listener:
    • Remove backend servers
    • Set the weight of a backend server to 0 after it is detected unhealthy
  • IPv6 addresses have longer IP headers than IPv4 addresses. When you create a UDP listener for an IPv6 SLB instance, make sure that the maximum transmission unit (MTU) size of the network interface controller (NIC) on each backend server (ECS instance in most cases) that communicates with the SLB instance is not greater than 1,200 bytes. Otherwise, oversized packets may be discarded. The configuration files of some applications need to be modified based on the MTU size.

    If you use a TCP, HTTP, or HTTPS listener, you do not need to perform additional configuration steps because TCP supports automatic maximum segment size (MSS) adjustment.

Step 1: Start the listener configuration wizard

To start the listener configuration wizard, perform the following operations:

  1. Log on to the Server Load Balancer console.
  2. In the left-side navigation pane, choose Instances > Server Load Balancers.
  3. Select the region of the target SLB instance.
  4. Use one of the following methods to start the listener configuration wizard:
    • On the Server Load Balancers page, find the target SLB instance and then click Configure Listener in the Actions column.Configure Listener-private
    • On the Server Load Balancers page, click the ID of the target SLB instance. On the Listener tab, click Add Listener.Add Listener

Step 2: Configure the UDP listener

To configure the UDP listener, perform the following operations:

  1. In the Protocol and Listener step, specify the following information:
    Parameter Description
    Select Listener Protocol Select the protocol of the listener.

    In this example, select UDP.

    Listening Port Set the listening port used to receive requests and forward them to backend servers.

    Valid values: 1 to 65535.

    Note You can set the same listening port for TCP and UDP listeners that are added to the same SLB instance. However, you must first apply for the privilege to use the beta function of configuring the same ports in TCP/UDP listeners on the Quota Management page in the SLB console. This feature is now in public preview and is supported in the following regions. In other cases, the listening ports must be unique.
    • UAE (Dubai)
    • Australia (Sydney)
    • UAE (Dubai)
    • UK (London)
    • Germany (Frankfurt)
    • US (Silicon Valley)
    • US (Virginia)
    • Indonesia (Jakarta)
    • Japan (Tokyo)
    • India (Mumbai)
    • Singapore (Singapore)
    • Malaysia (Kuala Lumpur)
    • China (Hong Kong)
    • China (Shenzhen)
    • China (Hohhot)
    • China (Qingdao)
    • China (Chengdu)
    • China (Zhangjiakou)
    • China (Shanghai)
    Advanced Settings
    Scheduling Algorithm SLB supports four scheduling algorithms: RR, WRR, WLC, and CH.
    • Weighted Round-Robin (WRR): Backend servers with higher weights receive more requests.
    • Round-Robin (RR): Requests are evenly and sequentially distributed to backend servers.
    • Weighted Least Connections (WLC): Requests are distributed based on the combination of the weights and active connections of backend servers. Requests are distributed to the backend server with the least number of active connections. If two backend servers have the same number of active connections, the backend server with a higher weight receives more requests.
    • Consistent Hash (CH):
      • Source IP: the source IP hash. Requests from the same source IP address are scheduled to the same backend server.
      • Tuple: the 4-tuple hash consisting of the source IP address, destination IP address, source port number, and destination port number. Requests with the same 4-tuple are scheduled to the same backend server.
      • QUIC ID: the hash that is based on Quick UDP Internet Connections (QUIC) IDs. Requests that contain the same QUIC ID are scheduled to the same backend server.
        Notice The QUIC protocol is implemented based on draft-ietf-quic-transport-10 and is rapidly evolving. Therefore, compatibility is not guaranteed for all QUIC versions. We recommend that you perform tests before applying the protocol to the production environment.
    Enable Access Control Specify whether to configure the listener to restrict access.
    Access Control Method

    Select an access control method after you enable access control.

    • Whitelist: Only the requests from the IP addresses or CIDR blocks in the specified ACL are forwarded. You can use the whitelist feature when you want to allow access from specified IP addresses.

      Using the whitelist feature may pose risks to your services. The whitelist allows only the traffic from the IP addresses in the specified ACL to access the SLB listener. If the whitelist is used while the corresponding ACL does not contain any IP addresses, the SLB listener forwards all access requests.

    • Blacklist: Requests from the IP addresses or CIDR blocks in the specified ACL are not forwarded. You can use the blacklist feature when you want to deny access from specified IP addresses.

      If the blacklist is used while the corresponding ACL does not contain any IP addresses, the SLB listener forwards all access requests.

    Access Control List Select an ACL that functions as the whitelist or blacklist of the listener.
    Note IPv6 instances can only be associated with IPv6 ACLs, and IPv4 instances can only be associated with IPv4 ACLs. For more information, see Configure an access control list.
    Enable Peak Bandwidth Limit

    You can switch on this option and then set a bandwidth limit for the listener.

    If an SLB instance incurs fees based on the bandwidth, you can set different peak bandwidth values for different listeners to limit the amount of traffic that flows in each listener. The sum of the peak bandwidth values of all listeners added to an SLB instance cannot exceed the bandwidth of this SLB instance.

    By default, this feature is disabled and all listeners share the bandwidth of the SLB instance.

    Note If an SLB instance incurs fees based on the amount of transmitted data, no peak bandwidth limit is applied by default.
    Obtain Client Source IP Address Backend servers of a UDP listener can directly obtain the actual IP addresses of clients.
    Note UDP listeners of an SLB instance in a classic network do not support the viewing of source IP addresses.
    Automatically Enable Listener After Creation Specify whether to start the listener after the listener is configured. By default, the listener is started after configuration.
  2. Click Next.
    Configure UDP

Step 3: Add backend servers

After you configure the listener, you must add backend servers to process client requests. You can add backend servers to the default server group, or create VServer groups or primary/secondary server groups and then add servers to them. For more information, see Backend server overview.

This example adds backend servers to the default server group.

  1. Select Default Server Group and click Add More.
    Add backend servers to the default server group
  2. Select ECS instances (backend servers) that you want to add, and then click Next.
    Configure weights
  3. Configure weights for the added backend servers.
    A backend server with a higher weight receives more requests.
    Note If the weight of a backend server is set to 0, the backend server does not receive new requests.
  4. Click Add. On the Default Server Group tab, configure ports for the backend servers.
    Set a port for each backend server to receive requests. Valid values: 1 to 65535. You can specify the same port for multiple backend servers of an SLB instance.
  5. Click Next.

Step 4: Configure the health check

SLB checks the availability of backend servers by performing the health check. The health check feature improves the availability of frontend services by minimizing downtime caused by health issues of backend servers. Click Modify to configure advanced health check settings. For more information, see Health check overview.

Click Next.

Step 5: Confirm the settings

Complete the following steps to confirm and apply the listener settings:

  1. In the Submit step, check the configuration. You can click Modify to modify configuration settings.
  2. Click Submit.
  3. In the Configure Successful dialog box, click OK.

    You can check the created listener on the Listener tab.