Changing the hostname in FreeBSD is very simple. It can be done immediately using the hostname command while logged in as root:
Just replace new.hostname with your own desired name. It doesn't have to have the dot in it, it can be just "myhost", for example.
This changes the hostname for the current session only, which means that if you reboot it will be revert to the previous one. You can make sure the hostname change sticks permanently by editing the /etc/rc.conf file to add the following line:
Again, just replace new.hostname with your own. Also, if this line already exists you can just edit it to change the hostname. Once you save this file your hostname change will stick even after you reboot the machine.
That's all there is to it.
Leave a Reply