1

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.

Mario
  • 11
  • 1
  • 1
  • 2
  • Here is how to do it: http://askubuntu.com/questions/130452/how-do-i-add-a-dns-server-via-resolv-conf See the 1st answer and last comment 1st answer. – Rinzwind Jan 27 '14 at 13:55

2 Answers2

1

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 127.0.0.1 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.

jdthood
  • 12,467
0

when editing resolv.conf it shows:

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

DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN

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.

dns-nameservers 11.22.33.44 55.66.77.88

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!

nux
  • 38,017
  • 35
  • 118
  • 131