I've been playing with qemu getting it to talk to the network. By default, qemu uses a "usernet" mechanism which doesn't require any privileges, but I've also had no luck with getting to work talking to the public network. I found a program that Rusty Russell wrote that sets up a tun device and calls qemu connected to this tun device. I wanted to take it in a different direction.
I wanted to connect qemu to a tap device, so that I could directly connect it to the network or other qemu instances with no intervening routing NATing. A quick modification to the program Rusty Russell wrote to interface qemu to the tun device resulted in a similar program which connects to the tap device.
You can build this program with "cc -o tapdev tapdev.c", then run qemu under tapdev with "./tapdev root - qemu
ifconfig eth0 0.0.0.0 up ifconfig tap0 0.0.0.0 up brctl addbr br0 brctl addif br0 eth0 brctl addif br0 tap0 ifconfig br0 up
I didn't put an IP address on br0 because I use eth1, my wireless, for my normal ethernet connection. Bridging over eth1 wasn't working because of wireless quirks with MAC addresses, but it works great over wired ethernet. If you use eth0 for your primary net connection, you'll need to drop the IP from eth0, and set it up on br0.
This is working great so far. Thanks for the base code, Rusty.comments powered by Disqus