Skip to contentSkip to conversation

load balancing over a very large number of outgoing addresses?

DISCUSSION Chris Kanich 2 participants 2 messages Jul 27, 2007 – Jul 31, 2007

lore
Share & tools
lore
#0 lore raw

Hi,
I have recently developed a need to multiplex connections from within a NAT over several (hundred, even thousand if possible) external IPs. I can have all of these IPs routed to a single interface on my NAT box, however I am not exactly sure how to set up a random/round robin load balancing scheme such that outgoing connections from my network each get a random source address from my source address pool.

I have come across this how-to:
http://lartc.org/howto/lartc.rpdb.multiple-links.html

However it seems that I cannot scale these routing rules past 255 routes, and unlike the example, I am not multiplexing interfaces but only IPs in roughly a contiguous /16 range being routed to this linux machine.

Any suggestions on how to get this up and running would be greatly appreciated.

Many thanks,
Chris Kanich

#1 lore raw
Quoted 1 line · Chris Kanich

I have recently developed a need to multiplex connections from within a NAT over several (hundred, even thousand if possible) external IPs. I can have all of these IPs routed to a single interface on my NAT box, however I am not exactly sure how to set up a random/round robin load balancing scheme such that outgoing connections from my network each get a random source address from my source address pool.

If I understand what you are wanting to do correctly, that is many to many NAT, why not use a range of IP addresses on your SNAT rule? I.e.:

iptables -t nat -A POSTROUTING -j SNAT --to-source A.B.0.1-A.B.7.255

Would SNAT to an IP in the range of A.B.0.1 through A.B.7.255, thus a little over 2000 IPs.

One thing I'm not sure of is how the kernel decides which IP in the range to assign, though I bet someone on this mailing list can help better answer this.

Quoted 1 line

However it seems that I cannot scale these routing rules past 255 routes, and unlike the example, I am not multiplexing interfaces but only IPs in roughly a contiguous /16 range being routed to this linux machine.

*nod* I don't think this is what you are wanting to do.

Quoted 1 line

Any suggestions on how to get this up and running would be greatly appreciated.

See if what I presented above is any where close to what you are wanting to do.

Grant. . . .