Lvs-tun Demo:
Test environment:
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: All hosts use a network card and are used Bridge network, a network card configuration multiple IP address (Lvs-tun This mode in the enterprise application of the very few, most of them use LVS-DR);
1. Configure the VIP on the director and use IPVSADM to define the Cluster service
#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. Remove all Ipvs rules and redefine the Cluster service, and set the kernel parameters
#ipvsadm-C
#ipvsadm-A-T 192.168.10.120:80-s RR
#ipvsadm-T 192.168.10.120:80-r 192.168.10.12-i
#ipvsadm-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. Configure the Web service and VIP on the RS and set the kernel parameters
#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
This article is from "Luo Chen's blog" blog, please be sure to keep this source http://luochen2015.blog.51cto.com/9772274/1702812
Lvs-tun Demo