Skip to contentSkip to conversation

Trying to load balance a port redirection

DISCUSSION Maxime 1 participant 1 message May 11, 2002

lore
Share & tools
lore

Maxime

author
#0 lore raw

Hi,

I'm trying to do a basic port redirect load balancing, here is what I tried :

while true; do echo serv1 | nc -l -p 4001; done &
while true; do echo serv2 | nc -l -p 4002; done &
iptables -t nat -F PREROUTING
iptables -t nat -I PREROUTING -p tcp --destination-port 1234 -j REDIRECT --to 4001-4002

But it doesn't work, I always get redirected on serv1. Note that it doesn't seems to work with DNAT --to my_extern_ip:4001-4002.

May someone help me please ?

--
Maxime