Geek00L has created a OpenBSD 4.0 based QEMU image called OpenNSM which I decided to give a try. Getting the networking part to work with my Linux host was a bit of a puzzle, so i’m writing it down here. Most of the steps were taken from the unofficial qemu wiki page here, but not all of them were necesarry.
First of all, I had to use the QEMU version 0.8.2 from the QEMU website, because the 0.8.0 version from my Ubuntu Dapper workstation didn’t work. With the latter version the OpenBSD bootup would just hang at the message ‘clock: Unknown CMOS layout’.
For the networking to work, I needed to setup a bridge between the actual NIC and the tap interface that QEMU was going to talk to. First the tap:
chmod a+rwx /dev/net/tun
Next the bridge setup on eth1. The tap was added to it later.
brctl addbr br0
ifconfig eth1 0.0.0.0 up
brctl addif br0 eth1
Added an IP Address to the bridge in the subnet connected to the eth1 NIC.
ifconfig br0 192.168.2.12
After this I setup the file /etc/qemu-ifup. This file is called by QEMU on startup to setup the tap networking.
sudo /sbin/ifconfig $1 0.0.0.0 promisc up
sudo /usr/sbin/brctl addif br0 $1
Now I was ready to start the image:
qemu -hda OpenNSM.img -m 256 -net nic -net tap
Once the image was booted, I made the corrections described by Geek00L here. Finally, I ran /root/nsm-scripts/net-config.sh in the OpenBSD installation to setup the system with a unique IP Address. I chose 192.168.2.13. After this I could use networking from my OpenNSM installation🙂