[Samba] NetworkManager, DNS, and resolv.conf

Patrick Goetz pgoetz at math.utexas.edu
Sat Mar 5 14:42:58 UTC 2022

I think the following pertains to all desktop clients configured with 
NetworkManager, but this particular machine is configures with Ubuntu 
20.04 Mate edition.

I've been following the Samba Wiki instructions for setting up a domain 
member, in particular the /etc/resolv.conf configuration:


So, on a machine called erap-ubuntu I had configured /etc/resolv.conf 
like this:

    search ea.linuxcs.com

This morning I was testing something and noticed that /etc/resolv.conf 
had been rewritten by NetworkManager:

    search linuxcs.com

I don't typically use NetworkManager, so this was residual from the 
initial install.  Doing a little testing, when you edit /etc/resolv.conf 
by hand, NetworkManager doesn't know about this and instead defers to a 
NetworkManager-specific configuration file:

   /etc/NetworkManager/system-connections/Wired connection 1.nmconnection

My bind nameserver, was set in this file, but NetworkManager 
still defers to the systemd-resolved nameserver stub,

Any time NetworkManager is restarted, /etc/resolv.conf is reset to use even if I explicitly set the samba-dc nameserver in the 
NetworkManager configuration for that interface.  The search domain is 

Given the prevalence of NetworkManager, this is one of those "if you 
can't beat them, join them" situations, so I experimented with just 
leaving /etc/resolv.conf set to:

    search ea.linuxcs.com

and everything seems to work fine:

   root at erap-ubuntu:~# wbinfo -i mduffy

   root at erap-ubuntu:~# samba-tool dns query samba-dc 
1.168.192.in-addr.arpa 85 PTR -U Administrator
   Password for [EA\Administrator]:
     Name=, Records=1, Children=0
       PTR: erap-ubuntu.ea.linuxcs.com (flags=f0, serial=5, ttl=900)

   root at erap-ubuntu:~# host -t SRV _ldap._tcp.ea.linuxcs.com
_  ldap._tcp.ea.linuxcs.com has SRV record 0 100 389 

So unless there's something I'm overlooking, I'm going to update the 
Wiki so that the vast majority of linux users (i.e. all those folks 
using NetworkManager) aren't confused by this.

More information about the samba mailing list