Gnome Boxes with Bridged Networking on Ubuntu 20.04

March 29, 2020 • Code

When I used Fedora, I happily migrated all my VMs from VirtualBox to Gnome Boxes as it really looked seamless with all VMs and remote desktops in one place. Behind the screen, it is running on Qemu/KVM hypervisor.

However, when I migrated my VMs to Ubuntu, I found one thing that’s missing: gnome-boxes uses Qemu’s usermode networking, which means the VM is in isolated network. It can access to the internet, but I couldn’t access my VM from my host computer without using port forwarding.

On Fedora, at least, it is configured to use bridged networking by default. But it seems that we need to do some configurations to enable it on Ubuntu.

After hours of searching and trying, as I am still considered beginner in KVM stuff, I finally found how to make it work, thanks to this article. This has been tested on Ubuntu 20.04.

The simplest way to do this, is by installing gnome-boxes, virt-manager and all their dependencies:

sudo apt-get install gnome-boxes virt-manager

When installing Gnome Boxes, it only configures the minimum that is necessary to run VMs in user session (qemu:///session). However it doesn’t setup bridged network.

By installing virt-manager, it will also install the necessary packages to run VMs on the system level (qemu:///system). Additionally, this will also configures a bridge interface by default, named virbr0.

By the way, virt-manager can also be used if you’d like to manage your VMs further with a GUI.

After installing the packages, we will now need to give user session access to the system’s virbr0 via qemu-bridge-helper, by writing this into /etc/qemu/bridge.conf (create the folder and file if it doesn’t exists):

allow virbr0

Now, we allow regular user to execute qemu-bridge-helper program:

sudo chmod u+s /usr/lib/qemu/qemu-bridge-helper

Using virt-manager, connect to Qemu/KVM User Session (qemu:///session) and modify the VM, select NIC and change the following:

  • Host device: Specify shared device name
  • Bridge name: virbr0

Apply the changes.

Now run the VM from Gnome Boxes. If you open its properties while the VM is running, you will be able to see that it now has an IP address which can be accessed from the host.

One response to “Gnome Boxes with Bridged Networking on Ubuntu 20.04”

  1. Gabriel says:

    OpenSUSE Tumbleweed users can find qemu-bridge-helper at /usr/libexec/qemu-bridge-helper

Leave a comment