Subject: strange routing behavior: wrong route picked
To: None <,>
From: Tad Hunt <>
List: tech-net
Date: 11/05/2002 16:54:47
I've attached what I think is the relevant output below.

Notice the route for, which should be reachable via
interface tun8.  For some reason that I cannot fathom, "route get" tells me that it's using the default route out the
"fe0" interface, instead of the the more specific route (which
appears to be marked UP) as far as I can tell.

According to route(4), the most specific route should be picked:

     "When routing a packet, the kernel will attempt to find the
     most specific route matching the destination.  (If there are
     two different mask and value-under-the-mask pairs that match,
     the more specific is the one with more bits in the mask.  A
     route to a host is regarded as being supplied with a mask of
     as many ones as there are bits in the destination).  If no
     entry is found, the destination is declared to be unreachable,
     and a routing-miss message is generated if there are any
     listers on the routing control socket described below.

Does anyone have any idea what is happening here?

If additional information would be helpful, let me know and I'll provide

* I'm running gated(8)

* I seem to notice this problem after bringing an interface down
  and back up.  It works correctly after the interface comes
  up the first time.  The "route get" starts returning the wrong route
  after the interface goes down and comes back up.



# ifconfig tun8
tun8: flags=51<UP,POINTOPOINT,RUNNING> mtu 576
        inet -> netmask 0xffffffff
# netstat -nr
Routing tables

Destination        Gateway            Flags     Refs     Use    Mtu  Interface
default        UGS         2     2194   1500  fe0
127                UR          0        0  33228  lo0          UH          1        3  33228  lo0        UH          0        0    576  tun8          UGH         0        3  33228  lo0
192.168.167        link#1             UC          0        0   1500  fe0      00:01:30:1e:4d:c0  UHL         1        0   1500  fe0
# route get
   route to:
destination: default
       mask: default
 local addr:
  interface: fe0
 recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
       0         0         0         0         0         0      1500         0