Subject: Re: default gateway "unreachable"
To: Balaji Venkat <bvenkat@cisco.com>
From: Zdenek Salvet <salvet@ics.muni.cz>
List: tech-net
Date: 03/28/1999 21:15:42
> I am a newbie at this, but looks like the code for netbsd ought to have
> a lookup logic for the default gateway as well, if the route entry
> does not have an interface listed in it. 
> 
> If the lookup logic is there, then there is one last extra lookup to do
> to find the interface on which the packet is to be sent.
> 
> balaji venkat

You have to provide some info from which the outgoing interface
can be computed. The preferred way is to set correct addresses and
netmasks to your interfaces, you must provide explicit route otherwise.

> 
> (may be considered ill conceived by some who wouldnt
> expect the vendor at the other end to do the same thing 
> At 10:58 AM 3/12/99 +0100, Zdenek Salvet wrote:
> >> I'm relatively new to *BSD (but have previously used Linux on i386 and
> alpha)
> >> and have a question about routing:
> >> 
> >>  -----------+------------ LAN: a.a.a.56/29
> >>             |
> >>             | a.a.a.57
> >>          NetBSD/alpha box
> >>             | a.a.a.61
> >>             |
> >>             .
> >>             . ethernet bridge
> >>             .
> >>             | b.b.b.17
> >>         Linux router (my default gateway)
> >> 
> >> I know that's not very well designed, the NetBSD box should have
> >> a b.b.b.x address on it's outer interface, but at the moment I have
> >> to live with this.
> >> 
> >> Now I want to set the default gateway on the NetBSD box.
> >> 
> >> route add -iface -host b.b.b.17 a.a.a.61
> >> route add default b.b.b.17
> >> Here I get an error saying that the network is unreachable. He is right
> >> because the interface has no ip address in the b.b.b.x net.
> >> I've tried using -ifa and -ifp to select the interface, but with no luck.
> >> I studied the /sys/net/route.c and /sys/net/rtsock.c files and found out
> >> that -ifa and -ifp are not relevent in the decision if the network is
> >> reachable or not because they are not passed to the ifa_ifwithroute
> >> function.
> >
> >You could use "route add -net b.b.b -iface -link <interface name>".
> >Fix your addressing ASAP.


-- 
Zdenek Salvet                                              salvet@ics.muni.cz 
Ustav vypocetni techniky Masarykovy univerzity, Brno
tel.: ++420-5-41 512 257                           Fax: ++420-5-41 212 747
----------------------------------------------------------------------------
           If God had meant for us to be in the Army,
         we would have been born with green, baggy skin.