Skip to Content
Linux Network Administrator's Guide, Second Edition
book

Linux Network Administrator's Guide, Second Edition

by Olaf Kirch, Terry Dawson
June 2000
Intermediate to advanced
512 pages
15h 18m
English
O'Reilly Media, Inc.
Content preview from Linux Network Administrator's Guide, Second Edition

Setting the Hostname

Most, if not all, network applications rely on you to set the local host’s name to some reasonable value. This setting is usually made during the boot procedure by executing the hostname command. To set the hostname to name, enter:

# hostname 
               name

It is common practice to use the unqualified hostname without specifying the domain name. For instance, hosts at the Virtual Brewery (described in Appendix A) might be called vale.vbrew.com or vlager.vbrew.com. These are their official fully qualified domain names (FQDNs). Their local hostnames would be 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.

Some people suggest using the domainname command to set the kernel’s idea of a domain name to the remaining part of the FQDN. 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 to which your host belongs. Instead, to ensure that the short form of your hostname is resolvable with all recent versions of the hostname command, either add it as an entry in your local Domain Name Server or place the fully qualified domain name in the /etc/hosts ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Linux Network Administrator's Guide, 3rd Edition

Linux Network Administrator's Guide, 3rd Edition

Tony Bautts, Terry Dawson, Gregor N. Purdy

Publisher Resources

ISBN: 1565924002Catalog PageErrata