openwrt hybrid caching DNS

A quick post on how to setup an AWMN-Internet hybrid caching DNS server on OpenWrt.

Install with opkg if you are using some relatively new version of OpenWrt.
# opkg install bind-server


Adjust your /etc/bind/named.conf
# cat /etc/bind/named.conf
options {
 directory "/etc/bind";
 forwarders { 195.170.0.1; 8.8.8.8; };
 listen-on { 127.0.0.1; 10.29.74.1; };
 allow-query-on { any; };
 allow-query { any; };
 allow-recursion { any; };
 auth-nxdomain no;    # conform to RFC1035
};



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 "awmn" {
 type forward;
 forwarders {
  10.19.143.12;
  10.0.0.1;
  10.19.143.13;
  };
 };

zone "10.in-addr.arpa" {
 type forward;
 forwarders {
  10.19.143.12;
  10.0.0.1;
  10.19.143.13;
  };
 };


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

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

zone "cywn" {
 type forward;
 forwarders {
  10.215.255.5;
  };
 };

zone "iwmn" {
 type forward;
 forwarders {
  10.205.3.2;
  };
 };

zone "pwmn" {
 type forward;
 forwarders {
  10.140.14.67;
  10.140.19.209;
  10.140.14.73;
  10.143.4.1;
  };
 };

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

zone "her.wn" {
 type forward;
 forwarders {
  10.176.0.10;
  10.176.0.11;
  };
 };



Restart Bind
# /etc/init.d/named restart


Put it in your /etc/resolv.conf
# echo "nameserver 127.0.0.1" > /etc/resolv.conf



Done!

195.170.0.1 is the caching DNS server of a large Greek ISP.

You may add more forwarders in options from this public DNS servers list

Replace and add IP addresses to listen-on accordingly.

Do not add AWMN-Internet hybrid DNS servers to the forwarders in options.



OpenWrt hybrid caching DNS How-to