TUN / TAP
TUN and TAP are virtual network kernel drivers that simulate network devices using software. TUN stands for network tunnel and TAP for network exit (English: tap to German: water tap) but also for Terminal Access Point. While eth0
a corresponding hardware in the form of a network card is normally hidden behind a network device (such as ), packets that are sent to a TUN / TAP device are forwarded to a program in userspace and vice versa. So that a user space program can also access TUN / TAP devices, in contrast to real Ethernet cards, they have a device file with the name tunN
or tapN
below /dev
.
Difference between TUN and TAP
TUN simulates an end-to-end network device ( OSI layer 3) and communicates with the software via IP packets, while TAP simulates a point-to-point connection via Ethernet device (OSI layer 2) and via Ethernet Frames communicated with the software.
Examples of applications
TUN / TAP u. a. For:
-
Virtual Private Networks
- OpenVPN , Ethernet / IP over TCP / UDP ; encrypted, compressed
- tinc [1] , Ethernet / IPv4 / IPv6 over TCP / UDP ; encrypted, compressed
- VTun [2] , Ethernet / IP / serial / Unix pipe over TCP ; encrypted, compressed, traffic shaping
- ICMPTX [3] , IP over ICMP (ping)
- NSTX [4] , IP over DNS
- HTun [5] , IP over HTTP
- peervpn [6] , Ethernet over UDP
- OpenSSH [7] ; encrypted, possibly compressed; Switch -w
- Virtual machine networks
- Bochs
- coLinux
- QEMU
- VirtualBox
- Hercules (S / 390 emulator)
Implementations
TUN / TAP drivers are available for at least the following platforms:
- FreeBSD
- Mac OS X
- Linux , starting around version 2.1.60
- Microsoft Windows 2000 / XP
- OpenBSD
- NetBSD
- Solaris