From owner-freebsd-questions@FreeBSD.ORG Tue Dec 2 14:30:03 2003 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 7882B16A4CE for ; Tue, 2 Dec 2003 14:30:03 -0800 (PST) Received: from rwcrmhc12.comcast.net (rwcrmhc12.comcast.net [216.148.227.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 68FA043FBD for ; Tue, 2 Dec 2003 14:30:02 -0800 (PST) (envelope-from freebsd-questions-local@be-well.ilk.org) Received: from be-well.no-ip.com ([66.30.200.37]) by comcast.net (rwcrmhc12) with ESMTP id <20031202223001014007999ce>; Tue, 2 Dec 2003 22:30:01 +0000 Received: by be-well.no-ip.com (Postfix, from userid 1147) id 64C7E77; Tue, 2 Dec 2003 17:30:01 -0500 (EST) Sender: lowell@be-well.ilk.org To: freebsd-questions@freebsd.org References: <3FCD0C92.7080508@code-fu.com> From: Lowell Gilbert Date: 02 Dec 2003 17:30:01 -0500 In-Reply-To: <3FCD0C92.7080508@code-fu.com> Message-ID: <444qwi4zva.fsf@be-well.ilk.org> Lines: 17 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: Re: getting DHCP-assigned IP address X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Dec 2003 22:30:03 -0000 "Michael A. Smith" writes: > Is there an easy way to get the IP address that DHCP has assigned to > an interface? > > I know I can do it the hard way -- parsing the results of ifconfig > with regular expressions -- but I suspect there's a much easier way. For most purposes, the easy way is to use the dhclient hooks scripts; that way, you don't need to poll the values, either. "man 8 dhclient-script" for details, but my /etc/dhclient-exit-hooks script is: if [ x$old_ip_address != x$new_ip_address ]; then /usr/local/bin/noip fi