2653885 发表于 2019-1-5 06:23:14

LVS IP TUNL模式

环境:
    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配置
# echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.conf
# ifconfig eth0:2 192.168.232.21/24 up
# 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
# /etc/init.d/ipvsadm restart
# ipvsadm -L -n
IP Virtual Server version 1.2.1 (size=4096)
Prot LocalAddress:Port Scheduler Flags
-> RemoteAddress:Port         Forward Weight ActiveConn InActConn
TCP192.168.232.20:80 wrr
-> 192.168.232.30:80            Tunnel2      0          0         
-> 192.168.232.31:80            Tunnel2      0          0
realserver配置(两台所做配置相同)
# modprobe ipip
# lsmod | grep ipip
ipip                   134720
tunnel4                132521 ipip
ip_tunnel            237601 ipip
# vim /etc/sysconfig/network-scripts/ifcfg-tunl0
DEVICE=tunl0
IPADDR=192.168.232.20
NETMASK=255.255.255.255
ONBOOT=yes
NAME=tunl0
# systemctl restart network.service
# 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
# sysctl -p  




页: [1]
查看完整版本: LVS IP TUNL模式