Saturday, December 24, 2011
1:30 PM

How to Setup Forward DNS


Setting up a DNS which should have my server’s forward entries.

I have a live dns server for abc.com domain and running 500 subdomains (i.e. alive.abc.com, blive.abc.com etc..) through that servers. And secondly i have local dns server for abc.com in my local network and running 20 subdomains (i.e. a.abc.com , b.abc.com etc….) through that server.

I want if any user of my network with our local DNS IP try to access ours local domain with the name, my local DNS should provide that entry from it. If the user try to use the domain which is not available within my local DNS, it should query the DNS available in internet and should respond to the query of the user computer.

1. Install DNSMASQ
[root@map007 ~]# yum install dnsmasq
2. Edit /etc/resolve.conf to lookup the localhost
[root@map007 ~]# cat /etc/resolv.conf |grep nameserver
nameserver 127.0.0.1
3. Now put the following lines in /etc/dnsmasq.conf
domain-needed
bogus-priv
filterwin2k
resolv-file=/etc/resolv.external
expand-hosts
domain=abc.com
log-queries
log-facility=/var/log/dnsmasq
conf-dir=/etc/dnsmasq.d
4. Make a file for to specify external DNS server.
[root@map007 ~]# cat /etc/resolv.external
nameserver 192.168.122.1
5. Put the entry of your abc.com into /etc/hosts
[root@map007 ~]# cat /etc/hosts |grep abc
192.168.1.51 host1.abc.com
192.168.1.52 host2.abc.com
192.168.1.53 host3.abc.com
6. Start DNSMASQ Service
[root@map007 ~]# service dnsmasq start
Now check the results
[root@map007 ~]# nslookup host1.abc.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Name: host1.abc.com
Address: 192.168.1.51
[root@map007 ~]# nslookup www.abc.com
Server: 127.0.0.1
Address: 127.0.0.1#53
Non-authoritative answer:
Name: www.abc.com
Address: 20.80.x.x

0 comments:

Post a Comment