How to configure DNS server in Linux?


I want to configure DNS server for my internal clients machines. Previously I was using windows server 2003 as an internel DNS server but now I want to switch to Red Hat Linux operating system.

I know that /etc/hosts will work just fine for 5-15 hosts.For configuring a name server in Linux. There are files




but i does't know that which one is used for configuring dns server.Please guide me that how can i configure it so my server will start resolving name to IP.

thanks in advance



/etc/resolv.conf is mainly the resolver configuration, like two DNS servers for resolving anything on the server, e.g. you can use google dns in them as follows :



/etc/named.conf is the main configuration file for bind and the dns zone files are located at /var/named/ .

I believe you are not just using shell and have X-Windows kde, gnome etc, and in that case you should be able to manage the zones and dns from gui.

Also are you looking to use the nameserver for public IP resolution or private IPs ?

Thanks "Riz" for your reply. Well I want to configure Red Hat Linux as a DNS server for my office. Preior I was using windows server 2003 as a internal DNS server with the domain xyz.local .

Now I want to use Linux DNS server. Kindly guide me that which file may I edit to configure DNS ? My clients machines are mostly on Fedora and Ubuntu .

Is there need to 1st update /etc/hosts file ? or it should be remain as it is .

I am using run level 3 and only working in terminal not GUI interface .

waiting for your reply ?

^^ why dont you install webmin

well in GUI interface we can do all things i know just like windows but i like to do all work in command line.In terminal it is easy do work and if i say to do troubleshooting is easy than GUI.

please if u know in command line configuration i should be thankful.

You haven't mentioned the version of Redhat you are using?

Anyway what you are looking to install is an authoritative DNS server. The most famous software for this is BIND.

To install bind on Redhat Enterprise Linux/Centos 4 or 5 you would do:

yum install bind-chroot

However, BIND is difficult to configure manually. Personally I use webmin to manage it on my server. Webmin is a web based control panel. You can run it in 3 runlevel easily. Install webmin using this guide I wrote.

You'll find BIND under the servers link on the left hand menu. I will be writing a guide on managing BIND using webmin shortly.

However, in brief:

- Enter the IPs separated by spaces that BIND will listen on for queries. You will find this option under addresses and topology.

- Then under "zone defaults" set the default entries if you like.

- Add the zones. Make sure you click on apply configuration on the top right when your done.

- Also open port 53 on your server (using iptables).

edit: you can test your server using the nslookup tool. For example: