| Article Index |
|---|
| DNS resolution explained |
| Part 2 - Basic Dns Guide |
| All Pages |
DNS resolution is an important backbone to all name based network activities. Gain a good understand of DNS resolution on Unix by reading this article.
The article explains about Linux and Unix dns resolution, the config files involved and the common configurations and common problems / solutions reported by users.
The main related config files on most types of Linux and Unix are:
/etc/hosts file, /etc/resolv.conf file, /etc/nsswitch.conf file
Depending on the version and distribution more files maybe involved, but these files represent the corner stone of the configuration in terms of which files are processed and in which order they are used.
Basic example /etc/hosts file ( IPV4 based )
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.1.10 black
192.168.1.130 bigmac
Basic example /etc/resolv.conf file
nameserver 192.168.1.1
Basic example /etc/nsswitch.conf
[sshtest@littlemac ~]$ cat /etc/nsswitch.conf
#
# /etc/nsswitch.conf
#
# An example Name Service Switch config file. This file should be
# sorted with the most-used services at the beginning.
# Legal entries are:
#
# nisplus or nis+ Use NIS+ (NIS version 3)
# nis or yp Use NIS (NIS version 2), also called YP
# dns Use DNS (Domain Name Service)
# files Use the local files
# db Use the local database (.db) files
# compat Use NIS on compat mode
# hesiod Use Hesiod for user lookups
# [NOTFOUND=return] Stop searching if not found so far
#
# To use db, put the "db" in front of "files" for entries you want to be
# looked up first in the databases
#
# Example:
#passwd: db files nisplus nis
#shadow: db files nisplus nis
#group: db files nisplus nis
passwd: files
shadow: files
group: files
#hosts: db files nisplus nis dns
hosts: files dns
# Example - obey only what nisplus tells us...
#services: nisplus [NOTFOUND=return] files
#networks: nisplus [NOTFOUND=return] files
#protocols: nisplus [NOTFOUND=return] files
#rpc: nisplus [NOTFOUND=return] files
#ethers: nisplus [NOTFOUND=return] files
#netmasks: nisplus [NOTFOUND=return] files
bootparams: nisplus [NOTFOUND=return] files
ethers: files
netmasks: files
networks: files
protocols: files
rpc: files
services: files
netgroup: nisplus
publickey: nisplus
automount: files nisplus
aliases: files nisplus





