环境: director:192.168.232.18:80(centos7) realserver1:192.168.232.30:80(centos7) realserver2:192.168.232.31:80(centos7) client:192.168.232.101 VIP:192.168.232.20:80 director配置 [root@director~]# echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf [root@director~]# ifconfig eth0:2 192.168.232.21/24 up [root@director~]# vim /etc/sysconfig/ipvsadm -A -t 192.168.232.20:80 -s wrr -a -t 192.168.232.20:80 -r 192.168.232.30:80 -i -w 2 -a -t 192.168.232.20:80 -r 192.168.232.31:80 -i -w 2 [root@director~]# /etc/init.d/ipvsadm restart [root@director~]# ipvsadm -L -n IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConn TCP 192.168.232.20:80 wrr -> 192.168.232.30:80 Tunnel 2 0 0 -> 192.168.232.31:80 Tunnel 2 0 0 realserver配置(两台所做配置相同) [root@realserver1~]# modprobe ipip [root@realserver1~]# lsmod | grep ipip ipip 13472 0 tunnel4 13252 1 ipip ip_tunnel 23760 1 ipip [root@realserver1~]# vim /etc/sysconfig/network-scripts/ifcfg-tunl0 DEVICE=tunl0 IPADDR=192.168.232.20 NETMASK=255.255.255.255 ONBOOT=yes NAME=tunl0 [root@realserver1~]# systemctl restart network.service [root@realserver1~]# vim /etc/sysctl.conf net.ipv4.ip_forward = 0 net.ipv4.conf.tunl0.arp_ignore = 1 net.ipv4.conf.tunl0.arp_announce = 2 net.ipv4.conf.all.arp_ignore = 1 net.ipv4.conf.all.arp_announce = 2 net.ipv4.conf.tunl0.rp_filter = 0 net.ipv4.conf.all.rp_filter = 0 [root@realserver1~]# sysctl -p
原文地址:http://1011779.blog.51cto.com/1001779/1766170