NOTE: This may duplicate information from
chili555, however in discussion with them, the aforementioned individual suggested posting an 'authoritative' answer as I have worked with this exact issue/question before.
The behavior witnessed in your environment is the
systemd-resolved equivalent of what
dnsmasq on pre-18.04 was doing. The
netplan updates affect the nameservers that
systemd-resolved use for its lookups. This is detailed in the last section of the answer.
But first, for the curious, some history about this behavior, and how it differs from the 'older' Ubuntu versions which use Network Manager and
dnsmasq. (Feel free to skip past the next section of this answer if you only want the 18.04-related stuff)
dnsmasq as a local caching resolver
Prior to 18.04, whenever you used the GUI Ubuntu, it would install
dnsmasq alongside Network Manager. The Network Manager integration with
dnsmasq would update the
dnsmasq list of 'next hop' servers (upstream DNS servers) for where to send a query.
Therefore, a DNS query for
google.com would pass from whatever application is requesting the resolution, into
dnsmasq, and if
dnsmasq doesn't know the IP address or has had a cached entry expire, would then pass the DNS request to whatever upstream DNS server (for this example,
22.214.171.124). You would then have to check Network Manager or the
dnsmasq config to see where the 'upstream' DNS servers were.
This is typical behavior in a graphical Ubuntu installed from the Desktop ISOs.
The default install from the Server ISOs, conversely, followed the traditional "update
/etc/resolv.conf" method via the
resolvconf package and utilized
/etc/resolv.conf directly instead of communicating via
With 18.04, the default DNS system is
systemd-resolved. This operates like the
dnsmasq of old does, except it does this for both Desktop and Server ISO installations currently. It also can integrate with Network Manager (used in the GUI environments for managing wifi and such), and with Netplan (which better handles ethernets)
systemd-resolved is handed from
netplan (servers or custom desktops) or Network Manager (default Desktop images) the list of DNS servers to send queries to (whether statically configured or configured via DHCP). Therefore, using the same example from above, a DNS query to
google.com would pass through
systemd-resolved's stub resolver which would either return the cached lookup value or pass it on to upstream DNS servers.
This emulates the default behavior of
dnsmasq, but also adds some additional lookup handling for how 'localhost', and other local-related addresses can be queried.
With NetPlan, or Network Manager, you can get the list of upstream DNS servers through
systemd-resolved with the following command:
which will give you a bunch of output. The relevant section would look like this (taken from
chili555's answer for expediency):
DNS Servers: 126.96.36.199