FreeBSD Change Hostname without reboot

http‮.www//:s‬lautturi.com
FreeBSD Change Hostname without reboot

To change the hostname of a FreeBSD system without rebooting, you will need to follow these steps:

  1. Edit the /etc/rc.conf file. Open the /etc/rc.conf file in a text editor, such as vi or nano, and find the hostname line. This line specifies the hostname of the system.

  2. Change the hostname. Change the hostname to the new hostname that you want to use.

For example, to change the hostname to new-hostname, you would change the hostname line to:

hostname="new-hostname"
  1. Save the /etc/rc.conf file. Save the changes to the /etc/rc.conf file and exit the text editor.

  2. Change the hostname in the /etc/hosts file. Open the /etc/hosts file in a text editor, and find the line that specifies the local hostname. Change the hostname to the new hostname that you specified in the /etc/rc.conf file.

For example, if the line reads:

127.0.0.1       localhost

You would change it to:

127.0.0.1       new-hostname
  1. Restart the network service. Restart the network service using the service command:
service netif restart

This will apply the changes to the hostname without rebooting the system.

Created Time:2017-10-28 20:40:33  Author:lautturi