1

What is the best (proper?) way to force Ubuntu 22.04 to look at ONLY netplan for DNS configuration? I'm working with Rancher+RKE2 and their preparation script includes truncating the resolv.conf file. I've tried commenting out resolv.conf, turning off and restarting systemd-resolve, and configured netplan to use DNS. Also rebooted the VM a few times for good measure.

Mine looks like:

network:
  version: 2
  renderer: networkd:
  ethernets:
    eth0:
      dhcp4: false
      dhcp6: false
      addresses:
        - 192.168.1.101
      routes:
        - to: default
          via: 192.168.1.1
      nameservers:
        addresses:
          - 192.168.1.10
          - 192.168.1.11
          - 2005:400:1111:1111:1111:1110
          - 2005:400:1111:1111:1111:1111
        search:
          - *******.com

I've tried netplan generate and netplan apply and netplan seems to be happy with the syntax. I can ping all nameservers and there is no firewall rules to block out 53. Those nameservers work if I set those on resolv.conf. So to me it seems like the DNS servers are working as intended and my problem lies in not understanding how resolv function works in Ubuntu.

If I try commands like host or use sudo, ubuntu is complaining about Temporary failure in name resolution and spits out

;; communication error to ::1#53: connection refused
;; communication error to ::1#53: connection refused
;; communication error to 127.0.0.1#53: connection refused
;; no servers could be reached

I don't have v6 configured so I understand why it would be unhappy with ::1#53 but I'm not sure why v4 is also failing.

I've also checked resolvectl status:

Global
    Protocols: --LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported
resolv.conf mode: foreign

Link 2 (eth0) Current Scopes: DNS Protocols: +DefaultRoute +LLMNR -mDNS -DNSOverTLS DNSSEC=no/unsupported DNS Servers: 192.168.1.10, 192.168.1.11, 2005:400:1111:1111:1111:1110, 2005:400:1111:1111:1111:1111 DNS Domain: *******.com

I've also looked at Netplan DNS nameserver setting not being applied, https://serverfault.com/questions/1032595/how-to-get-netplan-to-set-the-dns-server-in-etc-resolv-conf-based-on-info-comin, and how to change DNS server permanently on Ubuntu 20.04?, `resolvconf` changing current DNS. Netplan stict using nameserver without avail. Happy to be informed by someone who knows more about Ubuntu than me (which I'm sure there's many). Thanks!

P.S. kernel is 5.15.0-107.generic

nomad
  • 11

1 Answers1

0

resolved does not listen on 127.0.0.1; it listens on a special non-default loopback address of 127.0.0.53.

To your main question however, there is unfortunately no way to make the system "look at" netplan instead of /etc/resolv.conf. /etc/resolv.conf is the hard-coded authoritative location for DNS server information; tools that do not integrate gracefully with the expectation that this file is managed on Ubuntu by systemd-resolved are buggy.

slangasek
  • 5,828