Skip to contentSkip to conversation

basic load distribution using -m statistic --mode nth

DISCUSSION Per Jessen 2 participants 2 messages Mar 27, 2008

lore
Share & tools
lore

Per Jessen

author
#0 lore raw

I'm trying to set up basic load distribution using the following:

iptables -t nat -A OUTPUT -d $addr -p udp --dport 53 -m statistic --mode nth --every 2 --packet 0 -j DNAT --to $fe1 iptables -t nat -A OUTPUT -d $addr -p udp --dport 53 -m statistic --mode nth --every 2 --packet 1 -j DNAT --to $fe2

(I know I can achieve pretty much the same using "options rotate" in resolv.conf, but humour me).

I'm testing the setup with a simple "dig <host>", and it seems to be working, except that I get a hang ("no servers could be reached") on every 4th query. It is a consistently reproducable behaviour.

I'm using iptables 4.0 and kernel 2.6.24.3. Can anyone spot anything I've missed?

thanks
Per Jessen, Zürich

#1 lore raw
Quoted 10 lines · Per Jessen

I'm trying to set up basic load distribution using the following:

iptables -t nat -A OUTPUT -d $addr -p udp --dport 53 -m statistic --mode nth --every 2 --packet 0 -j DNAT --to $fe1 iptables -t nat -A OUTPUT -d $addr -p udp --dport 53 -m statistic --mode nth --every 2 --packet 1 -j DNAT --to $fe2

(I know I can achieve pretty much the same using "options rotate" in resolv.conf, but humour me).

Quoted 7 lines

I'm testing the setup with a simple "dig <host>", and it seems to be working, except that I get a hang ("no servers could be reached") on every 4th query. It is a consistently reproducable behaviour.

I'm using iptables 4.0 and kernel 2.6.24.3. Can anyone spot anything I've missed?

DNAT is terminal, so you need:

rule 1: --every 2 --packet 0
rule 2: unconditional