Personal computing discussed

Moderators: renee, SecretSquirrel, notfred

 
notfred
Maximum Gerbil
Topic Author
Posts: 4610
Joined: Tue Aug 10, 2004 10:10 am
Location: Ottawa, Canada

systemd-resolve and local hostnames in Ubuntu 18.04

Mon Aug 06, 2018 11:52 am

I have dnsmasq on a server on my network serving a bunch of local names "printer", "ata" etc. Many of these devices do not have LLMNR capabilities. I just switched from Ubuntu 16.04 to 18.04 and systemd-resolve now refuses to send these names without a domain to the DNS server:

nreilly@nick:~$ dig printer

; <<>> DiG 9.11.3-1ubuntu1.1-Ubuntu <<>> printer
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 57608
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;printer.         IN   A

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Mon Aug 06 12:49:13 EDT 2018
;; MSG SIZE  rcvd: 36

nreilly@nick:~$ dig @192.168.1.254 printer

; <<>> DiG 9.11.3-1ubuntu1.1-Ubuntu <<>> @192.168.1.254 printer
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 26438
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1280
;; QUESTION SECTION:
;printer.         IN   A

;; ANSWER SECTION:
printer.      0   IN   A   192.168.1.6

;; Query time: 0 msec
;; SERVER: 192.168.1.254#53(192.168.1.254)
;; WHEN: Mon Aug 06 12:49:28 EDT 2018
;; MSG SIZE  rcvd: 52

nreilly@nick:~$ systemd-resolve --status
Global
          DNSSEC NTA: 10.in-addr.arpa
                      16.172.in-addr.arpa
                      168.192.in-addr.arpa
                      17.172.in-addr.arpa
                      18.172.in-addr.arpa
                      19.172.in-addr.arpa
                      20.172.in-addr.arpa
                      21.172.in-addr.arpa
                      22.172.in-addr.arpa
                      23.172.in-addr.arpa
                      24.172.in-addr.arpa
                      25.172.in-addr.arpa
                      26.172.in-addr.arpa
                      27.172.in-addr.arpa
                      28.172.in-addr.arpa
                      29.172.in-addr.arpa
                      30.172.in-addr.arpa
                      31.172.in-addr.arpa
                      corp
                      d.f.ip6.arpa
                      home
                      internal
                      intranet
                      lan
                      local
                      private
                      test

Link 2 (enp3s0)
      Current Scopes: DNS
       LLMNR setting: yes
MulticastDNS setting: no
      DNSSEC setting: no
    DNSSEC supported: no
         DNS Servers: 192.168.1.254
                      fe80::21d:60ff:fe36:4d36
nreilly@nick:~$

I've found people complaining about this, but no quick fixes e.g. https://bugs.launchpad.net/ubuntu/+sour ... ug/1699660

Anyone got any hints on how to make systemd-resolve behave?
 
notfred
Maximum Gerbil
Topic Author
Posts: 4610
Joined: Tue Aug 10, 2004 10:10 am
Location: Ottawa, Canada

Re: systemd-resolve and local hostnames in Ubuntu 18.04

Thu Aug 09, 2018 9:34 am

I gave up on making systemd-resolve behave and changed my dnsmasq setup. Now everything on my LAN has names in the .lan domain and that domain is pushed as a search domain to all the DHCP clients.
 
just brew it!
Administrator
Posts: 54500
Joined: Tue Aug 20, 2002 10:51 pm
Location: Somewhere, having a beer

Re: systemd-resolve and local hostnames in Ubuntu 18.04

Thu Aug 09, 2018 9:49 am

Stupid systemd!

I backed off to LTS 16.04 for my recent home server upgrade because of bad interactions between systemd and md RAID in 18.04 LTS...
Nostalgia isn't what it used to be.
 
ermo
Gerbil
Posts: 55
Joined: Tue Jan 25, 2011 7:35 pm

Re: systemd-resolve and local hostnames in Ubuntu 18.04

Thu Aug 09, 2018 12:29 pm

notfred wrote:
I gave up on making systemd-resolve behave and changed my dnsmasq setup. Now everything on my LAN has names in the .lan domain and that domain is pushed as a search domain to all the DHCP clients.


I've taken the exact same approach on my apartment network, except I also push a local NTP server.
Linux: 2x FX-8350, 16/32GB, GTX970/HD7970, Solus+KDE/Exherbo+Xfce
Hackintosh: i7-2600K, 32GB, HD7970, High Sierra
HTPC: Q9400, 8GB, GTS 450, Solus/GNOME
Server: FX-8350, 16GB ECC, iGP, F30/Srv
Wintendo: R7 2700X, 32GB, 2x RX Vega 64 (air), W10Pro
 
notfred
Maximum Gerbil
Topic Author
Posts: 4610
Joined: Tue Aug 10, 2004 10:10 am
Location: Ottawa, Canada

Re: systemd-resolve and local hostnames in Ubuntu 18.04

Thu Aug 09, 2018 12:46 pm

Yup, I already had the NTP server in there, plus all the gear to PXE boot the Ubuntu installation for both BIOS and UEFI.
 
Scramblejams
Gerbil In Training
Posts: 1
Joined: Thu Jun 20, 2019 2:04 am

Re: systemd-resolve and local hostnames in Ubuntu 18.04

Thu Jun 20, 2019 2:17 am

There are a ton of threads on the internet covering different ways to address this, but the most expeditious way I found with Ubuntu 18.04 (and Mint) if you're running NetworkManager is to:

1) Stop systemd's built-in resolver from running
2) Force NetworkManager to put the correct DNS IP (which will have been supplied by DHCP, probably) into /etc/resolv.conf

Now, to step (1).

sudo systemctl stop systemd-resolved
sudo systemctl disable systemd-resolved

Next is step (2). NetworkManager must be told to put the right DNS IP into /etc/resolv.conf. It uses a heuristic to determine whether it should use systemd's "127.0.0.53" value or not. Sometimes that heuristic fails, so we're going to force it to do what we want. /etc/resolv.conf is normally a symlink to a systemd-provided file. We don't want that.

sudo rm /etc/resolv.conf

Don't worry, we'll bring that file back!

Now edit /etc/NetworkManager/NetworkManager.conf, and in the [main] section, add this line:

dns=default

Now restart NetworkManager, and it should populate /etc/resolv.conf with the correct DNS IP:

sudo systemctl restart network-manager

And that's how I can use local lookups on my Ubuntu and Mint boxes now. Hope this helps someone.

Who is online

Users browsing this forum: No registered users and 1 guest
GZIP: On