The /etc/nsswitch.conf
file is used to configure which services are to be used to determine information such
as hostnames, password files, and group files. The last two ones, password
files, and group
files in our case are not used, since we don't use NIS services on our server. Thus, we will focus on the hosts line in this file.
Edit the nsswitch.conf
file vi /etc/nsswitch.conf
and change the hosts line to read:
"hosts: dns files"
Which means, for programs that want to resolve an address. They should use the dns feature first, and the /etc/hosts
file if the DNS servers are not available or can't resolve the address.
Also, we would recommend deleting all instances of NIS services from each line of this file unless you are using NIS! The result should look like this:
passwd:files shadow:files group:files hosts:dns files bootparams:files ethers:files netmasks:files networks:files protocols:files rpc:files services:files automount:files aliases:files