4

According to Wikipedia, fully qualified host names end with a trailing period. Jonathan de Boyne-Pollard writes in No, that dot in the domain name of the URL is not a mistake (emphasis mine):

I omitted the trailing dot in the domain name in the http://example.com./ URL because it was a typographical error.

No, it wasn't. It was there for a reason. It made the domain name a fully qualified one, and thus unambiguous and not prone to search path spoofing.

I can use relative host names to refer to hosts within the same domain. What would happen if I set up a host named com on a local network? google.com. should still refer to Google as it's clearly fully qualified, but what about google.com? Shouldn't it refer to the machine in my local network? Would it? Why (not)? What network setup or services influence the behavior?

1 Answer 1

3

The behaviour of a local name that conflicts with a top-level domain is not well defined and may vary from one stub resolver to another. Therefore, the most useful answer to your question is: don't do it; if you do, you're asking for surprises.

The most likely defacto behaviour you're likely to encounter is glibc's behaviour as documented in the resolv.conf manpage. Assuming a search list is configured with your local domain appearing in it (briefly, either domain or search appears in /etc/resolv.conf and contain your local domain), your local host com.yourdomain.example.com. will take priority over the top-level domain com. when you query for com. Yet even so, it's a bad idea to rely on that, because in case the local search list is misconfigured, you will get the top-level domain com. instead of an error, which can lead to a possible information leak (especially if com. had resource records other than SOA and NS, which it doesn't, but still, don't take chances).

You must log in to answer this question.

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