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 22.214.171.124 and 126.96.36.199.
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 myserver.net, while other domains will resolve correctly same as public DNS resolver.
I will show you how I do that with most simplest way, using yum, Bind and Webmin. Variables as follow:
OS: CentOS 6 64bit
Internal web server IP: 192.168.0.202
DNS Zone: myserver.net
1. Install Bind using yum:
yum install bind* -y
2. Download Webmin so we can easily manage the zone via web-based interface:
cd /usr/local/src wget http://prdownloads.sourceforge.net/webadmin/webmin-1.560-1.noarch.rpm rpm -Uhv webmin-1.560-1.noarch.rpm
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 http://192.168.0.200:10000 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 myserver.net 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 192.168.0.200 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 yahoo.com or google.com 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.