Linux: Install DNS Resolver for Private Use – The Simplest Way

DNS resolver is really needed in order to help resolving domain name to IP address. The most popular public DNS resolver should be Google resolver and

For some cases, if you have web server in DMZ, your web server IP should be different when pinging from internal network or external network. This situation has lead me to run our own private DNS resolver since the development team need to have the development server run with domain name (due to URL binding and some programming stuff requirement). The domain name that I will use to resolve locally is, while other domains will resolve correctly same as public DNS resolver.

I will show you how I do that with most simplest way, using yumBind and Webmin. Variables as follow:

OS: CentOS 6 64bit
Hostname: dns.local
Internal web server IP:
DNS Zone:

1. Install Bind using yum:

yum install bind* -y

2. Download Webmin so we can easily manage the zone via web-based interface:

echo "[Webmin]" > /etc/yum.repos.d/webmin.repo

echo "name=Webmin Distribution Neutral" >> /etc/yum.repos.d/webmin.repo

echo "#baseurl=" >> /etc/yum.repos.d/webmin.repo

echo "mirrorlist=" >> /etc/yum.repos.d/webmin.repo

echo "enabled=1" >> /etc/yum.repos.d/webmin.repo

cd /tmp


rpm --import jcameron-key.asc

yum -y install webmin

3. Start the Webmin service:

service webmin start

4. Allow port 10000 in IPtables. Open /etc/sysconfig/iptables via text editor and add following line BEFORE any “-j REJECT” word:

-A INPUT -p tcp -m tcp --dport 10000 -j ACCEPT

5. Restart the IPtables:

service iptables restart

6. Access the Webmin interface via and login user root with the root password. We are going to use Webmin from now on. Lets initialize BIND DNS server first. After login go to Servers > BIND DNS Server > Select “Setup as an internet name server, and download root server information” > Click “Create Primary Configuration File and Start Nameserver” :

7. Configuration done. Lets create our domain to be resolved locally. Go to “Create master zone” and enter required information. Example as below:

8. Now we lets add required A record information. Go to “Address” and enter the host value with IP address as example below:

9. Once host record complete, we need to click “Apply Zone” at top corner of the page to reload the DNS zone with new value. To double check, you can click “Edit Records File” and view the complete list of DNS records.

10. DNS resolver completed. You just need to point your DNS resolver in your PC to and everything will happen as what we expected. Dont forget to flush dns cache “ipconfig /flushdns” for Windows PC.

To check, you can ping to or as usual and in the same time you can ping your domain and get resolved to local IP as what we defined in DNS zone of our resolver

  • Email, SSL
  • 16 Users Found This Useful
Was this answer helpful?

Related Articles

Install FireHOL Firewall in Debian Linux

What is FireHOL ?FireHOL is a stateful iptables packet filtering firewall configurator. It is...

Common SSH Commands - Linux Shell Commands

Navigating in UNIX pwd Shows the full path of the current directory...

Install Config Server Firewall (CSF)?

Installation============Installation is quite straightforward: Login as the root user to SSH...

ELS: Great Server Administration Tool

ELS stands for Easy Linux Security. ELS was created by Richard Gannon. ELS takes many...

Linux: Install LiteSpeed Web Server

Lets open our mind with another web server, which is 6x faster than Apache in handling static...

Powered by WHMCompleteSolution