I'm renting a VPS from Linode with Ubuntu 20.04 LTS (Focal Fossa) installed on it. But the default DNS server from Linode doesn't resolve a domain name which I really need it to resolve. Therefore, I tried to edit my netplan configuration to change the DNS server to Google's one, since the VPS is obviously headless. I edited the file /etc/netplan/01-netcfg.yaml to contain the following:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: yes
nameservers:
addresses: [8.8.8.8, 8.8.4.4]
Ubuntu 20.04 was using networkd as the netplan backend by default. I linted the YAML and it is correctly formatted. DHCP is on by default (as by setting dhcp4: yes) and turning it off (by setting dhcp4: no) does not correct the problem. eth0 is the name of my network connection as per ip a
. However, whenever I run sudo netplan apply
after saving the netplan configuration file the active nameserver does not seem to change as per sudo systemd-resolve --status
. Even forcing networkd to restart by running sudo ip link set eth0 down
and sudo ip link set eth0 up
or restarting systemd-resolved by running sudo systemctl restart systemd-resolved
does nothing.
Why is it so difficult to change the DNS server on Ubuntu Server 20.04 LTS? Am I missing something here?
Thank you so much in advance for your help,
Joshua
EDIT:
Output of sudo lshw -C network
:
*-network
description: Ethernet controller
product: Virtio network device
vendor: Red Hat, Inc.
physical id: 4
bus info: pci@0000:00:04.0
version: 00
width: 64 bits
clock: 33MHz
capabilities: msix bus_master cap_list rom
configuration: driver=virtio-pci latency=0
resources: irq:20 ioport:c080(size=64) memory:febd3000-febd3fff memory:fe
008000-fe00bfff memory:feb80000-febbffff
*-virtio2
description: Ethernet interface
physical id: 0
bus info: virtio@2
logical name: eth0
serial: f2:3c:93:91:e5:ed
capabilities: ethernet physical
configuration: autonegotiation=off broadcast=yes driver=virtio_net
driverversion=1.0.0 ip=170.187.185.46 link=yes multicast=yes
Output of sudo ls -al /etc/resolv.conf
:
lrwxrwxrwx 1 root root 37 Feb 24 06:53 /etc/resolv.conf -> /run/systemd/resolve/stub-resolv.conf
Output of sudo cat /etc/resolv.conf
:
# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients to the
# internal DNS stub resolver of systemd-resolved. This file lists all
# configured search domains.
#
# Run "resolvectl status" to see details about the uplink DNS servers
# currently in use.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.
nameserver 127.0.0.53
options edns0 trust-ad
search members.linode.com
Output of sudo cat /etc/network/interfaces
:
# ifupdown has been replaced by netplan(5) on this system. See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
# sudo apt install ifupdown
Output of cat /etc/netplan/*.yaml
:
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: true
dhcp4-overrides:
use-dns: false
nameservers:
addresses: [8.8.8.8, 8.8.4.4]