Ubuntu – Why does the resolv.conf file get regenerated every time

dnsresolv.conf

My /etc/resolv.conf file gets regenerated every time, making me loose Google DNS servers when I reconnect my 3G modem.

For changing the DNS settings, I looked at http://code.google.com/intl/fr-FR/speed/public-dns/docs/using.html.

My dhclient.conf is pretty big (58 lines), so I posted it on pastebin.

However, here is the entire dhclient.conf without comment lines or blank lines:

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;
send host-name "<hostname>";
request subnet-mask, broadcast-address, time-offset, routers,
    domain-name, domain-name-servers, domain-search, host-name,
    netbios-name-servers, netbios-scope, interface-mtu,
    rfc3442-classless-static-routes, ntp-servers;
prepend domain-name-servers 8.8.8.8, 8.8.4.4;

I am using wvdial instead of Network Manager.

Best Answer

In 12.04, resolvconf is installed by default. Here is a quick summary of how to make DNS configuration changes for some common use cases:

For a static configuration using ifup, use dns-nameservers and dns-search entries in /etc/network/interfaces.

For a static configuration using NetworkManager, select the Automatic (DHCP) addresses only Method and enter addresses and domain names in the Additional DNS servers and Additional search domains fields in the Connection Editor.

To override resolvconf's default configuration, use base, head and tail in /etc/resolvconf/resolv.conf.d/. Only enter addresses and domain names in these files as a temporary measure, since they really belong elsewhere, as described above.

Disabling resolvconf is not recommended, but you can replace the symlink /etc/resolv.conf with a regular file.

For more information, see Stéphane Graber's blog post.

Related Question