Have a Plan for Netplan

Ubuntu changed networking. Embrace the YAML.

If I'm being completely honest, I still dislike the switch from eth0,
eth1, eth2
to names like, enp3s0, enp4s0, enp5s0. I've learned to accept
it and mutter to myself while I type in unfamiliar interface names. Then I
installed the new LTS version of Ubuntu and typed vi
. Yikes. After a technological lifetime of entering
my server's IP information in a simple text file, that's no longer how
things are done. Sigh. The good news is that while figuring out Netplan for
both desktop and server environments, I fixed a nagging DNS issue I've had
for years (more on that later).

The Basics of Netplan

The old way of configuring Debian-based network interfaces was based on the
ifupdown package. The new default is called Netplan, and
although it's not
terribly difficult to use, it's drastically different. Netplan is sort of
the interface used to configure the back-end dæmons that actually
configure the interfaces. Right now, the back ends supported are
NetworkManager and networkd.

If you tell Netplan to use NetworkManager, all interface configuration
control is handed off to the GUI interface on the desktop. The
NetworkManager program itself hasn't changed; it's the same GUI-based
interface configuration system you've likely used for years.

If you tell Netplan to use networkd, systemd itself handles the interface
configurations. Configuration is still done with Netplan files, but once
"applied", Netplan creates the back-end configurations systemd requires. The
Netplan files are vastly different from the old /etc/network/interfaces
file, but it uses YAML syntax, and it's pretty easy to figure out.

The Desktop and DNS

If you install a GUI version of Ubuntu, Netplan is configured with
NetworkManager as the back end by default. Your system should get IP
information via DHCP or static entries you add via GUI. This is usually not
an issue, but I've had a terrible time with my split-DNS setup and
systemd-resolved. I'm sure there is a magical combination of configuration
files that will make things work, but I've spent a lot of time, and it
always behaves a little oddly. With my internal DNS server resolving domain
names differently from external DNS servers (that is, split-DNS), I get random
lookup failures. Sometimes ping will resolve, but
dig will not. Sometimes
the internal A record will resolve, but a CNAME will not. Sometimes I get
resolution from an external DNS server (from the internet), even though I
never configure anything other than the internal DNS!



Read More here.