SEANK.H.LIAO

qemu notes

random notes on qemu

qemu

I played around with qemu for a bit, thinking I could isolate all my workloads into VMs and keep my bare metal host relatively clean. Unfortunately, it appears that qemu was unstable on my Heztner AX51, with machines that just suddenly spin max out the CPU and hang randomly, even if they were fine on my laptop.

Here are my notes from before I gave up on it:

networking

TAP networking mostly works, create a linux bridge, attach tap devices to it and pass to qemu. Also enable IPForward and IPv4ProxyARP.

-nic is apparently the new way to specify network devices, replacing -net or a combination of -netdev ... -device ...

1# new
2$ qemu ... -nic tap,ifname=tapqemu01,script=no,downscript=no,model=e1000,mac=52:54:00:00:01:01
3
4# old
5$ qemu ... -netdev tap,id=net0,ifname=tapqemu01,script=no,downscript=no -device e1000,netdev=net0,mac=52:54:00:00:01:01

As for IP addressesing, you could run a DHCP server, but where's the fun in that? A MAC address gives you 6 bytes, 4 if you don't count the 52:54 prefix. 4 bytes is also an IPv4 address, and maybe good enough for IPv6, so just derive L3 addresses from L2, after all, you control all the devices on the network, no collisions possible.

systemd-networkd

Did you try to get networkd to autogenerate an IPv6 address in a subnet that is not exactly /64? Sorry, it doesn't work.

packer

The devops people rave about hashicorp packer, but what does it do? Boot up a VM, type in the characters you've said from the config into a terminal, and continue. And the way to sync? Wait.