vmwarea centos7 lvs dr模式配置

需要准备四台同一个网段IP的虚拟机,需要关闭防火墙或者防火墙开放80端口

cli:192.168.81.128

dr-lvs:192.168.81.131
ifconfig ens32:0 192.168.81.123 broadcast 192.168.81.255 netmask 255.255.255.0 up
route add -host 192.168.81.123 dev ens32:0

vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
net.ipv4.conf.all_send_redirects = 0
net.ipv4.conf.ens32_send_redirects = 0
net.ipv4.conf.default_send_redirects = 0
yum install -y ipvsadm
ipvsadm -C # 清除ipvsadm配置规则
ipvsadm -A -t 192.168.81.123:80 -s rr
ipvsadm -a -t 192.168.81.123:80 -r 192.168.81.132:80 -g
ipvsadm -a -t 192.168.81.123:80 -r 192.168.81.133:80 -g
ipvsadm-save > /etc/sysconfig/ipvsadm
systemctl enable ipvsadm

 

web1:192.168.81.132
yum install -y httpd
ifconfig lo:0 192.168.81.123/32
echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce

web2:192.168.81.133
yum install -y httpd
ifconfig lo:0 192.168.81.123/32
echo 1 > /proc/sys/net/ipv4/conf/all/arp_ignore
echo 2 > /proc/sys/net/ipv4/conf/all/arp_announce

vmwarea centos7 lvs dr模式配置

上一篇:获取选中的文本


下一篇:Redis之持久化