Setting up networking in Qemu for using OpenNSM

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:

modprobe tun
chmod a+rwx /dev/net/tun

Next the bridge setup on eth1. The tap was added to it later.

brctl addbr br0
ifconfig eth1 up
brctl addif br0 eth1

Added an IP Address to the bridge in the subnet connected to the eth1 NIC.

ifconfig br0

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 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/ in the OpenBSD installation to setup the system with a unique IP Address. I chose After this I could use networking from my OpenNSM installation šŸ™‚

3 thoughts on “Setting up networking in Qemu for using OpenNSM

  1. Thank you! you are a god! šŸ˜€

    I’ve reading 5,6 manuals about tap and tun and I had no luck…

    Your manual it’s the first sucessful networking on KVM/QEMU using new kernel virtualization, and i have Internet into my guest now…


  2. To use brctl you will need to install bridge-utils šŸ™‚
    # apt-get install bridge-utils
    (I’m using Debian Stable 4.0 a.k.a. ETCH)

    I’ve tried to follow this post but I did not have the brctl util (DUH!)
    So.. Google said that bridge-utils is required!

    Thanks from Brazil for the post, dude. Helps a lot!
    Great job šŸ˜‰

  3. Pingback: Qemu Network on Linux « WebDrops

Comments are closed.