systemd-resolve does not forward DNS requests to stated DNS server
Anyone know how systemd-resolve voodo works?
192.168.1.30is the correct DNS server for my network, as returned by DHCP.
/etc/resolv.conf points to 127.0.0.53
Systemd claims to be using the correct server.
systemd-resolve --status | grep "DNS Servers"
192.168.1.30But dig indicates it is not forwarding requests
If I specify the server I can resolve shadowbox
dig @192.168.1.30 shadowbox
; <<>> DiG 9.16.1-Ubuntu <<>> @192.168.1.30 shadowbox
...
;; ANSWER SECTION:
shadowbox. 60 IN A 192.168.1.34
...systemd-resolve cannot
dig @127.0.0.53 shadowbox
; <<>> DiG 9.16.1-Ubuntu <<>> @127.0.0.53 shadowbox
; (1 server found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 60161
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;shadowbox. IN A
;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53)
;; WHEN: Sun Jun 07 14:00:12 CEST 2020
;; MSG SIZE rcvd: 38I have tried bouncing the server, flusching acashed and mamually setting the server
systemd-resolve --flush-caches
systemd-resolve --set-dns=192.168.1.30 --interface=enp0s31f6I can chattr +i /etc/resolv.conf to regain control of DNS, but it would be nice to know why systemd is not working, since I loose the benefits of DHCP.
2 Answers
Looks like this is by design. Pottering closed the issue with a wont-fix.
dig @127.0.0.53 shadowboxsystemd-resolved does not support simple names over DNS, only fqdn, and ignores the search directive.
To add specific upstream:
add upstream dns in /etc/systemd/resolved.conf
[Resolve] DNS=192.168.1.123restart
service systemd-resolved restartcheck with
systemd-resolve --statusGlobal DNS Servers: 192.168.1.123
To use DHCP provisioned DNS Server ( Since you stated in the comments that you want it to "just behave like normal" ) :
In the configuration file for local network interface (a file matching the name pattern /etc/systemd/network/*.network) either specify to obtain local DNS server address from DHCP server using DHCP= option:
[Network]
DHCP=yesAlso make sure resolvconf is not interfering:
4systemd-resolved will work out of the box with a network manager using /etc/resolv.conf. No particular configuration is required since systemd-resolved will be detected by following the /etc/resolv.conf symlink. This is going to be the case with systemd-networkd or NetworkManager.
However, if the DHCP and VPN clients use the resolvconf program to set name servers and search domains (see openresolv#Users for a list of software that use resolvconf), the additional package systemd-resolvconf is needed to provide the /usr/bin/resolvconf symlink. Note: systemd-resolved has a limited resolvconf interface and may not work with all the clients, see resolvectl(1) for more information. (from archwiki )