Name Resolution in UNIX

Can anybody tell me the name resolution mechanism in UNIX servers ??

In Windows 2000 it is DNS resolution first and then WINS resolution. What is the order in UNIX ?

Who is Participating?
Kent OlsenConnect With a Mentor Data Warehouse Architect / DBACommented:

Both posters are correct.

Older unix systems relied on the /etc/hosts file for name/address resolution.  As the DNS/Bind technology took hold, the "default" behavior was to search /etc/hosts, then query the DNS.

Most modern unix systems now allow the admin to select the search order.  The controlling file name changes depending up the unix/linux distribution.  /etc/nsswitch.conf is used in Linux environments, /etc/netsvc.conf is used by AIX, still another name (that I don't remember) is used by HP-UX.  I don't know what Solaris, et al, name their control file.

ls /etc/*.conf will list your "configuration" files which you can examine for a "hosts=" statement.  You can probably grep the list, but the statement is "free form" so it might take several attempts.

grep "hosts=" /etc/*.conf
grep "hosts =" /etc/*.conf

If your your system doesn't contain a control switch you can expect it to check the /etc/hosts file first.

Depends on the flavour of Unix, but you may have /etc/nsswitch.conf

Look at the hosts line in /etc/nsswitch.conf, it may be something like:
hosts: files nis dns

This would lokk at the local host file (/etc/hosts) first, then query you NIS server, then query the nameservers (DNS) that are specified in /etc/resolv.conf
On a linux system your /etc/host.conf file contains:

order hosts,bind

which means it will look for a hosts file, then query DNS. This will be similar on FreeBSD.

All Courses

From novice to tech pro — start learning today.