Subject: routes being deleted when they shouldn't be
To: None <tech-net@netbsd.org>
From: Steven M. Bellovin <smb@cs.columbia.edu>
List: tech-net
Date: 04/24/2006 22:25:17
A 'route delete default some-addr' is deleting default routes to other
addresses:

# netstat -rnf inet
Routing tables

Internet:
Destination        Gateway            Flags     Refs     Use    Mtu  Interface
0/8                link#1             UC          0        0      -  wm0 =>
default            192.168.2.2        UGS         3     3620      -  ath0
127/8              127.0.0.1          UGRS        0        0  33192  lo0
127.0.0.1          127.0.0.1          UH          6   178281  33192  lo0
192.168.2/24       link#2             UC          2        0      -  ath0
192.168.2.2        00:04:e2:cd:58:26  UHLc        1        0      -  ath0
192.168.2.163      127.0.0.1          UGHS        0        0  33192  lo0
192.168.2.164      127.0.0.1          UGHS        0        0  33192  lo0
192.168.2.240      00:00:24:c4:f4:40  UHLc        0        2      -  ath0
# route delete default 10.0.0.1
delete net default: gateway 10.0.0.1
# netstat -rnf inet
Routing tables

Internet:
Destination        Gateway            Flags     Refs     Use    Mtu  Interface
0/8                link#1             UC          0        0      -  wm0
127/8              127.0.0.1          UGRS        0        0  33192  lo0
127.0.0.1          127.0.0.1          UH          6   178301  33192  lo0
192.168.2/24       link#2             UC          2        0      -  ath0
192.168.2.2        00:04:e2:cd:58:26  UHLc        0        0      -  ath0
192.168.2.163      127.0.0.1          UGHS        0        0  33192  lo0
192.168.2.164      127.0.0.1          UGHS        0        0  33192  lo0
192.168.2.240      00:00:24:c4:f4:40  UHLc        0        2      -  ath0

This is a problem because of some interactions with dhclient.  I use both
a wired and a wireless interface at different times.  Suppose the wired
interface has a lease that hasn't expired when I switch to the wireless.
Dhclient binds properly to the wireless, but when the wired lease expires,
it deletes the wireless lease's default route.  

It isn't clear to me if the problem is with route deletion in the kernel
or if dhclient-script should behave differently.


		--Steven M. Bellovin, http://www.cs.columbia.edu/~smb