Custom Search

Ubuntu nsswitch.conf guide

Ubuntu nsswitch.conf is an important files regarding dns configuration. The nsswitch.conf is Name Service switch configuration file. Why does it important in dns configuration?

There are two important files in Ubuntu that directly deal with name server in mapping the host names and ip address. One is hosts file and the other is dns itself. This applied if you are not configuring NIS, of course. You can find these two files in nsswitch.conf configuration file. Open /etc/nsswitch.conf file using text editor or less command:

luzar@ubuntu:~$ sudo vi /etc/nsswitch.conf

Let's take a look at it more closely:

# /etc/nsswitch.conf
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc "Name Service Switch"' for information about this file.

passwd: compat
group: compat
shadow: compat

hosts: files dns
networks: files

protocols: db files
services: db files
ethers: db files
rpc: db files
netgroup: nis~

Let's take a look at the line hosts which I already highlighted in blue. The hosts is pointing for files contain name server in the system when there is a request for it. As you can see, there are two files, files and dns. The files mention in hosts is a local file, which is the /etc/hosts file. The other file is dns, domain name server. The files will be check first and dns second. That means, /etc/hosts can override information in the dns configuration file.

No comments:

Post a Comment

Please keep comment relevant and strictly no spam will be tolerated. Thank you.