Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In the absence of a domain name, is the name localhost considered fully qualified? Or is localhost always considered unqualified?

$ hostname --fqdn

$ ping debian-q500
PING debian-q500 ( 56(84) bytes of data.
64 bytes from debian-q500 ( icmp_req=1 ttl=64 time=0.044 ms
64 bytes from debian-q500 ( icmp_req=2 ttl=64 time=0.037 ms

$ ping localhost
PING localhost ( 56(84) bytes of data.
64 bytes from localhost ( icmp_req=1 ttl=64 time=0.033 ms
64 bytes from localhost ( icmp_req=2 ttl=64 time=0.043 ms

The reason I am asking is I am looking at a standard doc that specifically calls out a FQDN. And a FQDN is slightly different than a DNS name from the RFCs (I believe its RFC 1035):

$ dnsdomainname 

Under the DNS system, I believe localhost would be considered a non-DNS local name; but it might satisfy the FQDN requirement if listed as localhost. (note the trailing slash - thanks DopeGhoti).

In fact, I get different results when adding a trailing dot:

$ ping debian-q500.
ping: unknown host debian-q500.
$ ping localhost.
PING localhost ( 56(84) bytes of data.
64 bytes from localhost ( icmp_req=1 ttl=64 time=0.029 ms
64 bytes from localhost ( icmp_req=2 ttl=64 time=0.035 ms
share|improve this question
up vote 5 down vote accepted

localhost is not fully qualified; localhost.localdomain. is.

The main key for an FQDN is the terminating full-stop. is not fully-qualified; is. Common convention, if not official standard, says that an FQDN ought to be host.domain. rather than simply host., but again, the important thing is the . at the end to truly by fully-qualified.

share|improve this answer
Thanks DopeGhoti. Do you have a reference? Sorry to split hairs. I'm looking at a standards doc, so I'm trying to have more than a casual understanding. – jww Jan 17 '14 at 18:55
this SE page has a more detailed explanation. – DopeGhoti Jan 17 '14 at 18:58
(moved into answer) – DopeGhoti Jan 17 '14 at 19:11
You might do well to also explain that ping isn't a DNS diagnosis tool and that at least one proxy DNS server software hardwires the A resource record set for localhost.. – JdeBP Jan 17 '14 at 23:07
I agree that ping is not a good DNS test, but it can be considered a name resolution (writ large) test, in that using ping handles /etc/hosts entries and other mechanisms in addition to DNS. – DopeGhoti Jan 17 '14 at 23:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .