Subject: laptops, wireless, and dhcp
To: None <tech-net@netbsd.org>
From: Steve Bellovin <smb@research.att.com>
List: tech-net
Date: 06/17/2004 13:29:49
I'm currently configuring a laptop for someone; given the likely usage
environment, setting up dhclient is going to be painful. I tend to
think that the model we're using is wrong. Windows XP, at least as
configured by IBM, seems to do it properly.
The machine will be used in both wireless (built-in am0 interface) and
wired mode. For fairly obvious reasons, it's generally better to use
the wired interface if it's available.
Right now, dhclient cycles through various media options for devices
listed in dhclient.conf. This is especially important for 802.11
devices, where there might be several combinations of keys. In a
fairly strong sense, dhclient shouldn't bother trying the DHCP protocol
unless it sees RF carrier on a wireless interface; similarly, it
shouldn't try DHCP on a wired interface if the cable is disconnected.
We almost have the right primitives. ifwatchd notices when my Ethernet
cable is connected or disconnected, though it doesn't do the same for
wi0. It's possible in theory (and, I'm told, on -current in practice,
though I haven't tried it yet) to add and delete devices from dhclient.
I suggest the following strategy for such environments:
Have an 802.11d (some would call it wifid, or even WiFid) that
tries various combinations of nwid and nwkey, until it sees a
carrier. Loop as needed, because 802.11 carrier can go away...
There may need to be some priority metrics in the config file
for this daemon
Have an enhanced (to use a config file instead of command line
arguments) ifwatchd (or a wrapper for it) notice the coming and
going of carrier on all specified interfaces, wired and
wireless. When carrier appears, use omapi to add those
interfaces to dhclient; similarly, delete interfaces when
carrier disappears.
Enhance dhclient to know about interface priorities -- run
DHCP on an interface if and only if there are no higher-priority
interfaces that respond properly to the protocol. If a higher-
priority interface should suddenly appear or suddenly respond,
unconfigure the IP address from the lower-priority interface.
(That one is a bit tricky -- you may have open connections.
At least, the default route should be taken away from the
low-priority interface.) The essential point is that dhclient
should -- or at least could -- get out of the carrier-finding
game on wireless nets, and should become cognizant of carrier
on all interfaces.
Does this sound like a reasonable approach?