NetPlan CheatSheet

(last updated 2020/11/28)

I haven't touched lower-level network administration in a few years, but as part of a personal project I'm setting up a server from scratch. My fond memories of "ifup" and "/etc/network/interfaces" are pretty obsolete, and I'm not _that_ happy with the current state of getting-started-type documentation around NetPlan. This is a cheat sheet for my own use, but if you find it useful or want to suggest additions, shoot me an e-mail. :)

Config Paths

  • Ubuntu: /etc/netplan/00-installer-config.yaml

Update after config change

After making changes to the yaml file, you'll need to reload them. Of course this happens on system boot, but to apply it immediately, run:
sudo netplan generate
 sudo netplan --debug apply

Example Bridge Suitable for libvirt usage

This was easily the most annoying part to find documented. In this example, eno4 is the physical network interface (in case it wasn't obvious); substitute for eth0 or whatever you've got. This example was based on existing examples[2] but simplified somewhat. It is actually running on one of my home lab servers.

network:
  ethernets:
    eno4:
      dhcp4: no
  bridges:
    br0:
      interfaces:
        - eno4
      dhcp4: yes
  version: 2

With this config, setting libvirt guests in bridge mode with bridge br0 will work as expected. Unfortunately, this isn't currently documented on the main libvirt page[3] (as of 2020/11/28) - the instructions there will work up until Ubuntu 18.04, or current Debian, but not on Ubuntu 20.04 or any other netplan-based distribution.

References

[1] https://fabianlee.org/2019/04/01/kvm-creating-a-bridged-network-with-netplan-on-ubuntu-bionic/
[2] https://netplan.io/examples/
[3] https://wiki.libvirt.org/page/Networking#Bridged_networking_.28aka_.22shared_physical_device.22.29 

This article was updated on November 28, 2020

Seattle-area tech worker with diverse interests and infinitesimal editorial capacity.