Subject: Interface specification in route(8)
To: None <tech-net@netbsd.org>
From: Lucio de Re <lucio@proxima.alt.za>
List: tech-net
Date: 02/22/1999 19:51:00
I seem to have an irresolvable problem, but I'm sure I'm just 
misunderstanding something.

I have the following active network configuration in a NetBSD-1.3.3-i386
system:

# netstat -in
Name  Mtu   Network       Address              Ipkts Ierrs    Opkts Oerrs  Coll
ne1   1500  <Link>        00:80:ad:af:a6:c7    84263     0      693     0     0
ne1   1500  192.168.30.16 192.168.30.22        84263     0      693     0     0
lo0   32976 <Link>                              4420     0     4420     0     0
lo0   32976 127           127.0.0.1             4420     0     4420     0     0
ppp0  1500  <Link>                             12758     0    12568     0     0
ppp0  1500  192.168.30.16 192.168.30.22        12758     0    12568     0     0
ppp1* 1500  <Link>                                 0     0        0     0     0
ppp2* 1500  <Link>                                 0     0        0     0     0
ppp3* 1500  <Link>                                 0     0        0     0     0
sl0*  296   <Link>                                 0     0        0     0     0
sl1*  296   <Link>                                 0     0        0     0     0
sl2*  296   <Link>                                 0     0        0     0     0
sl3*  296   <Link>                                 0     0        0     0     0

and I'm trying to add a default route via ne1, the gateway being 
192.168.30.17.

# route add default 192.168.30.17

The result is disappointing: 

Internet:
Destination        Gateway            Flags     Refs     Use    Mtu  Interface
default            192.168.30.17      UGS         0        0      -  ppp0
                                                                     ^^^^
127.0.0.1          127.0.0.1          UH          0        0      -  lo0
192.96.32.128/26   192.96.32.131      UGS         0        0      -  ppp0
192.96.32.131      192.168.30.22      UH          2     3793      -  ppp0
192.168.30.16/29   link#1             UC          0        0      -  ne1
192.168.30.17      00:c0:05:03:31:6d  UHL         1       16      -  ne1
192.168.30.22      00:80:ad:af:a6:c7  UHL         0     4388      -  lo0

I tried:

# route add -ifp ne1 default 192.168.30.17

but route(8) seems to expect something else after -ifp, it seems to try 
to resolve the "ne1".

Before I return to that, I tried -ifp 0 and -ifp 1, assuming that 
perhaps an index was required, but I got no results.  -ifa would seem 
to need an address, but 192.168.30.22 is assigned to both ne1 and ppp0, 
so it would not seem to act as a selector at all.

So, I looked at route(8)'s sources.  Can't quite figure out from the 
available information, not even after looking at /usr/include/netinet/
in_var.h what I'm supposed to understand IFP to mean.

Help, anyone?  Perhaps some indication where to look?  I have copies of 
TCP/IP Illustrated, if I should look there, but I honestly don't know 
where to start looking.

And while I'm asking, where could I find the updated traceroute(8) that 
automatically selects the most sensible interface rather than the first 
one?

++L

PS: seems I'm having trouble resubscribing to tech-net, so if you see 
this you might have to reply off the list to get to me :-(