Virtual Lab with Qemu and VDE

I’m putting together a hands-on lab for students learning xCAT cluster management. They are being given regular user access to a Linux cluster and need to be able to run virtual machines that talk to eachother for their homework. Below are just some notes on how I accomplished that with qemu and vde without giving students root access.

Create a VDE switch:

1
vde_switch -d -s /tmp/vde.ctl -M /tmp/mgmt

Add NAT and DHCP service:

1
slirpvde -d -s /tmp/vde.ctl -dhcp

Start some VMs with different MAC Addresses:

1
2
3
qemu-system-x86_64 -accel kvm -cpu host -m 2048 -cdrom archlinux-2018.11.01-x86_64.iso -net nic,model=virtio,macaddr=fc:ac:14:e8:8f:32 -net vde,sock=/tmp/vde.ctl &
qemu-system-x86_64 -accel kvm -cpu host -m 2048 -cdrom archlinux-2018.11.01-x86_64.iso -net nic,model=virtio,macaddr=fc:ac:14:e8:8f:33 -net vde,sock=/tmp/vde.ctl &
qemu-system-x86_64 -accel kvm -cpu host -m 2048 -cdrom archlinux-2018.11.01-x86_64.iso -net nic,model=virtio,macaddr=fc:ac:14:e8:8f:34 -net vde,sock=/tmp/vde.ctl &

Manage the switch:

1
vdeterm /tmp/mgmt

Quick Performance Benchmark:

1
2
dd if=/dev/zero of=/dev/shm/foobar
scp /dev/shm/foobar root@vm2:/dev/shm

VM to VM: 130MB/s
VM to host: 100MB/s

Links: