KVM: Network bridge with Netplan

Ubuntu 18.04 settings still depend on Network Manager, and wifi/3G is not supported by networkd yet. The following example uses Network Manager for all interfaces.

/etc/netplan/01-netcfg.yaml

---
network:
  version: 2
  # if specified globally, can only realistically have that value,
  # as networkd cannot render wifi/3G.
  renderer: NetworkManager
  ethernets:
    enp42s0:
      gateway4: 192.168.1.1
      dhcp4: false
      # Specify static address, and netmask.
      addresses: [192.168.1.10/24, '2001:1::10/64']
  bridges:
    br0:
      dhcp4: false
      interfaces: [enp42s0]

Steps to add a bridge to libvirt.

Create a file /tmp/br0.xml

<network>
  <name>br0</name>
  <forward mode='bridge'/>
  <bridge name='br0'/>
</network>

Now have libvirt add the new network, and autostart it.

virsh net-define /tmp/br0.xml
virsh net-start br0
virsh net-autostart br0

The br0.xml file will be in /etc/libvirt/qemu/networks. The default NAT network file will be here as well. Check that br0 has been added successfully.

virsh net-list --all

Name                 State      Autostart     Persistent
----------------------------------------------------------
br0                  active     yes           yes
default              active     yes           yes

All new network interface additions will have a br0 bridge option.