本文共 1610 字,大约阅读时间需要 5 分钟。
环境: 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:80director配置[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 -nIP Virtual Server version 1.2.1 (size=4096)Prot LocalAddress:Port Scheduler Flags -> RemoteAddress:Port Forward Weight ActiveConn InActConnTCP 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 ipipipip 13472 0 tunnel4 13252 1 ipipip_tunnel 23760 1 ipip[root@realserver1~]# vim /etc/sysconfig/network-scripts/ifcfg-tunl0DEVICE=tunl0IPADDR=192.168.232.20NETMASK=255.255.255.255ONBOOT=yesNAME=tunl0[root@realserver1~]# systemctl restart network.service[root@realserver1~]# vim /etc/sysctl.confnet.ipv4.ip_forward = 0net.ipv4.conf.tunl0.arp_ignore = 1net.ipv4.conf.tunl0.arp_announce = 2net.ipv4.conf.all.arp_ignore = 1net.ipv4.conf.all.arp_announce = 2net.ipv4.conf.tunl0.rp_filter = 0net.ipv4.conf.all.rp_filter = 0[root@realserver1~]# sysctl -p
转载于:https://blog.51cto.com/1011779/1766170