IP ROUTE and multi-path route splitting

IP ROUTE and multi-path route splitting

Post by Matthew G. Mars » Tue, 27 Mar 2001 05:50:04


Quote:> $ ip addr show tr0
> 5: tr0: <BROADCAST,MULTICAST,UP> mtu 2000 qdisc pfifo_fast qlen 100
>    link/[800] 40:00:de:ad:be:ef brd ff:ff:ff:ff:ff:ff
>    inet brd scope link tr0
>    inet6 fe80::4000:dead:beef/10 scope link
>    inet6 fe80::4200:deff:fead:beef/10 scope link

> $ ip addr show tr1
> 6: tr1: <BROADCAST,MULTICAST,UP> mtu 2000 qdisc pfifo_fast qlen 100
>     link/[800] 00:06:29:b0:59:63 brd ff:ff:ff:ff:ff:ff
>     inet brd scope link tr1
>     inet6 fe80::206:29ff:feb0:5963/10 scope link
>     inet6 fe80::6:29b0:5963/10 scope link

Npte that all ipv4 addresses on the system when leaving the system as
locally originated will appear to leave lo first. So to control them
with rules use the following type of structure:

ip rule add from dev lo table 1 prio 10000
ip rule add from  dev lo table 2 prio 20000

This will capture all originated traffic (such as host responses to pings
etc...) from each address and send it to a different table. Then you can
populate the tables as needed.


Quote:> If I change the default route thusly:
> $ ip route add default metric 1 src \
>    nexthop via dev tr0 nexthop via dev tr1

> Then things work fine, incomming requests are processed as normal, but
> it appears that outgoing requests are always sent via dev tr0

"appears" as in 'ip link sh dev tr1' never increases... or as in a tcpdump
on the ring only shows ip src ? Please supply the info if
possible as I suspect that that both tr interfaces are being used but the
src command is honored thus the src addresses will always look to be tr0.

IE: look at 'ip -s link show' and see if both tr0 and tr1 are increasing
the packets sent...

Quote:> If I leave off the src argument, then incomming smtp sessions to dev tr0
> ( are not properly handled - I'm guessing because the src address
> could be that dev tr1 (
> of tr1

Yes. In this case you could try variations on the rules above with both
route tables having the same default route with different src statements
but I suspect that is not exactly what you want.

Quote:> What am I misunderstanding...  What I was trying to achieve was:
>  *) Incomming requests are handled on whatever interface the're received on
>  *) Outgoing requests are handled on either interface

Your confusion stems from the fact that the ipv4 addresses are _not_
assigned to the interfaces per se but actually 'exist' as a definition of
a service (ipv4 transport) to the machine itself. Consider DECnetIV type
addressing with multiply connected hosts...  

Quote:> Is this more than can be done via ip route ?

No - but it is usually not seen for two cards connected to the same
physical network ;-}

Quote:> --
> Rick Nelson
> Life'll kill ya                         -- Warren Zevon
> Then you'll be dead                     -- Life'll kill ya

Matthew G. Marsh,  President
Paktronix Systems LLC
1506 North 59th Street
Omaha  NE  68104
Phone: (402) 932-7250

WWW:  http://www.paktronix.com

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


1. Load Balancing with Multi-path Routes


I'm trying to set up some sort of load-balancing on a Linux (Trustix)
gateway by using multipath routes, however I'm stuck with some problems.

The idea is that this gateway (odd as it may seem) only has one external
interface, which should route packets to two different gateways (Ciscos).
The gateway's external interface and the routers are all on the same
network, so this is a slightly different set up than the one described
in Linux Adv Routing HOWTO.

I successfully defined the multipath route, with two equal cost routes.
However, it doesnt matter how much traffic I generate on the gateway
(using many simultaneous wgets in mirror mode), it doesnt seem to distribute
the load among the two gateways, always using only one of them. I tried
both using and not using equalize, with the same result. I was carefull
to flush the route cache between each attempt.

Has anyone tried a similar setup (single interface + two gateways)? Is
this the proper way of doing such set up? Considering both routers are
on the same network of the gateway's external nterface (and I cannot
change that), would there be any other alternative? Would I absolutely
need Julian Anastasov's patches for that matter?

Here's how my routing table looks like (IPs changed to protect the innocent):

198.X.Y.0/24 dev eth0 proto kernel scope link src 198.X.Y.1 dev lo scope link
nexthop via 198.X.Y.2 dev eth0 weight 1
nexthop via 198.X.Y.3 dev eth0 weight 1

Any help would be greatly appreciated!

John Sinclair

2. smbmount'ing NT share: weird time and date problems

3. route problem: route forgot to specify route netmask.

4. Can't get applets to load form directorys other than current.

5. Routing problem with source-based routing and routing packets back to sender machine.

6. Linux on a 286?

7. policy routing (routing based on source IP)

8. stripeing disks

9. rtnetlink: network unreachable for Routing for multiple uplinks using ip route add

10. Q about the IP routing table and the routed

11. In kernel routing table vs. /sbin/ip vs. /sbin/route

12. multipath routing : ip route cache clear

13. tcp/ip routing question - overriding default route down the line?