HOWTO: Changing the hostname

From Sabayon Wiki
Revision as of 13:13, 20 August 2012 by Jomiel (Talk | contribs) (added Link to german article)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
i18n: de en tr

How to change the hostname of a computer running Sabayon Linux

In the example below I use the hostname "acertm8215" because I have an Acer TravelMate 8215 laptop, but obviously you can use whatever hostname you want.

During installation of Sabayon Linux you may have accepted the default hostname of "localhost", or you may have specified your own hostname (e.g. "sabayonx86", "neptune" or whatever). In either case, at some point you may want to change the current hostname, and this article explains how to do it.

1. Check the current hostname is properly configured

uname -a
hostname -f
hostname -a
hostname -d

2. Edit /etc/conf.d/hostname


File: /etc/conf.d/hostname


File: /etc/conf.d/hostname

3. Edit /etc/hosts


File: /etc/hosts localhost localhost.localdomain localhost


File: /etc/hosts acertm8215 localhost.localdomain localhost

4. Change the hostname stored in the kernel

To see the current hostname:

sysctl kernel.hostname

To change the current hostname:

sysctl kernel.hostname=acertm8215

5. Change netbios name in /etc/samba/smb.conf (as it defaulted to hostname "localhost")


File: /etc/samba/smb.conf
netbios name = localhost


File: /etc/samba/smb.conf
netbios name = acertm8215

6. Change the hostname in /etc/dhcp/dhclient.conf (otherwise it will still give your old hostname to other nodes on the network to which your PC is connected):


File: /etc/dhcp/dhclient.conf
send host-name "localhost";
supersede host-name "localhost";


File: /etc/dhcp/dhclient.conf
send host-name "acertm8215";
supersede host-name "acertm8215";

The above assumes that dhclient is the DHCP client running on your PC (dhclient is currently the DHCP client that Sabayon Linux uses by default). However, if you decide to use a different DHCP client (e.g. dhcpcd) then you will have to edit a different file.

7. Reboot (or restart networking).

8. Repeat Step 1 to make sure the new hostname is set up correctly.

Article created by Fitzcarraldo on 8 January 2009.