Re: multipath routing and destination selection

From: Pascal Hambourg
Date: Wed Feb 10 2010 - 13:39:12 EST


Hello,

Aleksandar Ivanisevic a écrit :
>
> my kernel is 2.6.18-164.11.1.el5, so latest centos 5.4. I have a
> multipath route defined as:
>
> $ sudo /sbin/ip route show table 199
> default mtu 1496
> nexthop dev ppp3 weight 1
> nexthop dev ppp4 weight 1
> nexthop dev ppp5 weight 1
>
> According to the docs next hops should be assigned per-flow, which
> means each source/destination pair, right?

Yes, AFAIK.

> My problem is that every 60 seconds or so the route cache gets
> discarded, no matter if there is an existing connection or not. Most
> of the time new interface gets assigned to the flow causing all
> connections longer than 60 seconds to break at that point.

AFAIK, the connection should not "break" just because the interface has
changed unless there is some source address filtering on the links.

> Is there a way to say: I want every source/destination pair to
> initially get a random nexthop but then stick to it unless it doesn't
> exist any more or the cache is manually flushed.

In any case, I'm afraid you cannot assume a cache entry is never flushed
while the connection is established (it may just be inactive for a
while). If you must ensure that a connection will keep being routed
through the initially selected interface, you could use iptables to mark
the first packet with a different mark for each interface and then use
the mark to route all subsequent packets with a normal (non multipath)
route.

Example (uncomplete, but you get the picture) :

iptables -t mangle -A POSTROUTING -o ppp3 -j CONNMARK --set-mark 3
iptables -t mangle -A OUTPUT|PREROUTING -j CONNMARK --restore-mark

ip rule add fwmark 3 table <tablenum>
ip route add default dev ppp3 table <tablenum>
--
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html