Ubuntu – How to include lines in resolv.conf that won’t get lost on reboot

resolv.conf

I have finally migrated to 12.04 from 7.10. I have one last part to complete but I am stumped. I am using Puppet on each server, and in the past I have included a nameserver address and a search domain name for the puppetmaster in resolv.conf.

search puppetmaster.com
nameserver 192.168.1.XXX

In 12.04 resolv.conf gets overwritten when rebooted. I cannot use a static IP for these, so using the /etc/network/interfaces to help me out is a nill point.

# 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
nameserver 127.0.0.1

Is there a way to get resolvconf to handle this either in the head, tail or base? If there is, are there any examples I can use to tweak on my server.

Any help is much appreciated.

Best Answer

It's probably better to have your DNS server be able to resolve 'puppet' to the right address, and either to have your DHCP server hand out the DNS nameserver address and search list or else (if you have static IP addresses) to have something like the following in /etc/network/interfaces.

iface eth0 inet static
    address 192.168.3.3
    netmask 255.255.255.0
    gateway 192.168.3.1
    dns-search example.com
    dns-nameservers 192.168.3.45 192.168.8.10

But if you do want to do it via the resolvconf configuration files you will want to edit /etc/resolvconf/resolv.conf.d/base. In that file, put in your info as you would in resolv.conf.

nameserver 192.168.1.XXX

Then tell resolvconf to regenerate resolv.conf.

sudo resolvconf -u