Why does my resolv.conf file get regenerated every time?

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.


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.


If all you want to do is to keep your Google DNS servers in resolv.conf, you can edit
/etc/dhcp3/dhclient.conf and add :

prepend domain-name-servers 8.8.8.8;
prepend domain-name-servers 8.8.4.4;

The only difference between what you have and what I'm showing here is that you've got both name-servers on a single line, per the docs you've mentioned.

Unless I'm missing something, your dhclient.conf is not a problem here. At this point, I'm assuming that the issue has to do with wvdial.

Here's something to try, from ubuntuforums:

gksudo gedit /etc/ppp/peers/wvdial

REMOVE parameter usepeerdns and save file. Code:

gksudo gedit /etc/wvdial.conf

add these lines:

check DNS = no
auto DNS = no