Subject: Re: Feature idea...
To: Peter Seebach <email@example.com>
From: Jason Thorpe <firstname.lastname@example.org>
Date: 02/02/1999 11:09:13
On Tue, 02 Feb 1999 11:16:11 -0600
email@example.com (Peter Seebach) wrote:
> Well, I'm stuck with a commute. I alternate between staying at a friend's
> house (fixed IP address, gateway, and DNS, and a hostname in his domain)
> and being at a meeting (dhcp, no hostname, needs proxies).
> It would be really nice if there were a way to have the system pick a strategy
> on boot.
> Proposal: 'etcswitch'. There would be directories /etc/switch/foo, and
> during boot, if 'etcswitch' is enabled, *before* normal config files are
> read, you get a little prompt on /etc/switch/*, letting you pick a
> configuration. (Before it nukes your old files, it presumably copies them,
> and you might have a few special ones like /etc/switch/previous.)
> Is this a good idea? A bad idea?
dhclient(8) can already do this for you! dhclient allows you to configure
"static leases" which it will try if it doens't discover any DHCP service
on the network you're plugged into.
So, I have configured static leases for the network at work (no DHCP) and
the network at a friend's house. (I use DHCP for my laptop at home.)
I have configured dhclient to try DHCP for 10 seconds, then start checking
the static leases. It does this by pinging the default router for each
lease. When it gets a response, it binds to that static lease. You can then
have it invoke an arbitrary script (default is /etc/dhcliet-script) when
that lease is bound.
It works pretty nicely.
Unfortunately, the only thing it can't handle are ppp connections for my
Ricochet, and the dialback server at work [for when I travel], but I have
a wrapper script that deals with those, or just invokes dhclient by default.
-- Jason R. Thorpe <firstname.lastname@example.org>