The Role of nsswitchconf

Most people consider it evident that DNS is used to resolve host names to IP addresses. This, however, is not the case. On every Linux box, the file /etc/nsswitch.conf determines what exactly should happen when translating a host name to an IP address, and vice versa. Many things are specified in this file, but for resolving host names, only the following lines are important:

hosts: files dns networks: files dns

These two lines specify that for resolving host names, as well as network names, first "files" should be used. In that case, for resolving host names, the file /etc/hosts will be used, and for resolving network names, it will be the file /etc/networks. If the files don't contain more information about the given host, then the DNS subsystem will be used with that configuration. This way, an administrator can keep resolving the frequently accessed host locally and contact the DNS server only if the files don't have information about the host.

Was this article helpful?

0 0

Post a comment