Hybrid Internet AWMN caching DNS server

Yet another, quick how-to configure a Hybrid Internet-AWMN caching nameserver,
this time on
# cat /etc/issue /etc/debian_version 
Debian GNU/Linux 6.0 \n \l

6.0.7


Install bind
# apt-get install bind9


Adjust /etc/bind/named.conf
# cat /etc/bind/named.conf
// This is the primary configuration file for the BIND DNS server named.
//
// Please read /usr/share/doc/bind9/README.Debian.gz for information on the 
// structure of BIND configuration files in Debian, *BEFORE* you customize 
// this configuration file.
//
// If you are just adding zones, please do that in /etc/bind/named.conf.local

include "/etc/bind/named.conf.options";
include "/etc/bind/named.conf.local";

I will include the default zones in the .local configuration file.

Adjust /etc/bind/named.conf.options
options {
 directory "/var/cache/bind";

 version "awmn. #g0 2012"; 

 // If there is a firewall between you and nameservers you want
 // to talk to, you may need to fix the firewall to allow multiple
 // ports to talk.  See http://www.kb.cert.org/vuls/id/800113

 // If your ISP provided one or more IP addresses for stable 
 // nameservers, you probably want to use them as forwarders.  
 // Uncomment the following block, and insert the addresses replacing 
 // the all-0's placeholder.

 //comment out zone "." hint if you choose to use forwarders
 // forwarders {
 //  0.0.0.0;
 // List of Public DNS:  http://alog.ipduh.com/2012/06/public-dns-servers.html
 //
 // };

 //listen-on { 127.0.0.1; 10.3.57.3; };
 listen-on { any; }
 auth-nxdomain no;    # conform to RFC1035
 //listen-on-v6 { any; };
};

Replace 10.3.57.3 with your awmn IP address if you choose to not use listen-on {any;}

# cat /etc/bind/named.conf.local 
//
// #g0 2013 -- awmn caching nameserver
// #http://ipduh.com/contact

acl internals {
        127.0.0.0/8;
        10.0.0.0/8;
};

view "internal" {
        match-clients { internals; };
        recursion yes;
        allow-recursion { any; };
        allow-query { any; };
        allow-query-cache { any; };

zone "localhost" {
        type master;
        file "/etc/bind/db.local";
};

zone "127.in-addr.arpa" {
        type master;
        file "/etc/bind/db.127";
};

zone "0.in-addr.arpa" {
        type master;
        file "/etc/bind/db.0";
};

zone "255.in-addr.arpa" {
        type master;
        file "/etc/bind/db.255";
};

zone "10.in-addr.arpa" IN {
        type forward;
        forwarders {
        10.0.0.1; 
//You may want to add a few more from http://awmn:awmn@nagios.ipduh.awmn/cgi-bin/nagios3/status.cgi?hostgroup=awmn-dns&style=detail
        10.19.143.13;
        10.19.143.12;
        };
};

//####################################
//# Greek Wireless Communities Zones #
//####################################
//# https://www.awmn.net/wiki/       #
//####################################
//Because awmn will go gwmn pretty soon g stands for Greek or Global ;)
//####################################

zone "awmn" IN {
        type forward;
        forwarders {
                  10.0.0.1; 
//You may want to add a few more from http://awmn:awmn@nagios.ipduh.awmn/cgi-bin/nagios3/status.cgi?hostgroup=awmn-dns&style=detail
                  10.19.143.12;
                  10.19.143.13;  
        };
};

zone "wn" IN {
        type forward;
        forwarders {
//yeah good luck with these name servers

                10.126.3.115;
                10.110.17.115;
                10.19.143.12;
                10.17.122.134;
                10.86.87.129;
                10.2.16.130;
                10.110.17.67;

//the following does wn. as much as the above which is not-at-all
                10.21.241.100;

        };
};

zone "swn" IN {
        type forward;
        forwarders {
                10.101.0.254;
                10.106.3.1;
                10.174.254.101;
                10.174.1.253;
        };
};

zone "twmn" IN {
        type forward;
        forwarders {
                10.104.76.65;
                10.122.20.70;
                10.122.3.68;
                10.122.14.72;
                10.104.1.74;
        };
};

zone "wthess" IN {
        type forward;
        forwarders {
                10.96.0.1;
                10.96.22.2;
                10.96.9.3;
        };
};

zone "ewn" IN {
        type forward;
        forwarders {
                10.145.7.150;
                10.146.210.130;
        };
};

zone "mswn" IN {
        type forward;
        forwarders {
                10.148.50.2;
        };
};

zone "cywn" IN {
        type forward;
        forwarders {
                10.215.0.125;
                10.215.2.126;
        };
};

zone "dwn" IN {
        type forward;
        forwarders {
                10.174.1.253;
                10.174.254.101;
                10.174.17.250;
        };
};

zone "wiran" IN {
        type forward;
        forwarders {
                10.230.3.133;
        };
};

zone "wana" IN {
        type forward;
        forwarders {
                10.224.3.35;
        };
};

zone "awn" IN {
        type forward;
        forwarders {
                10.198.0.130;
        };
};

zone "pwmn" IN {
        type forward;
        forwarders {
                10.140.14.67;
        };
};

// prime the server with knowledge of the root servers
// comment out if you are planning on using forwarders
zone "." {
        type hint;
        file "/etc/bind/db.root";
};


};



Set this Name-Server in /etc/resolv.conf
# echo "nameserver 127.0.0.1" > /etc/resolv.conf
# cat /etc/resolv.conf 
nameserver 127.0.0.1


Restart the Name-Server
# /etc/init.d/bind9 restart
Stopping domain name service...: bind9 waiting for pid 14979 to die.
Starting domain name service...: bind9.


Test the Name-server
# dig +short ipduh.com
85.25.242.245
# dig +short ipduh.awmn
10.21.241.4
# dig +short www.awmn
srv1.awmn.
10.19.143.13
# dig +short wind.awmn
10.19.143.12
# dig +short voip.awmn
10.67.0.17



Done.



Hybrid Internet-AWMN Caching DNS server How-To