A QEMU question regarding user mode networking

submited by
Style Pass
2024-12-13 16:30:04

I want to run a Debian cloud image with qemu-system-x86_64 so that the guest operating system has network access using user mode networking.

I want to use this as part of my CI system (Ambient). I would prefer to not use TUN/TAP networking, or to set up a bridge on the host. I’m aware that user mode networking with QEMU is constrained and limited, and I’m OK with that.

I’ve attached the script I’ve been experimenting with. To run, give it two arguments: the URL to the cloud image published by Debian, and the local filename where to store that.

You can run the script as an unprivileged user. If will run faster if you can use the Linux kernel kvm module, but it isn’t required. On my laptop the device takes about three minutes to run, assuming the image has been downloaded already.

What the script does is set up cloud-init to run ip a, and then run a VM with the cloud image and the cloud-init configuration, with two virtual serial ports directed to files console.log and run.log. The ip command output goes to the second one.

Leave a Comment