Lvs ip-tun 模式
########## ########
#internet# ----> #####-------> #server#
# # #lvs# ########
# # # #
# # #net# ########
#internet#------> # # -------> #server#
########## ##### ########
注意:
lvs:tunl0:vip192.168.10.10
vm1:lvs:etho:ip: 192.168.10.1
vm1:webserver1:ip:192.168.10.2
vm1:webserver2:ip:192.168.10.3
1. Lvs ip-tun 服务器配置
ifconfig tunl0 192.168.10.10 netmask 255.255.255.255 up #ip隧道网卡
route add -host 192.168.10.10 dev tunl0 #增加路由
ipvsadm -C #删除所有调度器转换表
ipvsadm -A -t 192.168.10.10:80 -s rr #增加调度算法转换表进行调度算法
ipvsadm -a -t 192.168.10.10:80 -r 192.168.10.2 -i #添加webserver(注释:-i 隧道模式)
ipvsadm -a -t 192.168.10.10:80 -r 192.168.10.3 -i #添加webserverr(注释:-i 隧道模式)
2. 两台webserver配置
给两webserver配置apache:
yum install httpd -y
#给192.168.10.2配置webserver
ifconfig tunl0 192.168.10.10 netmask 255.255.255.255 up
route add -host 192.168.10.10 dev tunl0
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
webserver1:echo 192.168.10.2>/var/www/html/index.html
chkconfig httpd on server httpd restart #给192.168.10.2配置webserver
#给192.168.10.3配置webserver
ifconfig tunl0 192.168.10.10 netmask 255.255.255.255 up
route add -host 192.168.10.10 dev tunl0
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
webserver2:echo 192.168.10.3>/var/www/html/index.html
chkconfighttpd on server httpd restart #给192.168.8.3配置webserver
阅读(1186) | 评论(0) | 转发(0) |