contents
Next: Assigning IP-Addresses Up: Configuring TCP/IP Networking Previous: Another Example

Setting the Hostname

Most, if not all, network applications rely on the local host's name having been set to some reasonable value. This is usually done during the boot procedure by executing the hostname command. To set the hostname to name, it is invoked as
           # hostname name
It is common practice to use the unqualified hostname without any domain name for this. For instance, hosts at the Virtual Brewery might be called vale.vbrew.com, vlager.vbrew.com, etc. These are their official, fully qualified domain names. Their local hostnames would be only the first component of the name, such as vale. However, as the local hostname is frequently used to look up the host's IP-address, you have to make sure that the resolver library is able to look up the host's IP-address. This usually means that you have to enter the name in /etc/hosts (see below).

Some people suggest to use the domainname command to set the kernel's idea of a domain name to the remaining part of the FQDN. In this way you could combine the output from hostname and domainname to get the FQDN again. However, this is at best only half correct. domainname is generally used to set the host's NIS domain, which may be entirely different from the DNS domain your host belongs to. NIS is covered in chapter-gif.



Andrew Anderson
Thu Mar 7 23:22:06 EST 1996