Issue:
After do-release-upgrade to 18.04 the DNS server references in the interfaces file were ignored/not working.
The DNS servers referenced in the /etc/network/interfaces file, dns-nameservers entry are no longer working. The references in /etc/resolv.conf automatically being maintained are also not correct. The /etc/resolv.conf contained the current server and the default "bootstrap" entry.
Note:
In Ubuntu 22.0.x, the gateway4 entry has been deprecated. Use the default route to syntax instead.
... routes:
- to: default
via: 192.168.1.1
(See Ubuntu 20 or 22 Network Bridge Configuration with NetPlan in this support library for newer syntax.)
$ cat /etc/network/interfaces
...
auto eth0
iface eth0 inet static
dns-nameservers: 21.34.123.123, 21.34.45.67
dns-search example.com my.example.com
...
Changing to individual dns-nameserver entries, did not work.
dns-nameserver: 21.34.123.123
dns-nameserver: 21.34.45.67
Previously, these dns-entries would be automatically added to the /etc/resolv.conf.
Next we proceeded to looking in the Netplan configuration. In looking in the /etc/netplan/ folder, there were no YAML configuration files 01-netcfg.yaml or 50-cloud-init.yaml files. The folder was empty.
Resolution:
1. Create new YAML configuration file:
Since no files existed, we will create either a 01-netctg.yaml or 50-cloud-init.yaml file.
$ sudo vi /etc/netplan/01-netcfg.yaml
( new file is created )
<a>
network:
version: 2
renderer: networkd
ethernets:
ens3:
dhcp4: no
addresses:
- 12.34.12.12/24
gateway4: 192.168.121.1
nameservers:
addresses: [21.34.123.123, 21.34.45.67]
<esc>:wq
2. Update netplan apply
$ sudo netplan apply
3. Confirm that the new DNS servers are now in effect:
$ systemd-resolve --status | grep 'DNS Servers' -A2
previous page
|