Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

$ hostname --fqdn
debian-q500

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

$ ping localhost
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.033 ms
64 bytes from localhost (127.0.0.1): 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 (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_req=1 ttl=64 time=0.029 ms
64 bytes from localhost (127.0.0.1): icmp_req=2 ttl=64 time=0.035 ms
...
share|improve this question

1 Answer 1

up vote 4 down vote accepted

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

The main key for an FQDN is the terminating full-stop. hostname.example.com is not fully-qualified; hostname.example.com. 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. –  noloader Jan 17 at 18:55
    
this SE page has a more detailed explanation. –  DopeGhoti Jan 17 at 18:58
    
Thanks DopeGhti. I'm tempted to ask if the domain part is optional. Let me dig back into Steven's books. –  noloader Jan 17 at 19:04
    
(moved into answer) –  DopeGhoti Jan 17 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 at 23:07

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.