Re: getting DHCP-assigned IP address

2003-12-02 Thread Lowell Gilbert
Michael A. Smith [EMAIL PROTECTED] 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
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: getting DHCP-assigned IP address

2003-12-02 Thread Toni Schmidbauer
On Tue, Dec 02, 2003 at 05:05:06PM -0500, Michael A. Smith wrote:
 Is there an easy way to get the IP address that DHCP has assigned to an 
 interface?

ifconfig fxp0 | grep 'inet ' | cut -f 2 -d ' '

hth,
toni
-- 
Kann man etwas nicht verstehen, dann urteile man | toni at stderror dot at 
lieber gar nicht, als dass man verurteile.   | Toni Schmidbauer
-- Rudolf Steiner| 


pgp0.pgp
Description: PGP signature