LVS的nat模式
创始人
2024-11-06 06:10:07
0

目录

一.实验环境

1.调度器(VS)

2.真实服务器(RS)

3.客户端

二.实验配置

1.VS中打开内核路由器功能

2.RS装上http服务

3.VS安装LVS软件

4.在RS上输入测试内容

5.在VS进行测试

6.在VS中添加调度策略

三.客户端测试


一.实验环境

一台客户机、一台调度器、两台真实服务器

VMVare网络设置NAT模式子网IP为172.25.254.0,仅主机模式子网IP为192.168.0.0

1.调度器(VS)

VMVare设置eth0网卡为NAT模式,eth1为仅主机模式

[root@LVS ~]# cat /etc/NetworkManager/system-connections/eth0.nmconnection  [connection] id=eth0 type=ethernet interface-namw=eth0  [ipv4] address1=172.25.254.100/24,172.25.254.2 method=manual dns=114.114.114.114;  [root@LVS ~]# cat /etc/NetworkManager/system-connections/eth1.nmconnection  [connection] id=eth1 type=ethernet interface-namw=eth1  [ipv4] address1=192.168.0.100/24 method=manual

2.真实服务器(RS)

VMVare设置eth0网卡为仅主机模式

[root@webserver1 ~]# cat /etc/NetworkManager/system-connections/eth0.nmconnection [connection] id=eth0 type=ethernet interface-namw=eth0  [ipv4] address1=192.168.0.10/24,192.168.0.100 method=manual
[root@webserver2 ~]# cat /etc/NetworkManager/system-connections/eth0.nmconnection [connection] id=eth0 type=ethernet interface-namw=eth0  [ipv4] address1=192.168.0.20/24,192.168.0.100 method=manual

3.客户端

VMVare设置eth0网卡为NAT模式

[root@client ~]# cat /etc/NetworkManager/system-connections/eth0.nmconnection [connection] id=eth0 type=ethernet interface-namw=eth0  [ipv4] address1=172.25.254.200/24,172.25.254.2 method=manual dns=114.114.114.114;

二.实验配置

1.VS中打开内核路由器功能

[root@LVS boot]# echo "net.ipv4.ip_forward=1" > /etc/sysctl.conf

[root@LVS boot]# sysctl -p net.ipv4.ip_forward = 1

2.RS装上http服务

[root@LVS ~]# yum install httpd -y

3.VS安装LVS软件

[root@LVS boot]# dnf install ipvsadm -y

4.在RS上输入测试内容

[root@webserver1 ~]# echo webserver1 - 192.168.0.10 > /var/www/html/index.html [root@webserver1 ~]# systemctl enable --now httpd
[root@webserver2 ~]# echo webserver2 - 192.168.0.20 > /var/www/html/index.html [root@webserver2 ~]# systemctl enable --now httpd

5.在VS进行测试

[root@LVS boot]# curl 192.168.0.10 webserver1 - 192.168.0.10 [root@LVS boot]# curl 192.168.0.20 webserver2 - 192.168.0.20

6.在VS中添加调度策略

[root@LVS boot]# ipvsadm -Ln IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags   -> RemoteAddress:Port           Forward Weight ActiveConn InActConn  [root@LVS boot]# ipvsadm -A -t 172.25.254.100:80 -s rr [root@LVS boot]# ipvsadm -a -t 172.25.254.100:80 -r 192.168.0.10:80 -m [root@LVS boot]# ipvsadm -a -t 172.25.254.100:80 -r 192.168.0.20:80 -m  [root@LVS boot]# ipvsadm -Ln IP Virtual Server version 1.2.1 (size=4096) Prot LocalAddress:Port Scheduler Flags   -> RemoteAddress:Port           Forward Weight ActiveConn InActConn TCP  172.25.254.100:80 rr   -> 192.168.0.10:80              Masq    1      0          0            -> 192.168.0.20:80              Masq    1      0          0   

三.客户端测试

[root@client ~]# for i in {1..10} > do > curl 172.25.254.100 > done webserver2 - 192.168.0.20 webserver1 - 192.168.0.10 webserver2 - 192.168.0.20 webserver1 - 192.168.0.10 webserver2 - 192.168.0.20 webserver1 - 192.168.0.10 webserver2 - 192.168.0.20 webserver1 - 192.168.0.10 webserver2 - 192.168.0.20 webserver1 - 192.168.0.10

相关内容

热门资讯

透视私人局(微扑克)微扑克全自... 透视私人局(微扑克)微扑克全自动机器人(透视)详细辅助系统教程(竟然是真的有挂);1、超多福利:超高...
透视肯定!德扑起手牌胜率图,(... 透视肯定!德扑起手牌胜率图,(德州之星)确实有挂(详细辅助黑科技教程);1、点击下载安装,德扑起手牌...
透视了解(AAPOKEr)aa... 透视了解(AAPOKEr)aapoker外挂(透视)都是真的有挂(详细辅助扑克教程)一、aapoke...
透视挂(WPk)微扑克ai辅助... 透视挂(WPk)微扑克ai辅助(透视)详细辅助系统教程(总是是有挂)1、让任何用户在无需微扑克ai辅...
透视脚本!智星德州菠萝偷偷看牌... 透视脚本!智星德州菠萝偷偷看牌功能,(wpk德州)总是有挂(详细辅助AI教程)1、透视脚本!智星德州...
透视私人局(AAPOker)a... 透视私人局(AAPOker)aapoker俱乐部(透视)一直有挂(详细辅助细节方法)1)aapoke...
透视ai(微扑克)微扑克辅助软... 透视ai(微扑克)微扑克辅助软件(透视)详细辅助wepoke教程(一贯真的是有挂)1、完成微扑克辅助...
透视讲解!德州ai辅助,(手机... 透视讲解!德州ai辅助,(手机德州)总是有挂(详细辅助透视教程)运德州ai辅助辅助工具,进入游戏界面...
透视工具(AAPOKeR)aa... 透视工具(AAPOKeR)aapoker有外挂(透视)确实真的有挂(详细辅助曝光教程)1、构建自己的...
透视中牌率(wpK)微扑克辅助... 透视中牌率(wpK)微扑克辅助机器人(透视)详细辅助技巧教程(都是有挂)1、玩家可以在微扑克辅助机器...