Subject: static route strangeness
To: None <tech-kern@netbsd.org, tech-net@netbsd.org>
From: Tad Hunt <tad@entrisphere.com>
List: tech-net
Date: 10/26/2002 20:29:27
I've recently encountered some problems attempting to maintain a
some static routes.

Specifically, it appears as though NetBSD computes the interface
and MTU used to reach the gateway at the time the static route is
entered into the routing table.  This information appears to be
stored in the routing table along with the destination, mask, and
gateway (netstat -nr).

Furthermore, it appears as though bringing a new interface up, or
modifying the MTU of an existing interface doesn't cause any existing
routes to be updated with the new information.

For example:

	ifconfig fxp0 192.168.1.1 netmask 0xffffff00 up

	route add -net 192.168.10.0 192.168.2.2

	ifconfig fxp1 192.168.2.1 netmask 0xffffff00 up

After bringing the second interface up, I would have expected the
routing table entry for 192.168.10.2 to become associated with
fxp1.  Instead, netstat(1) shows that it is still associated with
fxp0.

This behavior makes interface and routing table management extremely
difficult because it effectively requires the routing table to be
flushed and reconstructed every time an interface is brought up or
down, or the MTU changes.

I believe that the correct behavior is to update the routing table
whenever an interface address, netmask, or MTU is modified.

I have a some questions:

1) Is there some way to configure my system such that the routing table
   will automatically be updated?

2) Is there a specific reason that the routing table behaves the way
   I described, or is this a problem that nobody has attacked yet?

3) Does anyone have any other suggestions on how to maintain the
   routing table when faced with interface changes over time?

-Tad