Basic Layer 4 server load balancing configuration example
Network requirements
In Figure 48, physical servers Server A, Server B, and Server C provide FTP services, and are in descending order of hardware configuration.
Configure server load balancing on the LB device to distribute user requests among the servers based on their hardware performance, and use health monitoring to monitor the reachability of the servers.
Figure 48: Network diagram
Configuration procedure
Configure the LB device:
Configure IP addresses for interfaces.
<LB> system-view [LB] interface gigabitethernet 1/0/1 [LB-GigabitEthernet1/0/1] ip address 61.159.4.100 24 [LB-GigabitEthernet1/0/1] quit [LB] interface gigabitethernet 1/0/2 [LB-GigabitEthernet1/0/2] ip address 192.168.1.100 24 [LB-GigabitEthernet1/0/2] quit
Configure a server farm.
# Create the ICMP-type NQA template t1.
[LB] nqa template icmp t1 [LB-nqatplt-icmp-t1] quit
# Create the server farm sf, and specify the scheduling algorithm as weighted round robin and health monitoring method as t1.
[LB] server-farm sf [LB-sfarm-sf] predictor round-robin [LB-sfarm-sf] probe t1 [LB-sfarm-sf] quit
Configure real servers.
# Create the real server rs1 with IPv4 address 192.168.1.1, port number 21, and weight 150, and add it to the server farm sf.
[LB] real-server rs1 [LB-rserver-rs1] ip address 192.168.1.1 [LB-rserver-rs1] port 21 [LB-rserver-rs1] weight 150 [LB-rserver-rs1] server-farm sf [LB-rserver-rs1] quit
# Create the real server rs2 with IPv4 address 192.168.1.2, port number 21, and weight 120, and add it to the server farm sf.
[LB] real-server rs2 [LB-rserver-rs2] ip address 192.168.1.2 [LB-rserver-rs2] port 21 [LB-rserver-rs2] weight 120 [LB-rserver-rs2] server-farm sf [LB-rserver-rs2] quit
# Create the real server rs3 with IPv4 address 192.168.1.3, port number 21, and weight 80, and add it to the server farm sf.
[LB] real-server rs3 [LB-rserver-rs3] ip address 192.168.1.3 [LB-rserver-rs3] port 21 [LB-rserver-rs3] weight 80 [LB-rserver-rs3] server-farm sf [LB-rserver-rs3] quit
Configure a virtual server.
# Create the TCP virtual server vs with VSIP 61.159.4.100, specify its default master server farm sf, and enable the virtual server.
[LB] virtual-server vs type tcp [LB-vs-tcp-vs] virtual ip address 61.159.4.100 [LB-vs-tcp-vs] default server-farm sf [LB-vs-tcp-vs] service enable [LB-vs-tcp-vs] quit
Configure the physical servers:
# Specify the default gateway 192.168.1.100 for physical servers Server A, Server B, and Server C. (Details not shown.)
Verifying the configuration
# Display brief information about all real servers.
[LB] display real-server brief Real server Address Port State VPN instance Server farm rs1 192.168.1.1 21 Active sf rs2 192.168.1.2 21 Active sf rs3 192.168.1.3 21 Active sf
# Display detailed information about all server farms.
[LB] display server-farm Server farm: sf Description: Predictor: Round robin Proximity: Disabled NAT: Enabled SNAT pool: Failed action: Keep Active threshold: Disabled Slow-online: Disabled Selected server: Disabled Probe information: Probe success criteria: All Probe method: t1 Total real server: 3 Active real server: 3 Real server list: Name State VPN instance Address Port Weight Priority rs1 Active 192.168.1.1 21 150 4 rs2 Active 192.168.1.2 21 120 4 rs3 Active 192.168.1.3 21 80 4
# Display detailed information about all virtual servers.
[LB] display virtual-server Virtual server: vs Description: Type: TCP State: Active VPN instance: Virtual IPv4 address: 61.159.4.100/32 Virtual IPv6 address: -- Port: 0 Primary server farm: sf (in use) Backup server farm: Sticky: LB policy: Connection limit: -- Rate limit: Connections: -- Bandwidth: -- Inbound bandwidth: -- Outbound bandwidth: -- Connection synchronization: Disabled Sticky synchronization: Disabled Bandwidth busy protection: Disabled Interface bandwidth statistics: Disabled Route advertisement: Disabled