Joe Holden wrote:
Hi all,
Is it possible to get dhclient to resolve the ip its been given, and set
that as the hostname? (6.2-PRE)
For future reference, this really belongs on freebsd-questions. If you
know for sure that the DHCP server is going to send you a hostname,
then you can put this in your /etc/dhclient.conf:
request subnet-mask, routers, broadcast-address,
domain-name, host-name,
domain-name-servers;
(obviously those aren't all related to your hostname, but probably a
good idea anyway).
If you're talking about a laptop where you're not sure what the DHCP
server is going to send you, then I have this in /etc/rc.local:
for ip in `ifconfig | awk '/inet / {print $2}'`; do
case "${ip}" in
127.0.0.1|0.0.0.0) ;;
*) newhost=`host ${ip} | cut -f5 -d ' '`
case "${newhost}" in
''|*NXDOMAIN*) ;;
*\.*) hostname ${newhost%.}
sleep 1
break
;;
esac
;;
esac
done
Combine that with a default hostname in /etc/rc.conf[.local] and
you're good to go.
hth,
Doug
--
This .signature sanitized for your protection
_______________________________________________
freebsd-net@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-net
To unsubscribe, send any mail to "[EMAIL PROTECTED]"