I found this tutorial the best I've come across and it works! Well done although I can't vote and comment on it due to my site privilege as yet.

How do I do a complete BIND9 DNS Server Configuration with a hostname?

My question is, I'm unsure about the resolv.conf file, where the tutorial states to insert the nameserver, domain and search. My resolv.conf file has a comment above it saying "do not edit this file by hand - your changes will be overwritten". Can anyone clarify this for me please?

Thanks in advance, Mario.


The tutorial you refer to is outdated insofar as it tells you to edit /etc/resolv.conf by hand. In Ubuntu 12.04 and later you don't edit /etc/resolv.conf by hand but configure resolvconf to put the correct content in that file. If you have followed the other steps in the tutorial and want to use the locally running BIND 9 named to resolve DNS names then the right thing to do is (1) make sure that /etc/resolv.conf is (still) a symbolic link to ../run/resolvconf/resolv.conf and (2) set RESOLVCONF=yes in /etc/default/bind9 to cause BIND 9 named to register its local listen address with resolvconf when it starts; (3) do /etc/init.d/bind9 restart.

If you would like to add search domain names to the resolver configuration then add a dns-search line to the iface lo stanza in /etc/network/interfaces.

iface lo inet loopback
    dns-search name1 name2

After doing this you have to ifdown lo and ifup lo to cause the information to be added to resolv.conf.


when editing resolv.conf it shows:

Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)


it's not about resolv.conf, it's about resolvconf. The two filenames look almost the same except for the missing dot. When you execute resolvconf, it provides more information. Okay, let's check the manual:

To make ifup push name‐server information to resolvconf when it configures an interface, add dns- lines to the relevant iface stanza in /etc/network/interfaces. To add nameserver addresses add a line beginning with dns-nameservers.


in other words what you write in resolvconf will be added in resolv.conf so if you added lines there it will be deleted when you restart and overwritten by resolvconf .

You can also specify your dns server in /etc/network/interfaces

that's the answer!

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.