LVS TUNNEL模式

环境配置
1.设置server1:172.25.77.1 为调度机
2.两台realserver 分别为server2:172.25.77.2 server3:172.25.77.3

调度机步骤:
1.安装ipvsadm

yum install ipvsadm -y

2.绑定vip

ifconfig tunl0 172.25.77.200/24

3.设置路由配置

vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
sysctl ­p

4.设置调度规则

ipvsadm ­C  #清除以前的 rules
ipvsadm ­A ­t 172.25.77.200:80 ­s rr 
ipvsadm ­a ­t 172.25.77.200:80 ­r 172.25.77.2 ­i
ipvsadm ­a ­t 172.25.77.200:80 ­r 172.25.77.3 ­i

Realserver步骤:
1.设置路由配置

vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
sysctl ­p

2.绑定vip,路由

ifconfig tunl0 172.25.77.200 netmask 255.255.255.255 up
route add -host 172.25.77.200 dev tunl0

3.分别给两台RS的index.html 中分别写入”server two”和“server three”

4.分别重启httpd 服务,测试结果如下图
LVS TUNNEL模式_第1张图片

你可能感兴趣的:(LVS TUNNEL模式)