Kamis, 04 Juli 2019

Changing DNS Search Order


Changing DNS Search Order

 

/etc/nsswitch.conf


Open /etc/nsswitch.conf file using text editor:

# vi /etc/nsswitch.conf

Look for hosts:

hosts: files dns mdns4

Set above order as per your requirement. Close and save the file.

host.conf – resolver configuration file


The file /etc/host.conf contains configuration information specific to the resolver library. It should contain one configuration keyword per line, followed by appropriate configuration information.

Open /etc/host.conf file

# vi /etc/host.conf

Find order line which specifies how host lookups are to be performed. It should be followed by one or more lookup methods, separated by commas. Valid methods are bind (dns server), hosts (/etc/hosts file), and nis (old method).

order hosts,bind
Save and close the file.


conclusion

 

The file /etc/nsswitch.conf will let you reconfigure the order of the name resolution. By default, the host file is the first, then the configured DNS. There could be more options.
The file /etc/hosts only lists IP addresses and hostnames (multiple names for one IP if you want) The file /etc/resolv.conf will list the default search domains, and will also list in sequence the name servers to use.

Tidak ada komentar: