Bo Yang wrote:
How to do the balance using nth match , can you give an example ?
For example , I have a gateway 111.111.111.111 which connected to my
own LAN .
And in LAN , I have four machines 10.0.0.1 - 10.0.0.4 to share the ssh
connection .
Could you tell me how to balance the ssh flow ?
I haven't exactly understood your question. However this is
an example:
$IPTABLES -t nat -A PREROUTING -d 111.111.111.111 --protocol tcp --dport 22
-m statistic --mode nth --every 4 -j DNAT --to 10.0.0.1
$IPTABLES -t nat -A PREROUTING -d 111.111.111.111 --protocol tcp --dport 22
-m statistic --mode nth --every 4 -j DNAT --to 10.0.0.2
$IPTABLES -t nat -A PREROUTING -d 111.111.111.111 --protocol tcp --dport 22
-m statistic --mode nth --every 4 -j DNAT --to 10.0.0.3
$IPTABLES -t nat -A PREROUTING -d 111.111.111.111 --protocol tcp --dport 22
-j DNAT --to 10.0.0.4