Sitemap
Hank Jacobs

Hank Jacobs

Senior SRE at Netflix

libvirt: Missing Bridge Interface

2 min readOct 4, 2020

TLDR: When using libvirt/qemu, ensure you have a kernel built with CONFIG_VIRTIO_NET=y in order to use a virtio ethernet device within a VM running that kernel.

While experimenting with kernel development, I was using libvirt to set up a VM running a kernel I was hacking on. I followed this excellent guide to set up a development environment using VSCode and a linux box in my home lab. Everything was working well until I realized I had no network connection.

Get Hank Jacobs’s stories in your inbox

Join Medium for free to get updates from this writer.

ip a showed only the loopback interface:

root@ibm-p8-kvm-03-guest-02:~# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever

lspci -v | grep -A 15 Ethernet showed that an ethernet controller was connected and was using the correct driver:

root@ibm-p8-kvm-03-guest-02:~# lspci -v | grep -A 15 Ethernet
01:00.0 Ethernet controller: Red Hat, Inc Virtio network device (rev 01)
...
Kernel driver in use: virtio-pci

I figured it was a configuration issue with libvirt so I set up virt-manager on my mac but realized that libvirt user sessions aren’t visible when using virt-manager via a remote connection. After some research, I found a nifty trick where one can run a GUI linux program over SSH if using XQuartz. To do so, install XQuartz, launch it, and run the “Terminal” application. From there, SSH with X11 forwarding via ssh -X [host] and then launch virt-manager. Unfortunately, virt-manager got me no closer to solving this problem — I went back to the drawing board.

Finally, it dawned on me that I may have to build the kernel with support for virtio network devices. Low and behold, I found a kernel config option titled CONFIG_VIRTIO_NET. Setting it to y and rebuilding the kernel did the trick.

--

--