江西省建设网站公司,wordpress刷评论,wordpress添加投稿,湖北公司响应式网站建设推荐目录 一、实验环境准备
1、五台红帽9系统的主机
2、关闭所有的防火墙以及关闭selinux
二、在lvs中配置
1、在lvs中安装lvs软件并设置开机启动
2、在lvs中打开内核路由功能#xff0c;并把它写入/etc/sysctl.conf文件中
3、webserver1和webserver2下载httpd
4、在lvs主机… 目录 一、实验环境准备
1、五台红帽9系统的主机
2、关闭所有的防火墙以及关闭selinux
二、在lvs中配置
1、在lvs中安装lvs软件并设置开机启动
2、在lvs中打开内核路由功能并把它写入/etc/sysctl.conf文件中
3、webserver1和webserver2下载httpd
4、在lvs主机中设置
5、在webserver主机中使vip不对外响应
三、测试
1、在lvs主机中测试
2、在client中测试 一、实验环境准备
1、五台红帽9系统的主机
分别为
1client
网卡配置——NAT模式
IP172.25.254.100
网关172.25.254.200
2router
两张网卡
第一张网卡配置——NAT模式
IP172.25.254.100 (作为外部网关
第二张网卡配置——仅主机模式
IP192.168.0.100内部网关
3lvs
网卡配置——仅主机模式
IP192.168.0.50
vip192.168.0.200配置环回 lo)
网关192.168.0.100
4webserver1
网卡配置——仅主机模式
IP192.168.0.10
vip192.168.0.200配置环回 lo)
网关192.168.0.100
5webserver2
网卡配置——仅主机模式
IP192.168.0.20
vip192.168.0.200配置环回 lo)
网关192.168.0.100
2、关闭所有的防火墙以及关闭selinux
systemctl stop firewalldsetenforce 0
二、在lvs中配置
1、在lvs中安装lvs软件并设置开机启动
dnf install ipvsdam -ysystemctl enable --now ipvsadm.service2、在router、lvs、webserver1、webserver中分别打开内核路由功能并把它写入/etc/sysctl.conf文件中
四个主机都要分别进行下列操作
sysctl -a | grep ip_forwardvim /etc/sysctl.confnet.ipv4.ip_forward 1#保存退出后sysctl -p #查看 3、webserver1和webserver2下载httpd
[rootserver1 ~]# dnf install httpd
[rootserver1 ~]# systemctl enable --now httpd
[rootserver1 ~]# echo webserver1 -192.168.0.10 /var/www/html/index.html
[rootserver1 ~]# systemctl restart httpd
[rootserver2 ~]# dnf install httpd
[rootserver2 ~]# systemctl enable --now httpd
[rootserver2 ~]# echo webserver2 -192.168.0.20 /var/www/html/index.html
[rootserver2 ~]# systemctl restart httpd
4、在lvs主机中设置
[rootlvs ~]# ipvsadm -A -t 172.25.254.100:80 -s rr
[rootlvs ~]# ipvsadm -a -t 172.25.254.100:80 -r 192.168.0.10 -m -w 1
[rootlvs ~]# ipvsadm -a -t 172.25.254.100:80 -r 192.168.0.20 -m -w 15、在webserver主机中使vip不对外响应
[rootserver1 ~]# echo 1 /proc/sys/net/ipv4/conf/all/arp_ignore
[rootserver1 ~]# echo 2 /proc/sys/net/ipv4/conf/all/arp_announce
[rootserver1 ~]# echo 2 /proc/sys/net/ipv4/conf/lo/arp_announce
[rootserver1 ~]# echo 1 /proc/sys/net/ipv4/conf/lo/arp_ignore[rootserver2 ~]# echo 1 /proc/sys/net/ipv4/conf/all/arp_ignore
[rootserver2 ~]# echo 2 /proc/sys/net/ipv4/conf/all/arp_announce
[rootserver2 ~]# echo 2 /proc/sys/net/ipv4/conf/lo/arp_announce
[rootserver2 ~]# echo 1 /proc/sys/net/ipv4/conf/lo/arp_ignore三、测试
1、在lvs主机中测试
[rootlvs ~]# curl 192.168.0.10
webserver1 -192.168.0.10
[rootlvs ~]# curl 192.168.0.20
webserver2 -192.168.0.202、在client中测试
[rootclient ~]# curl 192.168.0.200
webserver1 -192.168.0.10
[rootclient ~]# curl 192.168.0.200
webserver2 -192.168.0.20
[rootclient ~]# for i in {1..10}; do curl 192.168.0.200; done
webserver2 -192.168.0.20
webserver1 -192.168.0.10
webserver2 -192.168.0.20
webserver2 -192.168.0.20
webserver1 -192.168.0.10
webserver2 -192.168.0.20
webserver2 -192.168.0.20
webserver1 -192.168.0.10
webserver2 -192.168.0.20
webserver2 -192.168.0.20