Tun/tap devices in Linux

Source: Internet
Author: User

I found this guy today. How to say ... Deeply ashamed. The task of the evening was to deepen the understanding of it, and so it was decided.

1. General questions.
1.1 What is the TUN?
The TUN is Virtual Point-to-Point network device.
TUN driver is designed as low level kernel
IP tunneling. It provides to userland application
Interfaces:
-/dev/tunx-character device;
-Tunx-virtual point-to-point interface.

Userland application can write IP frame to/dev/tunx
and kernel would receive this frame from Tunx interface.
In the same time every frame, kernel writes to Tunx
Interface can is read by Userland application From/dev/tunx
Device.

1.2 What is the TAP?
The TAP is a Virtual Ethernet network device.
TAP driver is designed as low level kernel
Ethernet tunneling. It provides to userland application
Interfaces:
-/dev/tapx-character device;
-Tapx-virtual Ethernet interface.

Userland application can write Ethernet frame to/dev/tapx
and kernel would receive this frame from TAPX interface.
In the same time every frame, kernel writes to TAPX
Interface can is read by Userland application from/dev/tapx
Device.

1.3 What platforms is supported by TUN/TAP driver?
Currently driver have been written for 3 unices:
Linux Kernels 2.2.x, 2.4.x
FreeBSD 3.x, 4.x, 5.x
Solaris 2.6, 7.0, 8.0

1.4 What's Tun/tap driver used for?
As mentioned above, main purpose of TUN/TAP driver is tunneling.
It used by Vtun (Http://vtun.info).

1.5 How does Virtual network device actually work?
Virtual network device can be viewed as a simple point-to-point or
Ethernet device, which instead of receiving packets from a physical
Media, receives them from the user space program and instead of sending
Packets via physical media sends them to the user space program.

Let's say that's configured IPX on the tap0 and then whenever
Kernel sends any IPX packet to tap0, it's passed to the application
(Vtun for example). Application encrypts, compresses and sends it to
The other side over TCP or UDP. Application on other side decompress
and decrypts them and write packet to the TAP device, kernel handles
The packet like it came from real physical device.

1.6 What is the difference between TUN driver and TAP driver?
TUN works with IP frames. TAP works with Ethernet frames.

1.7 What is the difference between BPF and Tun/tap driver?
BFP is a advanced packet filter. It can attached to existing
Network interface. It does not provide virtual network interface.
TUN/TAP driver does provide virtual network interface and it is possible
To attach BPF to this interface.

1.8 Does TAP Driver support kernel Ethernet bridging?
Yes. Linux and FreeBSD drivers support Ethernet bridging.

Tun/tap devices in Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.