Subject: Re: Getting laptop to auto-dhclient
To: Brian Grayson (home) <firstname.lastname@example.org>
From: Robert Elz <kre@munnari.OZ.AU>
Date: 10/12/2003 00:12:14
Date: Fri, 10 Oct 2003 23:49:27 -0500
From: "Brian Grayson \(home\)" <email@example.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 (comparatively
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).