From Wikipedia, the free encyclopedia
Jump to navigation Jump to search

In computer networking, TUN and TAP are virtual network kernel interfaces. Being network devices supported entirely in software, they differ from ordinary network devices which are backed up by hardware network adapters.

The Universal TUN/TAP Driver originated in 2000 as a merger of the corresponding drivers in Solaris, Linux and BSD.[1] The driver continues to be maintained as part of the Linux[2] and FreeBSD[3][4] kernels.


TUN and TAP in the network stack

Though for similar tunneling purposes, only one at a time can be used because TUN and TAP apply to different layers of the network stack. TUN, namely network TUNnel, simulates a network layer device and operates in layer 3 carrying IP packets. TAP, namely network tap, simulates a link layer device and operates in layer 2 carrying Ethernet frames. TUN is used with routing. TAP is used for creating a network bridge.[2]

Packets sent by an operating system via a TUN/TAP device are delivered to a user-space program which attaches itself to the device. A user-space program may also pass packets into a TUN/TAP device. In this case the TUN/TAP device delivers (or "injects") these packets to the operating-system network stack thus emulating their reception from an external source.[2]


Virtual private networks
Virtual-machine networking
Connecting real machines with network simulation


Platforms with TUN/TAP drivers include:

See also[edit]


  1. ^ "Universal TUN/TAP driver". VTun project on SourceForge. Retrieved 2019-07-12.
  2. ^ a b c "Universal TUN/TAP device driver". GitHub mirror of Linux kernel. Retrieved 2019-07-12.
  3. ^ "TUN(4) manual page". FreeBSD. Retrieved 2019-07-12.
  4. ^ "TAP(4) manual page". FreeBSD. Retrieved 2019-07-12.
  5. ^ "ns3::TapBridge Class Reference". nsnam.org. Retrieved 2019-03-28.
  6. ^ Back to My Mac uses an IPv6 tunnel on device utun0.
  7. ^ "de.schaeuffelhut.android.openvpn". F-Droid. 2013-01-10. Retrieved 2019-03-28.

External links[edit]