Multiple default routes - sorting by interface priority

Multiple default routes - sorting by interface priority

Post by Lasse K?rkk?inen / Troni » Sat, 04 Mar 2006 10:08:43



Hi,

I want to have my routes (obtained by the DHCP client) to be ordered so
that it will use eth0 (Gigabit Ethernet) whenever possible, eth1 (WiFi)
otherwise and finally ppp0 (GPRS) if all else fails.

This seems to be working fine as long as I manually keep the routes in the
correct order, but this is tricky when interfaces come and go all the time.

So, what would be a proper solution?

 
 
 

Multiple default routes - sorting by interface priority

Post by Antoine EMERI » Mon, 06 Mar 2006 21:02:52


=?UTF-8?B?TGFzc2UgS8Okcmtrw6RpbmVuIC8gVHJvbmlj?=

Quote:> Hi,

> I want to have my routes (obtained by the DHCP client) to be ordered
> so that it will use eth0 (Gigabit Ethernet) whenever possible, eth1
> (WiFi) otherwise and finally ppp0 (GPRS) if all else fails.

> This seems to be working fine as long as I manually keep the routes in
> the correct order, but this is tricky when interfaces come and go all
> the time.

> So, what would be a proper solution?

If you have control on the other network (partners on the other side of
each access point), you may use a dynalic routing protocol like RIP, OSPF
or BGP (using the Quagga daemon for exemple).

You may also try the linux ip route 2 'equalize' feature, that set many
root to a destination (default or specific) with weight for each one.

And last, you may write a script to check (ping, ...) link status and
add/remove route automaticaly.

Regards

 
 
 

1. Multiple default routes on multiple interfaces

I have two DSL lines from the same provider on two different static IPs
and two interfaces for my linux box.  I am not particularly worried
about load-balancing here.  I just want failover between the two lines,
with next-hop detection if possible.  The idea is that I don't need
heavy-weight applications like OSPF or BGP (since it's the same
provider), nor any fancy routers; just something that determines if
line 1 is down, switch the default route to line 2 (automatically:  I
know I can do it by hand, or even write a shell script).

For those who will ask, I did try a switch to bring everything to a
single interface and single IP on the linux box.  But when line 1 is
down, the default route and IP for line 1 won't work over line 2.
Initially, I thought it was an arp issue, but it wouldn't resolve after
several minutes, nor after arp -d.  The IPs are contiguous /29 networks
(which I have successfully combined into a /28), but it does not
failover properly.  In the "single interface" scenario, I would have to
assign a new default route *and* IP (and even source routing,
probably...).

I understand that iproute2 will/should allow multiple default routes,
but then it will round-robin based on destination (this is how I used
to setup Cisco behaviour and how I believe Solaris handles it).  But
what is the failure detection?  Link loss?  Next-hop down?  Anyone have
an easy solution to what should be relatively common?

2. 5-gig DDS 4mm DAT on 4.1.3 SPARC-20

3. multiple interface/links default routing

4. Sol 2.5.1 profile/environment problem

5. Two interfaces: Set default default route?

6. NS Communicator Upgrading???

7. Default Route always sets default interface

8. rc.inet1 or equivalent in redhat60

9. Routed, default routes and ppp0 interfaces ?

10. defunct routes (was Re: multiple default routes appear in solaris 2.5.1)

11. multiple default route routing

12. default secondary sort line in 'sort'