I upgraded a 16.04 Ubuntu server to 22.04. Migration to 18.04 & 20.04 worked well. The upgrade to 22.04 broke my DNS config. I found a lot of tutorials to configure the whole network using netplan ... but I don't feel very confortable with them (I'm afraid to break everything). I have a lot of network interfaces on the server but nothing in /etc/netplan. I wonder if I have to create a netplan file with all the network interfaces or just the broken one.

Here is the result of 'nmcli device show' command:

GENERAL.DEVICE: docker0 GENERAL.TYPE: bridge GENERAL.HWADDR: 02:42:99:76:F4:CE GENERAL.MTU: 1500 GENERAL.STATE: 10 (non-géré) GENERAL.CONNECTION: -- GENERAL.CON-PATH: -- IP4.ADDRESS[1]: 172.17.0.1/16 IP4.GATEWAY: -- IP4.ROUTE[1]: dst = 172.17.0.0/16, nh = 0.0.0.0, mt = 0 IP6.GATEWAY: -- GENERAL.DEVICE: docker_gwbridge GENERAL.TYPE: bridge GENERAL.HWADDR: 02:42:FA:EB:F8:75 GENERAL.MTU: 1500 GENERAL.STATE: 10 (non-géré) GENERAL.CONNECTION: -- GENERAL.CON-PATH: -- IP4.ADDRESS[1]: 172.18.0.1/16 IP4.GATEWAY: -- IP4.ROUTE[1]: dst = 172.18.0.0/16, nh = 0.0.0.0, mt = 0 IP6.ADDRESS[1]: fe80::42:faff:feeb:f875/64 IP6.GATEWAY: -- IP6.ROUTE[1]: dst = fe80::/64, nh = ::, mt = 256 GENERAL.DEVICE: enp2s0f0 GENERAL.TYPE: ethernet GENERAL.HWADDR: D8:D3:85:B9:34:20 GENERAL.MTU: 1500 GENERAL.STATE: 10 (non-géré) GENERAL.CONNECTION: -- GENERAL.CON-PATH: -- WIRED-PROPERTIES.CARRIER: marche IP4.ADDRESS[1]: 10.231.226.41/23 IP4.GATEWAY: 10.231.227.254 IP4.ROUTE[1]: dst = 0.0.0.0/0, nh = 10.231.227.254, mt = 0 IP4.ROUTE[2]: dst = 10.231.226.0/23, nh = 0.0.0.0, mt = 0 IP6.ADDRESS[1]: fe80::dad3:85ff:feb9:3420/64 IP6.GATEWAY: -- IP6.ROUTE[1]: dst = fe80::/64, nh = ::, mt = 256 GENERAL.DEVICE: enp2s0f1 GENERAL.TYPE: ethernet GENERAL.HWADDR: D8:D3:85:B9:34:22 GENERAL.MTU: 1500 GENERAL.STATE: 10 (non-géré) GENERAL.CONNECTION: -- GENERAL.CON-PATH: -- WIRED-PROPERTIES.CARRIER: arrêt IP4.GATEWAY: -- IP6.GATEWAY: -- GENERAL.DEVICE: vethdcb1995 GENERAL.TYPE: ethernet GENERAL.HWADDR: C2:05:F6:52:3F:61 GENERAL.MTU: 1500 GENERAL.STATE: 10 (non-géré) GENERAL.CONNECTION: -- GENERAL.CON-PATH: -- WIRED-PROPERTIES.CARRIER: marche IP4.GATEWAY: -- IP6.ADDRESS[1]: fe80::c005:f6ff:fe52:3f61/64 IP6.GATEWAY: -- IP6.ROUTE[1]: dst = fe80::/64, nh = ::, mt = 256 GENERAL.DEVICE: lo GENERAL.TYPE: loopback GENERAL.HWADDR: 00:00:00:00:00:00 GENERAL.MTU: 65536 GENERAL.STATE: 10 (non-géré) GENERAL.CONNECTION: -- GENERAL.CON-PATH: -- IP4.ADDRESS[1]: 127.0.0.1/8 IP4.GATEWAY: -- IP6.ADDRESS[1]: ::1/128 IP6.GATEWAY: -- IP6.ROUTE[1]: dst = ::1/128, nh = ::, mt = 256 

The problem is the enp2s0f0 device has no DNS defined. My questions are:

  1. how to add my DNS records safely? Maybe there's a clean solution easier than netplan. Clean excludes hacking files generated by generated by resolvconf like /etc/resolvconf/resolv.conf.d/head
  2. If I have to create all interfaces in the file, is there a way to create a netplan file from current settings to reduce the risk of errors?

PS: I do not know if it is important but systemd-resolve is not installed on the machine and /etc/resolv.conf.d contains reference to it:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN # 127.0.0.53 is the systemd-resolved stub resolver. # run "systemd-resolve --status" to see details about the actual nameservers. nameserver 127.0.0.53 search DOMAINS 
2

1 Answer

I finally found the solution here:

In case the link die in the future: Create a file:

sudo mkdir /etc/systemd/resolved.conf.d/ sudo nano /etc/systemd/resolved.conf.d/dns_servers.conf 

Add my dns in this file:

[Resolve] DNS=8.8.8.8 1.1.1.1 

Then restart systemd-resolved

sudo systemctl restart systemd-resolved 

It works even after reboot :-)

PS : No idea why my DNS configuration was lost during the upgrade from 20.04 to 22.04.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy