码迷,mamicode.com
首页 > 其他好文 > 详细

LVS DR模拟实验

时间:2019-10-09 15:31:56      阅读:93      评论:0      收藏:0      [点我收藏+]

标签:net   服务   tables   install   实验   ble   mask   stop   UNC   

准备多台服务器,现以三台服务器为例
第一台做调度器 192.168.200.111
[root@localhost ~]# iptables -F
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# yum -y install ipvsadm net-tools
[root@localhost ~]# ifconfig ens32:0 192.168.200.254 netmask 255.255.255.0
[root@localhost ~]# ipvsadm -A -t 192.168.200.254:80 -s rr
[root@localhost ~]# ipvsadm -a -t 192.168.200.254:80 -r 192.168.200.112:80 -g -w 1
[root@localhost ~]# ipvsadm -a -t 192.168.200.254:80 -r 192.168.200.113:80 -g -w 1

第二台做节点服务器 192.168.200.112
[root@localhost ~]# iptables -F
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# yum -y install httpd net-tools
[root@localhost ~]# ifconfig lo:0 192.168.200.254 netmask 255.255.255.255
[root@localhost ~]# route add -host 192.168.200.254 dev lo:0
[root@localhost ~]# echo 11111 > /var/www/html/index.html
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# vim /etc/sysctl.conf
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.default.arp_ignore = 1
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
[root@localhost ~]# sysctl -p

第二台做节点服务器 192.168.200.113
[root@localhost ~]# iptables -F
[root@localhost ~]# setenforce 0
[root@localhost ~]# systemctl stop firewalld
[root@localhost ~]# yum -y install httpd net-tools
[root@localhost ~]# ifconfig lo:0 192.168.200.254 netmask 255.255.255.255
[root@localhost ~]# route add -host 192.168.200.254 dev lo:0
[root@localhost ~]# echo 22222 > /var/www/html/index.html
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# vim /etc/sysctl.conf
net.ipv4.conf.all.arp_ignore = 1
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.default.arp_ignore = 1
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.lo.arp_ignore = 1
net.ipv4.conf.lo.arp_announce = 2
[root@localhost ~]# sysctl -p

LVS DR模拟实验

标签:net   服务   tables   install   实验   ble   mask   stop   UNC   

原文地址:https://www.cnblogs.com/lyqlyqlyq/p/11641875.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!