TCP/IP Configuration  «Prev   Next»

Lesson 11 Single Machine Host Names
Objective Two ways that a Single Machine receives its host names

Two ways a Single Machine receives its Host Names

Question: What are two ways that a single machine receives its host names?
A single machine receives its host names from more than one place. First, there is the host name returned by the uname command:

host$ uname -n
splinter.acme.com

This host name is set using the hostname command; only root can do this:
host# hostname splinter.acme.com

The name service

Another potential source of host name is the name service, whether from /etc/hosts, DNS, or NIS/NIS+. If you want these names to be the same, you have to make sure they agree with one another. On Linux machines, the hostname command takes options that make it clear which name you are asking about; for example, the name obtained from the resolver library is obtained from hostname -f:

host# hostname -f
splinter.acme.com

Most UNIX machines do not offer this option to hostname, and leave it up to you to remember where the name is coming from.