Netplan example script for ethernet bridge Ubuntu Server 20.04+

I love KVM.

To use it effectively sometimes it's kinda slick for the vms to be on your normal subnet so you dont need funny routes to make stuff work.

Netplan scripts are stored in /etc/netplan.

network:
  ethernets:
    enp1s0:
      dhcp4: false
      dhcp6: false
  # add configuration for bridge interface
  # [macaddress] ⇒ specify HW address of enp1s0 or your interface
  bridges:
    br0:
      interfaces: [enp1s0]
      dhcp4: false
      addresses: [192.168.2.xx/24]
      macaddress: aa:bb:cc:dd:ee:ff
      routes:
        - to: default
          via: 192.168.2.1
      nameservers:
    addresses: [8.8.8.8,8.8.4.4]
      parameters:
        stp: false
      dhcp6: false
  version: 2
  renderer: networkd

Once done,

run sudo netplan apply

This will activate your new settings, using this bridge can be done by setting virt-manager to put your vm's on a specified bridge called br0.

This setup has been working nicely for over a year. Hope it helps someone, including myself in the future.

You can subscribe to comment, I'd love to chat, thanks for stopping.