lvs tunl

#开启ipip模块
modprobe ipip
#添加tunl网卡
cd /etc/sysconfig/network-scripts/
cp ifcfg-lo ifcfg-tunl0
 
vim ifcfg-tunl0
######################
DEVICE=tunl0
IPADDR=192.168.10.200
NETMASK=255.255.255.255
TYPE=tun
ONBOOT=yes
NAME=tunl0
#############
 
service network restart
 
#添加到tunl0的路由
route add -host 192.168.10.200 dev tunl0
#查看路由表
route -n
#忽略arp报警
echo "1">/proc/sys/net/ipv4/conf/tunl0/arp_ignore
echo "2">/proc/sys/net/ipv4/conf/tunl0/arp_announce
echo "1">/proc/sys/net/ipv4/conf/all/arp_ignore
echo "2">/proc/sys/net/ipv4/conf/all/arp_announce
echo 0 > /proc/sys/net/ipv4/conf/tunl0/rp_filter
echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
 
#在负载均衡器上
#添加虚拟IP
ifconfig ens37:0 192.168.10.200 netmask 255.255.255.255 up
###或 cp ifcfg-ens37 ifcfg-ens37:0
 
#检查ipvs
ipvsadm -Ln
#如果有 清空lvs
ipvsadm -C
 
#添加tun模式
ipvsadm -A -t 192.168.10.200:80 -s rr
ipvsadm -a -t 192.168.10.200:80 -r 192.168.10.102 -i
ipvsadm -a -t 192.168.10.200:80 -r 192.168.10.103 -i
ipvsadm -Ln
posted @ 2018-11-06 15:03  huifeidezhu  阅读(227)  评论(0编辑  收藏  举报