Things I find worth sharing in my dealing with computers and programming (mostly on Linux/UNIX).

Sunday, October 01, 2006

DNS configuration on Ubuntu, part III: enter resolvconf

After I realized that by default the dhcp3-client script on Ubuntu updates /etc/resolv.conf to include the nameservers provided by DHCP, I though about how to get it to write that to the forwarders clause in named.conf. After all, I had set up something custom for me some time ago. But since I'm lazy, I tried to find something already written for the job, and maybe build on that.

Note that if you don't plan to use forwarders, and this is recommended if you don't need to access domains local to your provider, the following part isn't useful to you.

So, the package I found is called resolvconf - Ubuntu package described here. I found it through a link from a bug report against Debian's dhcp3-client script - that was a reference to update-resolv, but it changed name in the meantime. It intercepts the DHCP client hooks (see here for some more details) and, instead of writing the ISP nameservers to resolv.conf, it writes them to named.conf. More precisely, to /var/run/bind/named.options, which you need to include in /etc/bind/named.conf instead of /etc/bind/named.options (NOTE: this is entirely Ubuntu/Debian-specific, SuSE has one named.conf with a named.conf.local where you can put some local settings; it also stores it in /etc/named.conf).

What resolconf does is take /etc/bind/named.conf.options and use it as a template for /var/run/bind/named.options. So, add the parts in my previous post on DNS configuration here. Then, you're all set to go; just make sure you have BIND running and then restart networking to trigger a new DHCP exchange:

sudo /etc/init.d/networking restart



There you go. That's all for today.

0 Comments:

Post a Comment

<< Home