two links to default gw

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

shaping seems to be a hot topic at this list.  I hope nobody will be
bored with my silly routing problem.

What happens if there is a route to a network via two interfaces?  From
the NAG2:
,-----
|While both routes match the destination, one of the routes has a larger
|netmask than the other. [...] The larger a netmask is, the more
|specifically a target address is matched; when routing datagrams, we
|should always choose the route that has the largest netmask.
`-----

Okay, but if netmasks are the same size?  Actually my routing table
looks linke this:

root@harbard [~] # ip route show
10.0.0.0/24 dev wlan0  proto kernel  scope link  src 10.0.0.6
10.0.0.0/24 dev ipsec0  proto kernel  scope link  src 10.0.0.6
192.168.0.0/24 dev eth0  proto kernel  scope link  src 192.168.0.6
127.0.0.0/8 via 127.0.0.1 dev lo  scope link
default via 192.168.0.7 dev eth0

10.0.0.0/24 can be reached via wlan0 and ipsec0.  Which route is taken?
I couldn't find anything enlighting about this in the lartc-howto.

More specifically my network looks like this:

(eth0)  .0.6                    .0.7 (eth0)
      ,----.                    ,----.
      |    +-- 192.168.0.0/24 --+    | 0/0
      | NB |                    | GW +-----
      |    +~~~ 10.0.0.0/24 ~~~~+    |
      `----'                    `----'
(wlan0) .0.6                    .0.2 (eth2)

There are two possible connections between GW and NB (which is only an
example for more hosts in this network).  Normally NB uses
192.168.0.0/24 to reach GW, but sometimes this suddenly breaks down (I
pull the plug).  In this cases NB should use 10.0.0.0/24 to reach its
GW.  This would be very simple, just switch the default gw and go on.
But, side condition: established TCP sessions (eg. shells) must not
break down then switching, so IP numbers have to stay the same.

No problem for NB: I can use ifplugd to detect eth0: linkbeat down and
throw a 'ip route replace default via 10.0.0.2 dev wlan0 src
192.168.0.6'.  But GW will still think NB is reachable via eth0 and
route packets to it via 192.168.0.0/24.  I can't use ifplugd there cause
other hosts are still connected via a switch.  This hosts, of course,
must remain connected via eth0.

Can I make GW to know that NB is reachable via both eth0 and eth2?  Can
it fall back to eth2 when connection via eth0 fails?  Is this still
matter of static routing or do I have to do something dynamically?  How?
Any resources on this topic?

Thanks in advance and sorry for my bad english,
 regards, Frank.
-- 
Sigmentation fault
_______________________________________________
LARTC mailing list / LARTC@xxxxxxxxxxxxxxx
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/

[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux