getting DHCP-assigned IP address
Lowell Gilbert
freebsd-questions-local at be-well.ilk.org
Tue Dec 2 14:30:03 PST 2003
"Michael A. Smith" <msmith at code-fu.com> 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
More information about the freebsd-questions
mailing list