I upgraded a 16.04 Ubuntu server to 22.04. Migration to 18.04 and 20.04 worked well. However, 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 comfortable with them (I'm afraid that I will 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 that the enp2s0f0
device has no DNS defined.
My questions are:
- How to add my DNS records safely? Maybe there's a clean solution easier than
netplan
. Clean excludes hacking files generated by generated byresolvconf
like/etc/resolvconf/resolv.conf.d/head
. - If I have to create all interfaces in the file, is there a way to create a
netplan
file from the 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 the following 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
man systemd-resolved systemd-dnsmasq dnsmasq
and theman
pages in their "See also" sections.dnsmasq
is your local DNS server, and knows about/etc/hosts
. Please seehttps://netplan.io
andhttps://netplan.io/examples
.