Skip to contentSkip to conversation

DNAT problem

DISCUSSION Marco Berizzi 1 participant 1 message Oct 3, 2006 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw
Quoted 6 lines · Bo Yang

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