Subject: Re: should the default route get a new interface automatically?
To: NetBSD Networking Technical Discussion List <tech-net@netbsd.org>
From: Alan Barrett <apb@cequrux.com>
List: tech-net
Date: 07/28/2001 12:25:06
On Fri, 27 Jul 2001, Greg A. Woods wrote:
> In playing around with different cards in my server I've been very
> frustrated by (among other things) having to manually reset the
> default route so that it picks up the new interface (I keep
> putting the local network address on different cards, physically
> reconnecting as necessary, during these tests).
>
> Shouldn't the default route automatically pick up the new interface just
> like link-level (ARP) entries do?

If I understand correctly, you are doing something like this:

	# 1. configure an interface
	ifconfig eth0 inet 10.2.3.4 netmask 255.255.255.0
	# 2. configure a default route
	route add default 10.2.3.1
	# 3. unconfigure the first interface
	ifconfig eth0 inet 10.2.3.4 netmask 255.255.255.0 delete
	# 4. configure a different interface
	ifconfig eth1 inet 10.2.3.4 netmask 255.255.255.0 delete

After step 2, the default route "knows" that it's through interface
eth0, even though you didn't tell it that.

After step 4, you would like the default route to be through interface
eth1, but it's still through eth0.

The NetBSD kernel doesn't do recursive route lookups (though that would
be a useful feature), so it's impossible to create a route in which the
interface is determined at packet forwarding time via recursive lookup;
the interface associated with a route is always determined at "route
add" time.

Since we don't have recursive route lookup, one could argue that the
ifconfig delete in step 3 should also have deleted the default route.

--apb (Alan Barrett)