MRKAVANA (mrkavana@gmail.com) - www.facebook.com/kavanathai

Jul 15, 2011

How to Config a Caching DNS server in DMZ for querying from internal DNS serrver (Security for DNS)

Doing on Redhat 5.3 (x86_64)

My Caching DNS server in DMZ: 172.16.0.18
My Internal DNS server in LAN:  192.168.1.10

1, Install follow some rpm packets from Redhat disk (recomment) or download from internet:
rpm -ivh bind-libs-9.3.4-10.P1.el5.x86_64.rpm
rpm -ivh bind-devel-9.3.4-10.P1.el5.x86_64.rpm
rpm -ivh bind-utils-9.3.4-10.P1.el5.x86_64.rpm
rpm -ivh bind-9.3.4-10.P1.el5.x86_64.rpm
rpm -ivh bind-chroot-9.3.4-10.P1.el5.x86_64.rpm
rpm -ivh caching-nameserver-9.3.4-10.P1.el5.x86_64.rpm

2, vi /etc/resolve.conf --> nameserver 127.0.0.1
    vi /etc/named.caching-nameserver.conf
// --------------------------------------------------------------------------------------------

//
// named.caching-nameserver.conf
//
// Provided by Red Hat caching-nameserver package to configure the
// ISC BIND named(8) DNS server as a caching only nameserver
// (as a localhost DNS resolver only).
//
// See /usr/share/doc/bind*/sample/ for example named configuration files.
//
// DO NOT EDIT THIS FILE - use system-config-bind or an editor
// to create named.conf - edits to this file will be lost on
// caching-nameserver package upgrade.
//

acl internaldns { localhost; 127.0.0.1; 192.168.1.10; };

options {
        listen-on port 53 { internaldns; };
        listen-on-v6 port 53 { ::1; };
        directory       "/var/named";
        dump-file       "/var/named/data/cache_dump.db";
        statistics-file "/var/named/data/named_stats.txt";
        memstatistics-file "/var/named/data/named_mem_stats.txt";

        // Those options should be used carefully because they disable port
        // randomization
        // query-source    port 53;
        // query-source-v6 port 53;

        allow-query     { internaldns; };
        allow-recursion { internaldns; };
        forwarders { 210.245.0.11; 8.8.8.8; 8.8.4.4; 208.67.222.222; 208.67.220.220; };
        forward first;

};
logging {
        channel default_debug {
                file "data/named.run";
                severity dynamic;
        };
};
view localhost_resolver {
        match-clients      { internaldns; };
        match-destinations { internaldns; };
        recursion yes;
        include "/etc/named.rfc1912.zones";
};

//-----------------------------------------------------------------------------------------------------------

3, config dns'ip in network card on internal dns server is internal dns server'ip: 192.168.1.10
    config your internal dns's property, config only forwarder is Caching DNS server in DMZ :

4, Restart your DNS service and go to dos: ipconfig/flushdns and ipconfig/registerdns
5, Check resolving dns on internal DNS server by 'nslookup' command:


6, --> OK, your caching dns server in DMZ's ok!

Have fun!



No comments:

Post a Comment