On Tue, May 21, 2002 at 08:02:51AM -0500, Matthew G. Marsh wrote:

> > If you have only one NIC card and you want to route both networks then you
> > simply have to do the following:
> >
> > Assume NET1 = 1.1.1.0/24 with address 1.1.1.1
> >        NET2 = 2.2.2.0/24 with address 2.2.2.2
> >
> > Then you have:
> >
> > ip addr add 1.1.1.1/24 dev eth0 brd +
> > ip addr add 2.2.2.2/24 dev eth0 brd +
> >
> > ip route add default via 1.1.1.254 src 1.1.1.1 table 1
> > ip route add default via 2.2.2.254 src 2.2.2.2 table 2
> >
> > ip rule add from 1.1.1.1/32 dev lo table 1 prio 15000
> > ip rule add from 2.2.2.2/32 dev lo table 2 prio 15500
> >
> > And make sure you do NOT have any default routes in table 254 (the main
> > routing table)

Why mustn't he have any default routes in table 254? It'd only be
used for all the other src's passing through his router, wouldn't it?

> 
> ---
> 
> > I'm asking you for this answer because you can explain so well.
> 
> <blush>...
> 
> > BTW, the default routes below don't have a "via" part. For a
> > broadcast medium like Ethernet is it not a must. And if not,
> > how would the gateway know which MAC it needs the frames to
> > send to as a next hop.
> 
> Originally on purpose - although not a good answer :-{. The answer below
> was a quick crib from my response to the "Weak Host" issue on BugTraq.
> There I was pointing out that such a route structure would bounce back
> requests through the appropriate interface thus 'emulating' a strong host.
> In that type of situation there is a default gateway associated with the
> network/interface combo already existing in table 254 (main). That is why
> in the response above to Roberto I stressed that table 254 (main) should
> not have any default routes but also added in the 'via' commands.
> 
> I have not tried to trace out the packet path under routing for the case
> where the default route merely specifies an interface but I have mostly
> concluded that there are two cases:
> 
> 1: There exists a 'default router' associated with the PREFIX in
>    table 254 with an appropriate 'via'

How would the entry for such a 'default router' look like?

> 2: There does not exist any other default route but there is multicast
>    and a router query mechanism available.

Wouldn't that just result in a 'default route' addition to the
main table which you wanted to avoid in the first place? At least
with dynamic routing protocols, that's what I'm seeing here.

Ramin

> #1 is my suspicion where the initial lookup in the RPDB obtains the
> interface default route and then a second lookup obtains the first viable
> 'via' from 254. #2 is somewhat obvious but needs to be complete. Hmmmm...

Reply via email to