LVS+DR

ipvsadm --save > /etc/sysconfig/ipvsadm 这个是centos7上执行开启ipvsadm的一个命令,执行完毕之后再执行systemctl start ipvsadm这条命令

yum -y install ipvsadm

vim /etc/sysconfig/network-scripts/ifcfg-lo ifcfg-lo:0

DEVICE=lo:0
IPADDR=10.0.0.200
NETMASK=255.255.255.254
ONBOOT=yes

 

systemctl restart network

 

ipvsadm -A -t 10.0.0.200:80 -s rr
ipvsadm -a -t 10.0.0.200:80 -r 10.0.0.42:80 -g
ipvsadm -a -t 10.0.0.200:80 -r 10.0.0.46:80 -g

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

route add -host 10.0.0.200 dev lo:0

ip a

 

 

posted @ 2020-02-14 22:43  h0001  阅读(114)  评论(0编辑  收藏  举报