Use case 15: Configure layer 4 load balancing on the NetScaler appliance
The layer 4 load balancer (TCP and UDP ports) uses information provided in the networking transport layer for routing client requests across the server groups.
When a layer 4 connection is established between a client and a server, it has a packet view of traffic exchanged between them. The layer 4 load balancer makes its routing decisions based on the address information extracted from the first few packets in the TCP stream, and doesn't inspect the packet content. Therefore, the layer 4 load balancing is also called as connection-based load balancing.
The layer 4 load balancer monitors the health of a server. Traffic is not routed to the server if it is DOWN.
The layer 4 load balancing is useful for various applications that uses TCP or UDP payloads. Such protocols exchange data as TCP payload and don't have a specific structure to follow.
To configure layer 4 load balancing using the command line interface
At the command prompt, type:
add service <name> <serverName> <serviceType> <port>
add lb vserver <name> <serviceType> <ip> <port>
bind lb vserver <name> <serviceName>
Example:
add service TCPservice 192.0.2.3 TCP 1
add lb vserver TCPserver TCP 192.0.2.4 1
bind lb vserver TCPserver TCPservice
To configure layer 4 load balancing using the GUI
-
Navigate to Traffic Management > Load Balancing > Services.
-
Click Add to a create a service.
-
Specify the required details in Service Name and IP Address.
-
Select either TCP or UDP in Protocol.
-
Click OK.
-
Click Done.A service is created.When you create a service using UDP as the transport layer protocol, a ping monitor (built-in monitor) is automatically bound to the service. When you create a service using TCP as the transport layer protocol, a tcp_default monitor is automatically bound to the service.For the load balancing setup, you can bind your service to a different type of monitor or multiple monitors. For advance monitoring requirements you can use the tcp-ecv monitor and configure the request and response messages.
-
Navigate to Traffic Management > Load Balancing > Virtual Servers.
-
Click Add to create a new virtual server.When the load balancing is configured, you can connect to the load-balanced website, application, or server through the virtual server's IP address or FQDN.
-
Specify the required details in Name, IP Address Type, and IP Address.
-
Select either TCP or UDP in Protocol.
-
Type a port number (0–1023 based on the type of service) in Port.
-
Click OK.
-
Click No Load Balancing Virtual Server Service Binding in Services and Service Groups.
-
In the Service Binding page, select Click to Select in Select Service.
-
Select the service to be bound and click Select.
-
Click Bind to bind the service to the virtual server.
-
Click Continue.
-
Click Done.The layer 4 load balancing virtual server configuration is completed.