Problem with dual Ethernet network routing and gateways

Walter Dnes waltdnes at waltdnes.org
Thu May 9 18:40:13 UTC 2013


On Thu, May 09, 2013 at 04:09:10PM +0100, Mark Jackson wrote

> If I add:-
> 
> $ route add default gw 10.0.0.1
> 
> ... I get a gateway on eth1 and my routing table becomes:-
> 
> $ route
> Kernel IP routing table
> Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
> default         10.0.0.1        0.0.0.0         UG    0      0        0 eth1
> default         10.1.0.1        0.0.0.0         UG    0      0        0 eth0
> 10.0.0.0        *               255.255.0.0     U     0      0        0 eth1
> 10.1.0.0        *               255.255.0.0     U     0      0        0 eth0
> 
> ... and then I *can* ping out on eth1.
> 
> So for a *dual* Ethernet system, how do I get both default gateway
> entries using ifup / ifdown / etc ?

  As the old saying goes... "there can only be one".  This applies to
default gw.  "Default" means "what to use if no other info is given".
The way to do it is to set routes for specific ranges, with higher
priority (i.e. lower "metric" values).  "Default" should be the lowest
priority (i.e. highest "metric") and will handle anything that the other
rules don't catch.  A programming analogy...

* Imagine a CASE construct where specific address ranges are handled by
  specific routes.

* "default gw" is equivalant to the "ELSE" clause in the CASE construct.
  I.e. it's the "none of the above" default.  Logically, there can only
  be one.

-- 
Walter Dnes <waltdnes at waltdnes.org>


More information about the busybox mailing list