In computer networking, a hostname (previously nodename) is a label that is assigned to a device connected to a computer network and that is used to identify the device in various forms of electronic communication, such as the World Wide Web. Hostnames may be simple names consisting of a single word or phrase, or they may be structured. Each hostname usually has at least one numeric network address associated with it for routing packets for performance and other reasons.

Internet hostnames

Internet hostnames may have appended the name of a Domain Name System

Syntax

Hostnames are composed of a sequence of labels concatenated with dots. For example, "en.wikipedia.org" is a hostname. Each label must be 1 to 63 octets long. The entire hostname, including the delimiting dots, has a maximum of 253 ASCII characters.

The Internet standards (Request for Comments) for protocols specify that labels may contain only the ASCII letters a through z (in a case-insensitive manner), the digits 0 through 9, and the hyphen-minus character ('-'). The original specification of hostnames required that labels start with an alpha character and not end with a hyphen. However, a subsequent specification permitted hostname labels to start with digits. Internationalized domain names are stored in the Domain Name System as ASCII strings using Punycode transcription.

While a hostname may not contain other characters, such as the underscore character (_), other DNS names may contain the underscore. Systems such as DomainKeys and service records use the underscore as a means to assure that their special character is not confused with hostnames. For example, _http._sctp.www.example.com specifies a service pointer for an SCTP-capable webserver host (www) in the domain example.com. Notwithstanding the standard, Chrome, Firefox, Internet Explorer, Edge, and Safari allow underscores in hostnames, although cookies in IE do not work correctly if any part of the hostname contains an underscore character.

However, it is valid to attempt to resolve a hostname that consists of an underscore. E.g. _.example.com. This is used by RFC 7816 to reduce the amount of information that is made available to intermediate DNS servers during an iterative query. The Query Name Minimisation feature is enabled by default in BIND 9.14.0.

The hostname en.wikipedia.org is composed of the DNS labels en (hostname or leaf domain), wikipedia (second-level domain), and org (top-level domain). Labels such as 2600 and 3abc may be used in hostnames, but -hi-, _hi_, and *hi* are invalid.

A hostname is considered to be a fully qualified domain name (FQDN) when all labels up to and including the top-level domain (TLD) name are specified. The hostname en.wikipedia.org terminates with the top-level domain org and is thus fully qualified. Depending on the operating system DNS software implementation, an unqualified hostname may be automatically combined with a default domain name configured into the system in order to complete the fully qualified domain name. As an example, a student at MIT may be able to send mail to "joe@csail" and have it automatically qualified by the mail system to be sent to joecsail.mit.edu.

General guidelines on choosing a good hostname are outlined in RFC 1178.

Example

saturn and jupiter may be the hostnames of two devices connected to a network named PC. Within PC, the devices are addressed by their hostnames. The domain names of the devices are ' and ', respectively. If PC is registered as a second-level domain name in the Internet, e.g., as ', the hosts may be addressed by the fully qualified domain names ' and '.

See also

  • , which often includes a hostname as part of its syntax

References