标签:systemctl bsp 图片 lvs star system ipv4 one 客户
负载均衡LVS之NAT模式实现的详细步骤
1) 四台主机,时间同步,关闭防火墙和selinux
2) 各主机角色
1] 客户端:192.168.110.27 仅主机(vmnet1) 网关:无
2] RS服务器:
192.168.136.36 仅主机(vmnet6) 网关:192.168.136.35
192.168.136.37 仅主机(vmnet6) 网关:192.168.136.35
3] VS服务器:192.168.110.35 仅主机(vmnet1) 192.168.136.35 仅主机(vmnet6)
1) yum -y install httpd
2) echo Real server1 > /var/www/html/index.html #192.168.136.36
3) echo Real server2 > /var/www/html/index.html #192.168.136.37
4) systemctl start httpd
5) 本机测试
curl 192.168.136.36
curl 192.168.136.37
1) yum -y install ipvsadm
2) echo ‘net.ipv4.ip_forward=1‘ >> /etc/sysctl.conf
3) sysctl -p
4) RR算法
1] ipvsadm -A -t 192.168.110.35:80 -s rr
2] ipvsadm -Ln
3] ipvsadm -a -t 192.168.110.35:80 -r 192.168.136.36 -m
4] ipvsadm -a -t 192.168.110.35:80 -r 192.168.136.37 -m
5] ipvsadm -Ln
while true; do curl 192.168.110.35;sleep 1;done
标签:systemctl bsp 图片 lvs star system ipv4 one 客户
原文地址:https://blog.51cto.com/13560168/2400826