今天才发现这家伙。。。怎么讲。。。深以为耻。晚上的任务是加深对它的了解,就这么定了。

1. General questions.
1.1 What is the TUN ? 
 The TUN is Virtual Point-to-Point network device.
 TUN driver was designed as low level kernel support for
 IP tunneling. It provides to userland application
 two interfaces:
   - /dev/tunX - character device;
   - tunX - virtual Point-to-Point interface.

Userland application can write IP frame to /dev/tunX
 and kernel will receive this frame from tunX interface. 
 In the same time every frame that kernel writes to tunX 
 interface can be read by userland application from /dev/tunX
 device.

1.2 What is the TAP ? 
 The TAP is a Virtual Ethernet network device.
 TAP driver was designed as low level kernel support for
 Ethernet tunneling. It provides to userland application
 two interfaces:
   - /dev/tapX - character device;
   - tapX - virtual Ethernet interface.

Userland application can write Ethernet frame to /dev/tapX
 and kernel will receive this frame from tapX interface. 
 In the same time every frame that kernel writes to tapX 
 interface can be read by userland application from /dev/tapX
 device.

1.3 What platforms are supported by TUN/TAP driver ? 
 Currently driver has 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 is 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 user space program and instead of sending 
 packets via physical media sends them to the user space program.

Let's say that you configured IPX on the tap0, then whenever 
 kernel sends any IPX packet to tap0, it is 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 be 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.

Linux中的TUN/TAP设备的更多相关文章

  1. tun/tap设备_虚拟网卡

    tun/tap 驱动程序实现了虚拟网卡的功能,tun表示虚拟的是点对点设备,tap表示虚拟的是以太网设备,这两种设备针对网络包实施不同的封装.利用tun/tap 驱动,可以将tcp/ip协议栈处理好的 ...

  2. linux中c表示字符设备文件符号

    linux中c表示字符设备文件,b表示块设备文件,l表示符号链接文件,r表示可读权限,w表示可写权限.linux文件属性解读:文件类型:-:普通文件 (f)d:目录文件b:块设备文件 (block)c ...

  3. Linux下Tun/Tap设备通信原理

    Tun/Tap都是虚拟网卡,没有直接映射到物理网卡,是一种纯软件的实现.Tun是三层虚拟设备,能够处理三层即IP包,Tap是二层设备,能处理链路层网络包如以太网包.使用虚拟网络设备,可以实现隧道,如O ...

  4. Linux下的TUN/TAP编程

    linux下实现虚拟网卡我们在使用VMWARE的虚拟化软件时经常会发现它们能都能虚拟出一个网卡,貌似很神奇的技术,其实在Linux下很简单,有两种虚拟设 备,TUN时点对点的设备,tap表示以太网设备 ...

  5. Linux中什么是块设备 及 lsblk命令的使用

    Linux中I/O设备分为两类:字符设备和块设备.两种设备本身没有严格限制,但是,基于不同的功能进行了分类.(1)字符设备:提供连续的数据流,应用程序可以顺序读取,通常不支持随机存取.相反,此类设备支 ...

  6. 在 Linux 中永久修改 USB 设备权限

    问题 当我尝试在 Linux 中运行 USB GPS 接收器时我遇到了下面来自 gpsd 的错误.看上去 gpsd 没有权限访问 USB 设备(/dev/ttyUSB0).我该如何永久修改它在Linu ...

  7. [转]Linux虚拟网络设备之tun/tap

    转, 原文:https://segmentfault.com/a/1190000009249039 -------------------------------------------------- ...

  8. TUN/TAP编程实现

    其实关于这两种设备的编程,基本上属于八股文,大家一般都这么干. 启动设备之前 有的linux 并没有将tun 模块编译到内核之中,所以,我们要做的第一件事情就是检查我们的系统是否支持 TUN/TAP ...

  9. openstack-networking-neutron(二)---tun/tap

    本博客已经添加"打赏"功能,"打赏"位置位于右边栏红色框中,感谢您赞助的咖啡. 简介 虚拟网卡Tun/tap驱动是一个开源项目,支持很多的类UNIX平台,Ope ...

随机推荐

  1. 查询OOP课程

    --检测有没有名称为MySchool的数据库 use master if exists (select * from sysdatabases where name='myschool') begin ...

  2. linux上的常见命令掌握

    http://coolshell.cn/articles/8883.html 这篇文章来源于Quroa的一个问答<What are some time-saving tips that ever ...

  3. ORACLE中创建和删除临时表

    CREATE GLOBAL TEMPORARY TABLE TABLENAME (   COL1  VARCHAR2(10),   COL2  NUMBER) ON COMMIT PRESERVE(D ...

  4. ASP.NET MVC Razor HtmlHelper扩展和自定义控件

    先看示例代码: using System; using System.Collections.Generic; using System.Linq; using System.Web; using S ...

  5. Redis word bak

    @font-face { font-family: "Arial"; }@font-face { font-family: "Courier New"; }@f ...

  6. WP老杨解迷:评论数和下载量、榜单的关系

    书接上回,继续研讨评论系统的深层经验,这次从另外一个角度看清榜单关系,提升装逼水准2个加号,如果你能看懂本文,并活学活用,足可在Win10之前醉卧隆中,通晓Windows Phone市场风云变幻,哪些 ...

  7. [转]reids客户端 redis-cli用法

    连接:redis-cli -h machine -p port -n db转的:每次都搜,还是扔在这 Redis提供了丰富的命令(command)对数据库和各种数据类型进行操作,这些command可以 ...

  8. [tools]camtasia studio8.6

    实际情况: 装了汉化补丁包后坏事,最后还是没装汉化补丁包.直接用英文版的.安装过程中输入序列号即可激活. ):输入注册码安装 用户名:大眼仔~旭(Anan) 注册码:GCABC-CPCCE-BPMMB ...

  9. php基础02:变量

    1.创建变量 <?php $num1 = 15; $num2 = 15.5; echo $num1+$num2; echo "<br>"; ?> 2.Loc ...

  10. freemarker语法简介

    ftl是一种模板标记语言,用于渲染数据,输入html结构.语法简介如下: ${book.name} ${book.name?if_exists} //值是否存在 ${book.name??} //值是 ...