Setting hostname in FreeBSD when using dhclient
I experienced a problem for years on FreeBSD, but have never been motivated to
solve it until now. The problem presents when attempting to set FQDN of the
system (nastie.weller-fahy.com
). I set hostname
to the proper value in
/etc/rc.conf
.
hostname="nastie.weller-fahy.com"
When I type hostname
at the prompt, I am given the unqualified hostname,
nastie
. When it bit me tonight, I finally tried to find a solution, and
(shock of all shocks) found one!
So, to sum up, create an executable file /etc/dhclient-enter-hooks
with the
following content.
1 2 3 4 | #!/bin/sh check_hostname(){ hostname nastie.weller-fahy.com } |
Next time you reboot, the hostname
command will result in the FQDN of your
system, as it should.