0

Probably a noob question but please explain me what changes in name resolution if I add the trailing dot to a domain name? (hosts file is empty, shouldn't be a problem)

>>> print socket.getaddrinfo('google.com',0)[0][4][0]
216.58.212.238
>>> print socket.getaddrinfo('google.com.',0)[0][4][0]
64.233.167.113
  • 3
    Actually it's round-robin DNS. You will get random A record from pool of A records for this domain. You can check it with while or for cycle. – Navern Sep 8 '16 at 9:12
3

Two different things, adding a trailing dot . classifies the hostname as a fully qualified domain name (FQDN). Explicitly adding it prevents that a search domain might get appended.

I.e. with a search domain set to example.com. a hostname such as google.com without a trailing dot might get resolved as google.com.example.com.. (Many resolvers actively prevent that and treat any hostname that contains one or more dots as an implied FQDN and will append the trailing . rather than a search domain).

That is probably not what's happening in your google.com examples though.

The reason subsequent requests for the same record result in different answers is that multiple records have been defined, a load balancing technique called round-robin DNS.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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