LVS的NAT模式
1 | 原理查看 https: //www .cnblogs.com /Yuanbangchen/p/16533261 .html |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 前期规则设置<br><br>CIP:192.168.10.50 LVS:192.168.10.100(VIP 对外) 192.168.80.100(DIP 对内) server2(RS): 192.168.80.110 gateway: 192.168.80.100 server3(RS): 192.168.80.120 gateway: 192.168.80.100 1.LVS服务器设置 a:director服务器上开启路由转发功能: vim /etc/sysctl .conf net.ipv4.ip_forward = 1 sysctl -p b:director设置 nat 防火墙: iptables -t nat -A POSTROUTING -s 192.168.0.0 /24 -j MASQUERADE #测试中没用设置 c:director设置: ipvsadm IPVSADM -A -t 192.168.10.100:80 -s wrr IPVSADM -a -t 192.168.10.100:80 -r 192.168.80.110:80 -m -w 1 IPVSADM -a -t 192.168.10.100:80 -r 192.168.80.120:80 -m -w 1 2.web服务器设置:安装httpd echo 192.168.80.110 RS1 > /var/www/html/index .html echo 192.168.80.120 RS2 > /var/www/html/index .html systemctl start httpd 3.客户端访问 while true ; do curl http: //192 .168.10.100 ; sleep 1; done <br><br>192.168.80.120 RS1192.168.80.110 RS2<em id = "__mceDel" style= "font-size: 13px; font-family: "PingFang SC", "Helvetica Neue", Helvetica, Arial, sans-serif" ><em id = "__mceDel" ><em id = "__mceDel" > < /em >< /em >< /em > |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律