Ubuntu – resolvconf dnsmasq issue – system startup leaves blank dnsmasq resolv.conf file

dnsmasqUbuntuubuntu-10.04

On system start, /var/run/dnsmasq/resolv.conf file ends up being blank. I had expected the resolvconf package to update it with the info from /etc/network/interfaces (dns-nameservers, dns-search).

I'm running a Ubuntu 10.04.2 LTS lucid server. I have both resolvconf and dnsmasq installed.

Here's the interfaces file section for eth0 (changed ip and dns names):

auto eth0
iface eth0 inet static
    address 10.100.1.100
    netmask 255.255.255.0
    network 10.100.1.0
    broadcast 10.100.1.255
    gateway 10.100.1.1
    dns-nameservers 10.100.2.2 10.100.3.2
    dns-search my-domain.com mydomain.com

If I run ifdown eth0 && ifup eth0 after start up, then the /var/run/dnsmasq/resolv.conf file is correctly populated.

Best Answer

I hate this. I found the same problem on my system. Part of the problem I think is NetworkManager (NetworkMangler).

I did the following

echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf
chattr +i /etc/resolv.conf

Now nothing can change it but me. Doesn't solve the root problem, but certainly worked.

N.B. You can replace /etc/resolv.conf with /var/run/dnsmasq/resolv.conf

Set it, and forget it. On servers, I don't approve of services fiddling with my config. Especially if I've set up a static IP.

I wanna be in control, damnit.