[Samba] NetworkManager, DNS, and resolv.conf

Patrick Goetz pgoetz at math.utexas.edu
Tue Mar 8 15:34:38 UTC 2022


On 3/8/22 01:02, Jürgen Echter wrote:
> Hi,
> 
> for me it worked when i disabled auto-dns and set the search domain and 
> dns server manually like this:
> 
> nmcli con mod enp1s0 ipv4.ignore-auto-dns yes
> nmcli con mod enp1s0 ipv4.dns "192.168.1.80"
> nmcli con mod enp1s0 ipv4.dns-search "samdom"	
> 

Presumably ignore-auto-dns=yes  sets

   [main]
   dns=none

in /etc/NetworkManager.conf?  I couldn't get this to work on my Ubuntu 
20.04 test VM:

root at erap-ubuntu:~# nmcli
enp0s3: connected to Wired connection 1
...

root at erap-ubuntu:~# nmcli con mod enp0s3 ipv4.ignore-auto-dns yes
Error: unknown connection 'enp0s3'.

Not sure I get that one, and the option doesn't even show up in the 
graphical interface; maybe this is an Ubuntu Mate specific modification.

However, to be clear, there are N ways to get around this, but the point 
of my post was that a user with a NetworkManager system following the 
Wiki page on setting up a Samba client would get confused by the 
/etc/resolv.conf instructions when NetworkManager restarts and rewrites 
resolv.conf, and further that the systemd-resolved stub file entry:

   nameserver 127.0.0.53

works fine on Samba clients as long as you've set the correct AD 
nameserver entry in the system-connections file using either nmcli or 
the graphical interface.  This is then set dynamically on boot in

    /run/systemd/resolve/resolv.conf

If you just followed the previous Wiki instructions and had configured a 
different nameserver on installation, domain name resolution would break 
as soon as the system reboots because NetworkManager will reset it by 
default, at least on Ubuntu systems.  Simple is best as long as simple 
works.



More information about the samba mailing list