5

What's the difference between server.com and server.com. in the search section of an /etc/resolv.conf file?

user@host /etc/sysconfig/network-scripts $ head -n 3 /etc/resolv.conf
# Generated by NetworkManager
domain sub.company.com
search sub.company.com sub.company.com. company.com. company.com
MDMarra
  • 100,734
  • 32
  • 197
  • 329
CHK
  • 266
  • 2
  • 7

3 Answers3

8

. is the top-most point in the DNS hierarchy. com, org, net, etc are all under .. The reason that you don't see people type http://google.com. into their browsers or other applications is that over time, applications have been developed to "help" you by not requiring it. A proper FQDN still has a period at the end, though it doesn't matter much in most cases nowadays.

When you have multiple search suffixes that can be appended to a DNS query, specifying a period at the end will stop your client from trying to "help" you by appended additional suffixes. It basically is saying "This is the full, entire address. Don't try and append anything else."

MDMarra
  • 100,734
  • 32
  • 197
  • 329
  • Is there a difference "sub.company.com" and "sub.company.com." in the /etc/resolv.conf file? – Sush Apr 13 '18 at 21:16
5

Because fully qualified domain names always have a period at the end.

RFC 1034

Since a complete domain name ends with the root label, this leads to a
printed form which ends in a dot.  We use this property to distinguish between:

   - a character string which represents a complete domain name
     (often called "absolute").  For example, "poneria.ISI.EDU."

   - a character string that represents the starting labels of a
     domain name which is incomplete, and should be completed by
     local software using knowledge of the local domain (often
     called "relative").  For example, "poneria" used in the
     ISI.EDU domain.
NickW
  • 10,263
  • 1
  • 20
  • 27
2

If you do not have a '.' at the end, then other things from you search path might be appended to your hostname. However, I generally do not see this on search paths in /etc/resolv.conf files as the '.' at the end is used in a hostname specification.

If you /etc/resolv.conf had a search to include aaa.domain.com and bbb.domain.com when you request to resolve qqq, the resolver will try qqq, failing that try qqq.aaa.domain.com and then bbb.domain.com until either one succeeds or you have total failure.

In the same example if you put ddd.domain.com, the resolver would try ddd.domain.com, then try ddd.domain.com.aaa.domain.com and ddd.domain.com.bbb.domain.com in a similar manner.

If you put in ddd.domain.com. (note the final period), the resolver only searches ddd.domain.com ONLY and does not append anything from the /etc/resolv.conf search path.

mdpc
  • 11,856
  • 28
  • 53
  • 67