Skip to contentSkip to conversation

is round-robin on interface aliases possible?

LARTC Stanislaw Pusep 2 participants 2 messages Oct 15, 2004 – Oct 16, 2004

lore
Share & tools
lore
#0 lore raw

Hello, I'm new to the list and iproute2 itself. I was searching for a way to simultaneously use several IPs on the *same network interface* for outbound traffic. Let me explain: I have eth0 interface to which I set 2 IP addresses; 192.168.0.1 and 192.168.0.2. Then I want to connect to Internet through 192.168.0.254 gateway using round-robin between those 2 addresses. The iproute2 usage that best fits my needs is
following: http://lartc.org/howto/lartc.rpdb.multiple-links.html
But I was unable to get it working, as it supposes I have 2 *interfaces*
while I have only 1 interface with aliases. I'm simply unable to set
the same gateway on both IPs as it seems to be per-device setting. I am aware that iptables is able to do it with:
iptables -t nat -A POSTROUTING -o eth0 -j SNAT -to-source 192.168.0.1-192.168.0.2
This actually doesn't fits my needs as it only applies to masquerade networks. Any suggestions?
Thanks for attention!
_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

#1 lore raw

On Fri, 15 Oct 2004 20:02:05 -0300, Stanislaw Pusep wrote

Quoted 7 lines

Hello, I'm new to the list and iproute2 itself. I was searching for a way to simultaneously use several IPs on the *same network interface* for outbound traffic. Let me explain: I have eth0 interface to which I set 2 IP addresses; 192.168.0.1 and 192.168.0.2. Then I want to connect to Internet through 192.168.0.254 gateway using round-robin between those 2 addresses. The iproute2 usage that best fits my needs is following:

Quoted 8 lines

http://lartc.org/howto/lartc.rpdb.multiple-links.html But I was unable to get it working, as it supposes I have 2 *interfaces* while I have only 1 interface with aliases. I'm simply unable to set the same gateway on both IPs as it seems to be per-device setting. I am aware that iptables is able to do it with: iptables -t nat -A POSTROUTING -o eth0 -j SNAT -to-source 192.168.0.1-192.168.0.2 This actually doesn't fits my needs as it only applies to masquerade networks. Any suggestions? Thanks for attention!

You can use nth and connmark extensions (patch-o-matic from
http://netfilter.org) with two route tables. This way you can get load balancing for ip dialogues.

--
Kind regards,
Tomasz Chilinski

_______________________________________________
LARTC mailing list / [email protected]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/