FreeBSD DHCP Set Hostname ( Empty Hostname After Reboot )

In FreeBSD, you can set the hostname that your system uses to identify itself on the network using the hostname command. To configure the hostname for a system using DHCP, you can add the following line to the /etc/dhclient.conf configuration file:

send host-name "yourhostname";

Replace yourhostname with the hostname that you want to use for your system. Once you’ve made this change, you can restart the DHCP client to apply the new hostname:

sudo /etc/rc.d/dhclient restart

This will cause the DHCP client to send the hostname to the DHCP server when it requests a lease. The DHCP server will then use this hostname to update its DNS records and to assign IP addresses to your system.

However, if you find that the hostname is empty after a reboot, you can try adding the following line to your /etc/rc.conf file:

hostname="yourhostname"

Replace yourhostname with the hostname that you want to use for your system. This will ensure that the hostname is set correctly when your system boots up.

Note that changes to the /etc/dhclient.conf and /etc/rc.conf files may require a reboot or a restart of the relevant service to take effect.

Leave a Comment