# Hostname

> Mediated Wiki article. Canonical URL: https://mediated.wiki/source/Hostname
> Markdown URL: https://mediated.wiki/source/Hostname.md
> Source: https://en.wikipedia.org/wiki/Hostname
> Source revision: 1354459419
> License: Creative Commons Attribution-ShareAlike 4.0 International (https://creativecommons.org/licenses/by-sa/4.0/)

{{short description|Label that is assigned to a device connected to a computer network}}

In [computer networking](/source/computer_networking), a '''hostname''' (previously '''nodename''')<ref name = "System V AT, 1984">{{cite book |title=System V/AT Runtime System |publisher=Microport|url=https://archive.org/stream/MicroportSystemVDocumentation/Microport_System_V_AT_Runtime_System_djvu.txt}}</ref> is a label that is assigned to a device connected to a [computer network](/source/computer_network) and that is used to identify the device in various forms of electronic communication, such as the [World Wide Web](/source/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](/source/network_address) associated with it for routing packets for performance and other reasons.

== Internet hostnames ==
[Internet](/source/Internet) hostnames may have appended the name of a [Domain Name System](/source/Domain_Name_System)<ref name=":0" /> (DNS) domain, separated from the host-specific label by a period ("dot"). In the latter form, a hostname is also called a [domain name](/source/domain_name). If the domain name is completely specified, including a [top-level domain](/source/top-level_domain) of the Internet, then the hostname is said to be a [fully qualified domain name](/source/fully_qualified_domain_name) (FQDN). Hostnames that include DNS domains are often stored in the Domain Name System together with the [IP address](/source/IP_address)es of the host they represent for the purpose of mapping the hostname to an address, or the reverse process.

On the Internet, a hostname is a domain name assigned to a host computer. This is usually a combination of the host's local name with its parent domain's name. For example, ''en.wikipedia.org'' consists of a local hostname (''en'') and the domain name ''wikipedia.org''. This kind of hostname is translated into an IP address via the local [hosts file](/source/hosts_file), or the [DNS resolver](/source/DNS_resolver). It is possible for a single host computer to have several hostnames, but generally, the [operating system](/source/operating_system) of the host prefers to have one hostname that the host uses for itself.

Any domain name can also be a hostname, as long as the restrictions mentioned below are followed. So, for example, both ''en.wikipedia.org'' and ''wikipedia.org'' are hostnames because they both have IP addresses assigned to them. A hostname may be a domain name if it is properly organized into the Domain Name System. A domain name may be a hostname if it has been assigned to an Internet host and associated with the host's IP address.<ref>{{cite web |url=http://www.differencebetween.net/technology/difference-between-hostname-and-domain-name/ |title=Difference Between Hostname and Domain Name |date=11 December 2020 |access-date=2024-06-20}}{{better source needed|date=September 2024}}</ref>

==Syntax==
Hostnames are composed of a sequence of [labels](/source/DNS_label) concatenated with dots. For example, "en.wikipedia.org" is a hostname. Each label must be 1 to 63 [octets](/source/Octet_(computing)) long.<ref name=":0">[https://datatracker.ietf.org/doc/html/rfc1034#section-3.1 RFC 1034, Section 3.1 "Name space specifications and terminology"]</ref> The entire hostname, including the delimiting dots, has a maximum of 253 [ASCII](/source/ASCII) characters.<ref name = "Raymond, Microsoft devblog, 2012" >{{ Cite web | url = https://devblogs.microsoft.com/oldnewthing/?p=7873 | title = What is the real maximum length of a DNS name? | access-date = 31 July 2019 | first = Raymond | last = Chen | date = 12 April 2012 | website = [Microsoft](/source/Microsoft) devblog | archive-url = https://web.archive.org/web/20190518124533/https://devblogs.microsoft.com/oldnewthing/?p=7873 | archive-date = 18 May 2019  | df = dmy-all }}</ref>

The Internet standards ([Request for Comments](/source/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.<ref>{{ Cite IETF | rfc = 952 | title = DOD Internet Host Table Specification | date = October 1985 }}</ref> However, a subsequent specification permitted hostname labels to start with digits.<ref>{{ Cite IETF | rfc = 1123 | title = Requirements for Internet Hosts -- Application and Support | date = October 1989 }}</ref> [Internationalized domain name](/source/Internationalized_domain_name)s are stored in the Domain Name System as ASCII strings using [Punycode](/source/Punycode) transcription.<ref name="rfc3492">RFC 3492, ''Punycode: A Bootstring encoding of Unicode for Internationalized Domain Names in Applications (IDNA)'', A. Costello, The Internet Society (March 2003)</ref>

While a hostname may not contain other characters, such as the underscore character (''_''), other DNS names may contain the underscore.<ref>{{cite web|url=https://domainkeys.sourceforge.net/underscore.html|title=Underscores in DNS|access-date=2011-07-20}}</ref><ref>{{cite web|url=https://www.ietf.org/rfc/rfc1912.txt|title=Common DNS Operational and Configuration Errors|access-date=2018-08-21}}</ref><ref>{{Cite IETF |title=Clarifications to the DNS Specification |rfc=2181 |sectionname=Name syntax |section=11 |page=13 |last1=Elz |first1=Robert |authorlink1=Kevin Robert Elz |last2=Bush |first2=Randy |authorlink2=Randy Bush (scientist) |date=July 1997 |publisher=[IETF](/source/IETF) |access-date=May 23, 2024 |doi=10.17487/RFC2181 }}</ref> Systems such as [DomainKeys](/source/DomainKeys) and [service records](/source/SRV_record) 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](/source/SCTP)-capable webserver host (www) in the domain ''example.com''. Notwithstanding the standard, [Chrome](/source/Google_Chrome), [Firefox](/source/Firefox), [Internet Explorer](/source/Internet_Explorer), [Edge](/source/Microsoft_Edge_(series_of_web_browsers)), and [Safari](/source/Safari_(web_browser)) allow underscores in hostnames, although cookies in IE do not work correctly if any part of the hostname contains an underscore character.<ref>[http://blogs.msdn.com/b/ieinternals/archive/2009/08/20/wininet-ie-cookie-internals-faq.aspx Internet Explorer Cookie Internals (FAQ)]</ref>

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.<ref>{{cite IETF | title = DNS Query Name Minimisation to Improve Privacy | rfc = 7816}}</ref> The Query Name Minimisation feature is enabled by default in [BIND](/source/BIND) 9.14.0.<ref>{{cite web|url=https://www.isc.org/blogs/qname-minimization-and-privacy/|title=QNAME Minimization and Your Privacy|date=6 March 2019|access-date=2019-07-17}}</ref>

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](/source/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](/source/MIT) may be able to send mail to "joe@csail" and have it automatically qualified by the mail system to be sent to ''joe{{@}}csail.mit.edu''.

General guidelines on choosing a good hostname are outlined in RFC 1178.<ref>{{cite news |last1=Libes |first1=D. |title=Choosing a Name for Your Computer |url=https://datatracker.ietf.org/doc/html/rfc1178 |newspaper=Ietf Datatracker |date=August 1990 |publisher=IETF (Integrated Systems Group/NIST) |access-date=21 November 2021}}</ref>

==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 ''{{Not a typo|saturn.PC}}'' and ''{{Not a typo|jupiter.PC}}'', respectively. If ''PC'' is registered as a second-level domain name in the Internet, e.g., as ''{{Not a typo|PC.net}}'', the hosts may be addressed by the fully qualified domain names ''{{Not a typo|saturn.PC.net}}'' and ''{{Not a typo|jupiter.PC.net}}''.

==See also==
* {{Annotated link|Domain hijacking}}
* {{Annotated link|Host (network)}}
* {{Annotated link|Uniform Resource Identifier}}, which often includes a hostname as part of its syntax

==References==
{{Reflist}}

Category:Computer networking
Category:Identifiers

---
Adapted from the Wikipedia article [Hostname](https://en.wikipedia.org/wiki/Hostname) by Wikipedia contributors ([contributor history](https://en.wikipedia.org/wiki/Hostname?action=history)). Available under [Creative Commons Attribution-ShareAlike 4.0 International](https://creativecommons.org/licenses/by-sa/4.0/). Changes may have been made.
