Subject: Re: Getting laptop to auto-dhclient
To: Robert Elz <kre@munnari.OZ.AU>
From: Steven M. Bellovin <smb@research.att.com>
List: netbsd-users
Date: 10/11/2003 13:44:26
In message <17236.1065892334@munnari.OZ.AU>, Robert Elz writes:
> Date: Fri, 10 Oct 2003 23:49:27 -0500
> From: "Brian Grayson \(home\)" <bgrayson@austin.rr.com>
> Message-ID: <20031010234927.A1368@cs24279-4.austin.rr.com>
>
> | Is it possible for me to set up my laptop so that when I plug in
> | an Ethernet cable, it automatically invokes a script for me (to run
> | dhclient, etc.)?
>
>Unfortunately, not yet on NetBSD, this is something that is badly
>needed, and one day I might just get irritated enough...
>
> | Or is my best bet to have a shell script continue doing an ifconfig and
> | wait for the status to change from no-carrier to active, and sleep for 15
> | seconds between checks?
>
>If you're willing to wait a bit, just leave dhclient running on the interface
>from when you boot - it will just keep on trying (not very frequently though)
>until it succeeds. Unfortunately, if you then get a long lease (comparativel
>y
>long compared to how long you're actually connected), it won't notice when you
>disconnect from one LAN and plug into another.
>
>And this also doesn't work if the interface doesn't exist when you boot (as in
>a plug in card or device of some kind).
>
There's supposed to be an interface to dhclient that should make that
easier, but the documentation is sparse (arguably, non-existent) on how
to make it work. That doesn't solve the trigger problem -- my current
"solution" is to restart dhclient from /etc/apm/resume -- but it should
help with adding cards.
--Steve Bellovin, http://www.research.att.com/~smb