From Wiki
Jump to: navigation, search


This page is about some C-applications I wrote to forward data between stdin/out and a tun/tap network interface, a raw socket, or even libpcal (on Linux!). This can be used to bridge network interfaces, bridge a tap interface to some other real interface (and then request a second IP by DHCP, with another MAC address, from the same machine!), or even to build your own VPN (using some other program like netcat). It may also be used for testing purposes and as an easy interface to some network libraries from your own application.


tuntap.c - tun/tap interface

rawsock.c - Raw socket interface

pcap.c - libpcap interface (CAN NOT send data)

pcap_rsend.c - libpcap interface (sends data using a raw socket)

How to use

Connect a tap device to another network interface:

mknod net ##Create a named pipe
./rsio eth0 -raw < net 2>/dev/null | ./ttio tap0 -tap > net 2>/dev/null ##Start the applications

Build your own VPN (run this on both computers):


## On the server:
nc -lp 9990 | ./ttio testdev --tap 1500 | nc -lp 9991

## On the client:
nc SERVER_NAME_OR_IP 9990 | ./ttio testdev --tap 1500 | nc SERVER_NAME_OR_IP 9991