Bridged networking with QEMU KVM

I’m using Ubuntu 18.04 LTS Server and I needed to firstly get VLAN’ing working so that one of my VMs could see a separate network. It’s using Netplan so I needed to update the /etc/netplan/50-cloud-init.yaml file to add the VLAN using the vlans: stanza at the bottom.

To create a bridge for QEMU KVM I added the bridges: section at the top.

I also swapped the main ethernet on the box (it’s only got one physical interface) to be a bridged interface too so that I could drop VMs onto the default VLAN and they could be seen by all devices on the network including the QEMU KVM host.

network:
  version: 2
  renderer: networkd
  ethernets:
    enp10s0:
      dhcp4: no
  bridges:
    br00:
      addresses: [ 192.168.10.1/24 ]
      gateway4: 192.168.10.254
  interfaces: [ enp10s0 ]
    nameservers:
      search: [private.mydomain.co.uk]
      addresses: [192.168.10.1, 192.168.10.2]
    br55:
      addresses: [ 192.168.55.2/24 ]
      interfaces: [ vlan55 ]
    vlans:
    vlan55:
      accept-ra: no
      id: 55
      link: enp10s0

So that it appeared in QEMU KVM I added two new XML files into the /etc/libvirt/qemu/networks/ directory, each containing something like this to match the bridges: config above:

<network>
  <name>br00</name>
  <bridge name='br00'/>
  <forward mode="bridge"/>
</network>

Then in virtmanager I added the bridged network interface like this:

virtmanager

garan

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.