标签:lvs-tun演示
LVS-TUN演示:
测试环境:
OS:rhel6.4
Director:
Vip:192.168.10.120
Dip:192.168.10.11
RS1: Rip:192.168.10.12
RS2: Rip:192.168.10.13
PS:所有主机上都使用一块网卡并且都是使用桥接网络,在一块网卡配置多个ip地址(LVS-TUN这种模式在企业应用中用的很少,大多数都是使用LVS-DR);
1.在Director上配置Vip,使用ipvsadm定义集群服务
#lsmod | grep ipip ####查看内核是否加载了ipip模块
#ifconfig tunl0 up
#ifconfig eth0:0 192.168.10.120 netmask 255.255.255.255 broadcast 192.168.10.120 up
#route add -host 192.168.10.120 dev eth0:0
#ifconfig
2.删除所有ipvs规则并且重新定义集群服务,并且设定内核参数
#ipvsadm -C
#ipvsadm -A -t 192.168.10.120:80 -s rr
#ipvsadm -a -t 192.168.10.120:80 -r 192.168.10.12 -i
#ipvsadm -a -t 192.168.10.120:80 -r 192.168.10.13 -i
#ipvsadm -L -n
#echo "0" >/proc/sys/net/ipv4/ip_forward
#echo "1" >/proc/sys/net/ipv4/conf/all/send_redirects
#echo "1" >/proc/sys/net/ipv4/conf/default/send_redirects
#echo "1" >/proc/sys/net/ipv4/conf/eth0/send_redirects
3.在RS上配置web服务和Vip并且设定内核参数
#ifconfig tunl0 192.168.10.120 netmask 255.255.255.255 broadcast 192.168.10.120 up
#route add -host 192.168.10.120 dev tunl0
#echo "0" > /proc/sys/net/ipv4/ip_forward
#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
#yum -y install httpd
#echo "192.168.10.12" > /var/www/html/index.html
#service httpd start
本文出自 “珞辰的博客” 博客,请务必保留此出处http://luochen2015.blog.51cto.com/9772274/1702812
标签:lvs-tun演示
原文地址:http://luochen2015.blog.51cto.com/9772274/1702812