Setup a forwarding caching-only DNS Server on Ubuntu

A quick cheatsheet for setting up a forwarding, caching-only DNS Server on Ubuntu.

Edit /etc/bind/named.conf.options:

options {
directory "/var/cache/bind";

// prevent firewall problems
query-source address * port 53;

forwarders {
// forward requests to
1.2.3.4;
5.6.7.8;
};

// don't iterate
forward only;

// but DO cache (make it explicit)
recursion yes;

auth-nxdomain no; # conform to RFC1035

// don't do IPv6
// listen-on-v6 { any; };
listen-on-v6 { none; };

// only listen on internal interfaces
listen-on { 10.0.0.1; 127.0.0.1; };
};

Edit /etc/dhcp3/dhclient.conf, add the following lines:

# sonia: use this server's dns server first!!
interface "eth0" {
prepend domain-name-servers 127.0.0.1;
}

Finally, restart services and check work:

/etc/init.d/bind9 restart
netstat -tanp | grep named
grep bind /var/log/* | less
/etc/init.d/networking restart
cat /etc/resolv.conf



Share This


 


7 Responses to Setup a forwarding caching-only DNS Server on Ubuntu

  1. Most accurate and concise Bind cheatsheet I’ve found on the net. It simply works, thanks.

  2. Thanks Nick! Sonia.

  3. Awesome! It’s works great for me!
    Thanks for the post!

  4. One of the few, clear sources on how to make a caching/forwarding DNS at home.
    Thank you, big time!

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>