Gentoo Wiki




This guide is appropriate at least for baselayout-1.12.9 which was stable at time of writing. FQDN stands for Fully-Qualified Domain Name. For the purposes of this guide I will use the example "examplehost.exampledomain.tld" which should be replaced by your own hostname and domainname.

Removing any obsolete config files

First you should remove any old configuration files which might take precedence over the ones we are about to setup. To do this run:

rm /etc/hostname /etc/conf.d/domainname
Note: If you leave /etc/hostname present it will cause the following settings to fail.

Adding Hostname to /etc/conf.d/hostname

You need to take the hostname for your machine (the bit which appears before the first '.' usually) and put it in the hostname file. You have to edit /etc/conf.d/hostname so it is similar to the following:

File: /etc/conf.d/hostname

Adding Domainname to /etc/conf.d/net

Next take the domain name (the rest of it after the first '.' usually) and put it in the network config file. You need to edit /etc/conf.d/net and add the following (making sure it is the only line beginning with dns_domain :

File: /etc/conf.d/net

Modifying the Hosts file

Finally modify /etc/hosts to be able to resolve the hostname of the box without it being online: To do this make sure the line beginning has entries similar to the following

File: /etc/hosts       examplehost.exampledomain.tld examplehost localhost.localdomain localhost 
Note: The FQDN (examplehost.exampledomain.tld) is the first part of the line.

Verifying Changes

Simply log out and it should show the updated system name.

This is examplehost.exampledomain.tld (Linux x86_64 2.6.20-ck1) 21:45:49
Note: You may have to restart your network devices for the changes to take effect.
Retrieved from ""

Last modified: Thu, 02 Oct 2008 10:48:00 +0000 Hits: 64,500