How to use bridged networking with libvirt and KVM - LinuxConfig.org

Libvirt is a free and open source software which provides API to manage various aspects of virtual machines. On Linux it is commonly used in conjunction with KVM and Qemu. Among other things, libvirt is used to create and manage virtual networks. The default network created when libvirt is used is called “default” and uses NAT (Network Address Translation) and packet forwarding to connect the emulated systems with the “outside” world (both the host system and the internet). In this tutorial we will see how to create a different setup using Bridged networking.


This is a companion discussion topic for the original entry at https://linuxconfig.org/how-to-use-bridged-networking-with-libvirt-and-kvm

This tutorial is outdated today for ubuntu 20.04 with netplan where #######Let NetworkManager manage all devices on this system network: version: 2 renderer: NetworkManager
as not good to edit interfaces managed by NetworkManager
now still looking for tutorial

Found this out the hard way.
I’m running Kubuntu 20.10 and got the bridge working manually but was initially thrown for a loop when I tried to make the bridge persistent, and couldn’t find /etc/network/interfaces.

Pulled in resources from:
www [dot] tecmint [dot] com [slash] create-network-bridge-in-ubuntu
and examples from netplan [dot] io [slash] examples to get the bridge working persistently.

Here is my netplan config: (/etc/netplan/01-networkd-all.yaml)
network:
version: 2
renderer: networkd
ethernets:
enp1s0:
dhcp4: no
bridges:
br0:
dhcp4: no
addresses:
- 10.3.0.6/24
nameservers:
search: [mydomain.local]
addresses: [10.3.0.10]
routes:
- to: default
via: 10.3.0.1
interfaces:
- enp1s0
~
~
~

The rest of the article (as it applies to KVM / libvirt) is still perfectly valid.

I was able to successfully setup a bridge to my local network to run Home Assistant. However I have a device on the network that uses port 5683 to communicate to Home Assistant and I can’t see this device.

When a bridge gets setup to the local network are there any restrictions on ports? How would I enable specific ports (on the KVM guest) to be accessible from outside the KVM guest?

Magnificent guide, the author, how to generate this network enp0s29u1u1? I also have a usb wireless device and it gives me error in its generation.

The error it generates is when trying to add the interface (usb wireless) to bridge with the command.

$ sudo ip link set wlx18d6c715503u master br0
Error: Device does not allow enslaving to a bridge.
$

I am trying to create a bridge from the host system to the kvm/qemu GUI. There are free software systems like Hyperbola, generate error when trying to install a graphical network manager, because the network card is not present in the guest.