Using Quickemu and bridge networking to access services on a VM

Quickemu is an easy and fast way to launch VMs without using proprietary garbage like vmware or virtualbox. It comes loaded with sane defaults and tested on dozens of OS'.

I like to run VMs for some development work. It’s a good way to keep your system tidy and isolated from 10,000 node packages that are required for that one tool you wanted to try out.

Bridge Mode

I want to setup a network bridge so that the VM gets an IP address from my LANs DHCP and I can access any services running on it.

Here’s a quick run down using iproute2 (run as root on the host):

❯ ip link add name br0 type bridge
❯ ip link set dev br0 up
❯ ip link set enp5s0 master br0
❯ ip address del 192.168.1.100/24 dev enp5s0
❯ ip address add 192.168.1.100/24 dev br0
❯ ip route append default via 192.168.1.1 dev br0

Also, disable dhcp if it’s running.

WARNING: This could break networking on a Desktop environment with a integrated network manager. More details on the arch wiki

The Problem

Running quickemu in bridge mode should be simple right? Just head over to the quickemu wiki and the answer is right there.

Wrong! The answer is unfortunately in several places.

If you put network="br0" in your config file, quickemu doesn’t output any errors. It just fails to run.

I like to watch for these process’ to see if they’re actually running or not.

❯ watch -n1 "ps aux | grep qemu | grep -v watch | grep -v grep"

NOTE: Backup your disk.qcow2 files! It’s easy for the disk to become corrupt if you do something wrong.

Inside the VM folder there’s a file with .log extension which should log any errors.

❯ cat alpine-v3.20/alpine-v3.20.log
access denied by acl file
qemu-system-x86_64: -nic bridge,br=tap0,model=virtio-net-pci: bridge helper failed

Let’s find qemu’s config files:

❯ locate qemu

And we find our answer

❯ cat /etc/qemu/bridge.conf
allow virbr0

The default qemu bridge config file needs to allow br0 since that’s what we setup. We can also name the bridge virbr0 instead.

I found some more details here on the archwiki

GLHF!