taprouter - a virtual TAP router for virtual machines and alike

(or how to get easy networking with DOSemu)

What is this?

taprouter is a tool that makes it possible to use SLiRP connectivity over a virtual L2 TAP interface.

Since this description is probably of no big help to you, let's rephrase:
taprouter allows you to get internet connectivity from within any TAP interface. The main use case is to provide networking to virtual machines or alike (I specifically wrote taprouter to make networking in DOSemu much easier, but it might have other interesting usage, too).

taprouter comes with a companion library named 'librouter'. librouter provides the 'slirp-powered user mode networking' through a small set of functions. It's designed to be easily implementable in other projects.

taprouter and librouter are free software, licensed under the GNU GPL.

[ Download area ]

Build process

taprouter is written in ANSI C89. To build it, you will need a C compiler - preferably gcc (that's the only one I tested). The build process is as simple as going into the directory where source files of taprouter reside, and typing "make".

How to use it? (example with DOSemu)

First, note that you will need to have SLiRP installed on your system. You might want to look here for some ready-to-install SLiRP packages for a few Linux distributions.

Then, you will need to prepare the networking side. It's basically about creating two TAP interfaces belonging to the user that will use them (one for taprouter, and the other one for your DOSemu instance), and grouping them together within a common bridge:

# ip tuntap add tapdosemu mode tap user mateusz
# ip tuntap add taprouter mode tap user mateusz
# ifconfig tapdosemu up
# ifconfig taprouter up
# brctl addbr mybridge
# ifconfig mybridge up
# brctl addif mybridge tapdosemu
# brctl addif mybridge taprouter

Once this is done, you will have to configure your DOSemu instance to bind to the tapdosemu virtual interface. To do so, you will have to edit your ~/.dosemurc file, and set following parameters:

$_pktdriver = (on)
$_vnet = "tap"
$_netdev = "tapdosemu"

The last step is about launching taprouter, telling it to bind to the TAP interface we prepared, and providing the path to the slirp executable:

$ taprouter taprouter /usr/bin/slirp

Obviously, you will have to configure network parameters inside your DOSemu system as well. taprouter expects you to use the IP address as a default gateway, and configure your system to be anything part of Since taprouter provides a DHCP service, you can rely on DHCP to autoconfigure all IP settings.

A working example of a wattcp.cfg file is as simple as that:

my_ip = DHCP

And that's it! If everything went nice, you should be able to have networking capabilities within DOSemu now.

Note: if things don't work out of the box, it might be related to a firewall (usually: iptables) being set up on your machine.

Mateusz Viste
Contact: >2E6FDKoG:DE6]7C (rot47)