Configuring DNS Server in Linux
Introduction
DNS or Domain Name System coverts website name like http://www.linuxsolutions.fr/ to an IP address 91.102.68.2. It is very important to covert hostname into IP address.
Testing DNS Resolution
DNS server resolves fully qualified domain name like www.linuxsolutions.fr into an IP address and this is know as forward lookup. While in reverse lookup DNS can find out fully qualified domain name associated with IP address.
One IP address could be associated to only one FQDN but many websites may have the same IP address. It means that forward lookup and reverse lookup may not match. Reverse lookup is handled by ISP hosting you website. There are many command in Linux to do lookups. Mostly used command is host command in Linux and nslookup in windows.
Host Command In Linux
Host command accept both parameters either fully qualified domain name or the IP address of the server. Here is forward lookup command to be used
[root@linux-server tmp]# host www.linuxsolutions.fr
www.linuxsolutions.com has address 91.102.68.2
[root@linux-server tmp]#
For reverse lookup
[root@linux-server tmp]# host 91.102.68.2
34.71.115.65.in-addr.arpa domain name pointer 65-115-71-34.myisp.net.
[root@linux-server tmp]#
Mostly forward and reverse entries do not match while the reverse entry matches with ISP entry.
Nslookup Command In Windows
Nslookup command is used on windows computer and provides the same results. Here is nslookup command
C:\> nslookup www.linuxsolutions.fr
Server: 10.2.3.4.my-site.com
Address: 192.168.2.200
Non-authoritative answer:
Name: www.linuxsoluitons.fr
Address: 91.102.68.2
C:\>
For reverse lookup
C:\> nslookup 91.102.68.2
Server: 10.2.3.4.my-site.com
Address: 91.102.68.2
Name: 65-115-71-34.my-isp.com
Address: 10.2.3.4
C:\>
Download and Install BIND Packages
It is easy to download and install Linux packages most of Linux packages and most of people want to know how to install and configure dns on redhat/fedora. First of download BIND package file and search it on internet or CD. Its name starts with package filename “bind” followed by its version number such as bind-9.2.2.p3.i386.rpm.
Starting BIND on Redhat/Fedora
Use chkconfig command to start BIND at boot time.
[root@linux-server tmp]# chkconfig named on
To start, stop, and restart BIND after booting, use:
[root@linux-server tmp]# /etc/init.d/named start
[root@ linux-server tmp]# /etc/init.d/named stop
[root@ linux-server tmp]# /etc/init.d/named restartYou have to restart BIND service each time you have made some changes to configuration file for package to take effect during run time.
/etc/resolv.conf File
DNS servers which not running BIND make use of /etc/resolv.conf configuration file to find out location of DNS server and domains.This file contains keywords and its values separated by commas. See below the example of this file.
Keywords In /etc/resolv.conf
Command Value
Nameserver It will show IP address of DNS nameserver. Only one entry per nameserver is accepted at one time.
Domain It is the local domain name used by default.
Search Referring to other servers because of its name without adding domain name. It is timing saving feature for referring to other servers using the same domain.













