当前位置:网站首页>Iptables for load balancing
Iptables for load balancing
2022-07-22 20:22:00 【Menon poet】
Main rules
Rule one :( There is something wrong with the verification )
iptables -t nat -I PREROUTING -p tcp -d 192.168.200.154/24 --dport 80 -m statistic --mode random --probability 0.5 -j DNAT --to-destination 192.168.200.157:80
iptables -t nat -I PREROUTING -p tcp -d 192.168.200.154/24 --dport 80 -j DNAT --to-destination 192.168.200.158:80
Rule 2 :( Verification is OK )
iptables -t nat -A PREROUTING -d 192.168.200.154 -p tcp --dport 80 -m statistic --mode nth --every 2 --packet 0 -j DNAT --to-destination 192.168.200.157:80
iptables -t nat -A POSTROUTING -s 192.168.200.157 -p tcp --sport 80 -j SNAT --to-source 192.168.200.154
iptables -t nat -A PREROUTING -d 192.168.200.154 -p tcp --dport 80 -j DNAT --to-destination 192.168.200.158:80
iptables -t nat -A POSTROUTING -s 192.168.200.158 -p tcp --sport 80 -j SNAT --to-source 192.168.200.154
Test results ( Rule 2 )
- The screenshot of network configuration is as follows :
- Two nginx Services are bound with two virtual IP Here's the picture :
- Add the corresponding rule as follows :
Pictured above , Just after adding rules, the packets on the connection are 0.
- visit 10 Pages are shown in the figure below :
- The connection will be loaded into two rule chains , Here's the picture :
边栏推荐
猜你喜欢
【C】二叉树遍历的递归与非递归写法
euler五十讲(一)
HDU5667 Sequence
Kotlin learning 1: variables, functions, conditional statements and loop statements
Elastic Search 学习入门之中文检索(八)
Neo4j安装教程
Websites jump inexplicably. What is website hijacking from Baidu? DNS hijacking (domain name hijacking) what is DNS hijacking
Plug in installation of elastic search getting started (5)
PyTorch学习——利用梯度下降法实现一元线性回归
What should I do if the web page is hijacked? How to repair DNS hijacked? Introduction to web hijacking
随机推荐
Easy operation commands of ES for getting started with elastic search (II)
蓝桥杯省赛训练营——日期的计算
Plug in installation of elastic search getting started (5)
Matlab FFT参数设置研究
rp文件chrome浏览器查看插件
Replace some escape characters with characters of the specified standard
canny边缘检测
蓝桥杯省赛训练营——常用STL
机器学习入门:线性回归-1
Redis 存取 JSON 数据
数据库使用QueryRunner模拟封装
常见的网站被黑被劫持的手段有哪些?dns劫持工具有那些?
Spark资料查找
Elastic Search 学习入门之生产环境下node.master和node.data的设置(三)
What is Baidu snapshot hijacking? Baidu snapshot hijacking principle and solution
【C】二叉树遍历的递归与非递归写法
使用Modelsim独立仿真Altera及Xilinx IP核
RAG小结
Elastic Search 学习入门之中文检索(八)
转载:缓存一致性(Cache Coherency)入门