LVS-DR模型配

LVS-DR模型配置_LVS

 

OS

IP

子网掩码

路由网关

Centos6.5

(Directory)

Eth0:192.168.25.209(DIP)

255.255.252.0


Eth0:0:192.168.26.210(VIP)

255.255.255.255

Eth0:0

OS

RS

子网掩码

路由网关

Centos6.6

(RS1)

Eth0:192.168.25.210(RIP)

255.255.252.0

192.168.25.3

Lo:0:192.168.26.210(VIP)

255.255.255.255

Lo:0

Centos6.6

(RS2)

Eth0:192.168.25.211(RIP)

255.255.252.0

192.168.25.3

Lo:0:192.168.26.210(VIP)

255.255.255.255

Lo:0

Centos6.6

(RS3)

Eth0:192.168.25.212(RIP)

255.255.252.0

192.168.25.3

Lo:0:192.168.26.210(VIP)

255.255.255.255

Lo:0

Win7

IP:192.168.25.159(CIP)

255.255.252.0

192.168.25.3

 

配置Directory:

ifconfig eth0 192.168.25.209/22 up

ifconfig eth0:0 192.168.26.210 netmask 255.255.255.255 broadcast 192.168.26.210 up

route add -host  192.168.26.210 dev eth0:0

route -n

LVS-DR模型配置_LVS_02

 

RS1:

ifconfig eth0 192.168.25.210/22 up

route add default gw 192.168.25.3 #指定自己网关

#配置系统内核参数:

echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore 

echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore 

echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce

echo 2 > /proc/sys/net/ipv4/conf/eth0/arp_announce

ifconfig lo:0  192.168.26.210 netmask 255.255.255.255 broadcast 192.168.26.210 up

route add -host 192.168.26.210 dev lo:0

curl 192.168.26.210

curl 192.168.25.210

LVS-DR模型配置_DR_03

 

LVS-DR模型配置_模型配置_04

 

LVS-DR模型配置_模型配置_05

 

RS2配置:

ifconfig eth0 192.168.25.211/22 up

route add default gw 192.168.25.3

echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore 

echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore 

echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce

echo 2 > /proc/sys/net/ipv4/conf/eth0/arp_announce

ifconfig lo:0  192.168.26.210 netmask 255.255.255.255 broadcast 192.168.26.210 up

route add -host 192.168.26.210 dev lo:0

curl 192.168.26.210

curl 192.168.25.211LVS-DR模型配置_DR_06

 

RS3配置:

ifconfig eth0 192.168.25.212/22 up

route add default gw 192.168.25.3

echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore 

echo 1 > /proc/sys/net/ipv4/conf/eth0/arp_ignore 

echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce

echo 2 > /proc/sys/net/ipv4/conf/eth0/arp_announce

ifconfig lo:0  192.168.26.210 netmask 255.255.255.255 broadcast 192.168.26.210 up

route add -host 192.168.26.210 dev lo:0

curl 192.168.26.210

curl 192.168.25.212

LVS-DR模型配置_模型配置_07

回到Directory进行LVS配置:

ipvsadm  -A  -t 192.168.26.210:80 -s rr

ipvsadm  -a  -t  192.168.26.210:80 -s 192.168.25.210 -g

ipvsadm  -a  -t  192.168.26.210:80 -s 192.168.25.211 -g

ipvsadm  -a  -t  192.168.26.210:80 -s 192.168.25.212 -g

ipvsadm  -L -n #查看LVS配置信息

LVS-DR模型配置_模型配置_08

测试VIP是否可用。

LVS-DR模型配置_LVS_09

 

访问测试:通过多次刷新观察变化情况。

LVS-DR模型配置_DR_10

 

LVS-DR模型配置_模型配置_11

 

LVS-DR模型配置_模型配置_12

 

 

 

查看访问后LVS状态:

 

LVS-DR模型配置_LVS_13

 

LVS-DR模型配置_LVS_14

LVS-DR模型配置_LVS_15