# taptap - a virtual ethernet

taptap.c

I wrote this little program in March 2003 when i tried building myself a VAXtop out of simh, linux and my laptop.

The trouble with the implementation of network interfaces in simh and other emulators is that they use a real interface in promiscous mode and use pcap for receiving packets on them. This method has some drawbacks, the most serious in my opinion being that the system running in the emulator cannot communicate with the system hosting the emulator using the net.

I remembered that the p11 emulator uses tun or tap for networking and that it was possible to telnet to the emulated PDP-11, so i tried to implement a tap backend for sim_ether.c of simh. I got it to a somewhat working state, but it worked only on Linux and i didn't like it much because it was a simh-only solution. That was the moment when i had the idea of using two tap devices and multiplexing packets between them to create a virtual ethernet.

Taptap opens two /dev/net/tun, switches them into tap mode with ioctl(), forks and then writes into one device what it read on the other in both processes in different directions. You configure both of the two tap devices up, assign an IP address to one of them and attach simh to the other. Now you should now be able to communicate with the system in the emulator using the net. If you want to, you can even bridge the tap device not attached to the emulator to your real ethernet, effectively making the emulated system a part of your real network.

Up to now, taptap is Linux-only, but it shouldn't be hard to make it run on other systems that have a tap driver (Solaris, FreeBSD and soon NetBSD). Markus Weber has put together some how-to about taptap.

back