Please Whitelist This Site?

I know everyone hates ads. But please understand that I am providing premium content for free that takes hundreds of hours of time to research and write. I don't want to go to a pay-only model like some sites, but when more and more people block ads, I end up working for free. And I have a family to support, just like you. :)

If you like The TCP/IP Guide, please consider the download version. It's priced very economically and you can read all of it in a convenient format without ads.

If you want to use this site for free, I'd be grateful if you could add the site to the whitelist for Adblock. To do so, just open the Adblock menu and select "Disable on tcpipguide.com". Or go to the Tools menu and select "Adblock Plus Preferences...". Then click "Add Filter..." at the bottom, and add this string: "@@||tcpipguide.com^$document". Then just click OK.

Thanks for your understanding!

Sincerely, Charles Kozierok
Author and Publisher, The TCP/IP Guide


NOTE: Using software to mass-download the site degrades the server and is prohibited.
If you want to read The TCP/IP Guide offline, please consider licensing it. Thank you.

The Book is Here... and Now On Sale!

The whole site in one document for easy reference!
The TCP/IP Guide

Custom Search







Table Of Contents  The TCP/IP Guide
 9  TCP/IP Application Layer Protocols, Services and Applications (OSI Layers 5, 6 and 7)
      9  TCP/IP Key Applications and Application Protocols
           9  TCP/IP Administration and Troubleshooting Utilities and Protocols

Previous Topic/Section
TCP/IP Administration and Troubleshooting Utilities and Protocols
Previous Page
Pages in Current Topic/Section
1
Next Page
TCP/IP Communication Verification Utility (ping/ping6)
Next Topic/Section

TCP/IP Host Name Utility (hostname)

They say the best place to start is at the beginning. Therefore, in examining TCP/IP administration and troubleshooting utilities, why not begin with the basics? One of the most fundamental of tasks in diagnosing problems with a networked computer is identifying it. Just as the first thing we usually do when we meet someone is exchange names, one of the first actions an administrator takes when accessing a device is to determine its name, if it is not known. This is accomplished using the hostname utility.

You may recall from our discussion of TCP/IP name systems that there are two different ways that hosts can be named. The first way is to manually assign “flat” names to devices using host tables or equivalent means; this is most often used for devices that not going to be accessed on the public Internet. The second is to give a device a domain name within the Domain Name System (DNS). The hostname utility can be used for both types of named hosts, but it functions in a slightly different way for each.

On most systems, including Windows and many UNIX implementations, the hostname utility is very, very simple. When the command is entered by itself on a line with no arguments, it displays the full name of the host. If it is entered with the “-s” (“short”) parameter, then if the host name is a fully qualified DNS domain name, only the local label of the node is shown and not the full domain name; if the host has a flat (non-DNS) name the parameter has no effect. A simple example is shown in Table 283.


Table 283: Using the hostname Utility To Check A Host Name

% hostname
fearn.pair.com
% hostname -s
fearn


The hostname utility is also intended to allow an administrator to set the name of a host. The syntax for this is also simple; you just supply the name of the host as a parameter, as follows:

hostname <new_hostname>

However, in most implementations, the use of the hostname command for setting a device’s name is either disabled or restricted. In Windows systems, a special applet in the Control Panel is used to set the device’s name; attempting to set it using hostname will result in an error message. In UNIX, the super-user of the system can use hostname to set the device’s name, but it is more common for this to be done by other means, such as editing the configuration file /etc/hosts. Obviously, if a simple flat name is being assigned to this host, the administrator has full control over it, while if DNS is used then the proper procedures for registering the name must be followed.

In most operating systems, the “-s” parameter is the only one that this command supports. The parameter is not supported on all implementations of the “hostname” command, however; on some of these, if you use “hostname -s”, the system may report its host name as being “-s”. On certain Linux systems, a few additional parameters are included that allow different ways for the host name to be displayed, as well as some miscellaneous functions such as showing the version number of the program.

Note: One point worth mentioning is that the hostname utility is not, strictly speaking, tied into the operation of DNS or other formal mechanisms for identifying a host. It simply displays what the administrator has set it to show. Obviously it makes sense for this to be set to the host’s DNS name, but there may be exceptions.


Key Concept: The simplest and most basic of TCP/IP administrative utilities is hostname, which returns the name of the host upon which it is run.



Previous Topic/Section
TCP/IP Administration and Troubleshooting Utilities and Protocols
Previous Page
Pages in Current Topic/Section
1
Next Page
TCP/IP Communication Verification Utility (ping/ping6)
Next Topic/Section

If you find The TCP/IP Guide useful, please consider making a small Paypal donation to help the site, using one of the buttons below. You can also donate a custom amount using the far right button (not less than $1 please, or PayPal gets most/all of your money!) In lieu of a larger donation, you may wish to consider purchasing a download license of The TCP/IP Guide. Thanks for your support!
Donate $2
Donate $5
Donate $10
Donate $20
Donate $30
Donate: $



Home - Table Of Contents - Contact Us

The TCP/IP Guide (http://www.TCPIPGuide.com)
Version 3.0 - Version Date: September 20, 2005

© Copyright 2001-2005 Charles M. Kozierok. All Rights Reserved.
Not responsible for any loss resulting from the use of this site.