== Notes on running Linux under QEMU with a UDP tunnel network driver == If you get this error inside your QEMU guest OS: "eth0: unknown interface: no such device" ...it probably indicates that your guest OS does not have the e1000 network driver. This was a problem with the linux-0.2.img that the QEMU site links to. I downloaded a ~250MB Debian image from http://people.debian.org/~aurel32/qemu/i386/ that has includes e1000 driver, and it works much better (though it is also much larger :-{ ) == Running QEMU == I am using QEMU emulator version 1.3.50 and used this command to host the Debian image: i386-softmmu/qemu-system-i386 \ -netdev socket,id=mynetdev123,udp=localhost:6666,localaddr=localhost:6667 \ -device e1000,netdev=mynetdev123 \ debian_squeeze_i386_standard.bin This will cause Ethernet frames from the guest image to be sent wrapped in UDP packets (the UDP payload = the Ethernet frame; there is no other encoding or encapsulation as far as I can tell) from port 6667 to port 6666 on the host OS, where you can catch them, send them back, or whatever. There is no special significance to the identifier "mynetdev123", but it must be the same in the -netdev and -device argument. -device declares that the guest machine has a device, -netdev links network devices to the outside world. It seems the names of these arguments and their options have changed a lot from earlier QEMU versions, so I wouldn't be super surprised if they change again. == Playing with it == You might capture the packets with a simple Ruby script... require 'socket' us = UDPSocket.new us.bind('127.0.0.1',6666) while pack = us.recvfrom(2048) puts "Got a frame!" puts pack[0].bytes.collect{|b| sprintf("%02x",b)}.join(' ') end Or use my handy-dandy TUN2UDP program (http://github.com/TOGoS/TUN2UDP) to create a TAP device on the host: $ tun2udp -tap -no-pi -local-address 127.0.0.1:6666 -remote-address 127.0.0.1:6667 ...and in another console... ping6 fe80::5054:ff:fe12:3456%tap0 ...where 'fe80::5054:ff:fe12:3456' is your guest OS's IP6 address and 'tap0' is the name of the TAP device that TUN2UDP created. This should work with IP4 pings, too, but I used IPv6 so I wouldn't have to worry about setting up global addresses. The -tap and -no-pi arguments to TUN2UDP tell it to use the same encapsulation of packets (raw Ethernet frames) as QEMU's UDP driver does.