Linux – In resolv.conf, why do the search domains have a period after them

domain-name-systemlinuxresolv.conf

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

Best Answer

. 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."