The lvs Linux load balancing mode [TUN]

###### tunnel TUN mode ######

# On server1
before 1.ipvsadm -C ## Clear Rules

2.modprobe ipip ## add modules used by the tunnel

addr del 172.25.0.100/24 dev eth0 ip
ip addr the Add 172.25.0.100/24 dev tunl0
ip Link up tunl0 the SET ## vip delete the original card, added to the tunl0, and activate

-A -s -t RR 172.25.0.100:80 the ipvsadm
the ipvsadm -a -t 172.25.0.100:80 -i -R & lt 172.25.0.2:80
the ipvsadm -a -t 172.25.0.100:80 -R & lt 172.25.0.3:80 - i ## adding tunnel rules

# On server2 and server3 (rs)
modprobe IPIP ## Add tunl module

ip addr del 172.25.0.100/32 dev eth0

ip addr add 172.25.0.100/32 dev tunl0 ## vip added to the tunl

ip link set up tunl0 ## activation tunl0

sysctl -a | grep rp_filter ## View reverse filtering rules
sysctl -w net.ipv4.conf.default.rp_filter = 0
sysctl -w net.ipv4.conf.default.rp_filter = 0
sysctl -w net.ipv4.conf. = 0 lo.rp_filter
sysctl -w = 0 net.ipv4.conf.eth0.rp_filter
sysctl -w net.ipv4.conf.tunl0.rp_filter inverse filtering off ## = 0 (if enabled, will flow into the packet reverse path verification, if not met, discarded, no verify is set to 0)

sysctl -p ## to give effect

Guess you like

Origin blog.csdn.net/qq_36016375/article/details/94915606