How to get DNS working on a Ubuntu 16.04 machine with a bridged interface

published Oct 25, 2017 11:30   by admin ( last modified Oct 25, 2017 11:51 )

Summary: The solution is to disable DNSMasq in /etc/NetworkManager/NetworkManager.conf .

It's no fun when it's not you configuring things wrong, but a bug. Reason is that you haven't learned anything, just made up incorrect reasons, until you find the bug.

A curious thing happened today, a Ubuntu 16.04 machine running a couple of KVM guest machines lost it's connection to the Internet, but the guest machines kept theirs!

After a closer look the host machine still had an Internet connection, but its DNS did not work. I will not bore you with the meandering trouble-shooting path, but in short this is a conflict between /etc/network/interfaces and the NetworkManager. These seem to be different competing systems for configuring your network, and sometimes they do not agree.

This time the conflict was about /etc/resolv.conf, which nowadays is handled by other processes, so if you manually write in it, that will be over written.

In this case bridge-utils (or possible a program triggered by it) wants to write whatever DNS settings it's configured with in /etc/network/interfaces , to /etc/resolv.conf. At the same time NetworkManager wants to tell /etc/resolv.conf that it has a DNSMasq DNSproxy running on localhost. And that does not work, maybe because DNSMasq only reponds to NetworkManager,or it's not there, or it's erroneously configured or whatever. /etc/resolv.conf gets clobbered with 127.0.0.1 and that's it.

The solution is to disable DNSMasq in /etc/NetworkManager/NetworkManager.conf . Then it works and /etc/resolv.conf takes its information from /etc/network/interfaces .

Bug #1384394 “/etc/network/interfaces: “dns-nameservers” entries...” : Bugs : dnsmasq package : Ubuntu

I suspect NetworkManager is only installed on desktop systems, and this may explain why it was hard to find info on the conflict