ipvsadm-DR模式

环境

ipvsadm-DR模式_第1张图片

在LVS服务器上

yum install ipvsadm -y

ifconfig eth0:0 10.0.0.2 netmask 255.255.255.0

route add -host 10.0.0.2 dev eth0:0

ipvsadm -a -t 10.0.0.2:80 -r 10.0.0.7:80 -g

ipvsadm -a -t 10.0.0.2:80 -r 10.0.0.8:80 -g

在web服务器上

yum install httpd -y

systemctl start httpd.service

systemctl enable httpd.service

ifconfig lo:0 10.0.0.2 netmask 255.255.255.255

route add -host 10.0.0.2 dev lo:0

 echo "1"> /proc/sys/net/ipv4/conf/lo/arp_ignore
echo "2" > /proc/sys/net/ipv4/conf/lo/arp_announce
echo "1" > /proc/sys/net/ipv4/conf/all/arp_ignore

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

浏览器访问vip


你可能感兴趣的:(ipvsadm-DR模式)