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

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. 护眼色的RGB值

    网上流行护眼色的RGB值和颜色代码 在搜索引擎搜“护眼色”,就会搜出一堆关于保护眼睛的屏幕颜色文章,说的统统是一种颜色,有点像绿豆沙的颜色.方法就是在屏幕设置里, 色调:85:饱和度:123:亮度:2 ...

  2. Android 距离传感器修复 修复打电话黑屏 无法快速唤醒屏幕的BUG

    接触Android Xposed开发也很久了,学了这么久的Java,也该弄点东西出来了, public ProximitySensor(Context paramContext, AudioModeP ...

  3. Linux下CGroup使用说明梳理

    CGroup 介绍CGroup 是 Control Groups 的缩写,是 Linux 内核提供的一种可以限制.记录.隔离进程组 (process groups) 所使用的物力资源 (如 cpu m ...

  4. usb驱动开发2之代码地图

    USB只是Linux庞大家族里的一个小部落,host controller是它们的族长,族里的每个USB设备都需要被系统识别.下图显示包含一个USB接口的USB鼠标导出的结果. USB系统中的第一个U ...

  5. OpenGL2.0及以上版本中glm,glut,glew,glfw,mesa等部件的关系

    OpenGL2.0及以上版本中gl,glut,glew,glfw,mesa等部件的关系 一.OpenGL OpenGL函数库相关的API有核心库(gl),实用库(glu),辅助库(aux).实用工具库 ...

  6. ROWNUMBER() OVER( PARTITION BY COL1 ORDER BY COL2)用法

    今天在使用多字段去重时,由于某些字段有多种可能性,只需根据部分字段进行去重,在网上看到了rownumber() over(partition by col1 order by col2)去重的方法,很 ...

  7. CSS 动画之十-图片+图片信息展示

    这个动画主要是运用了一些css3的特性,效果是展示一张商品图片,然后在商品图片的制定位置显示该商品的详细信息.效果在chrome浏览器中预览. <!DOCTYPE html> <ht ...

  8. python selenuim使用代理的方式

    一.FireFox浏览器 myProxy = "60.195.250.55:80" proxy = Proxy({ 'proxyType': ProxyType.MANUAL, ' ...

  9. 用Wireshark抓包分析超过70秒的请求

    超过70秒的请求是通过分析IIS日志发现的: 10.159.63.104是SLB的内网IP. 通过Wireshark抓包分析请求是9:22:21收到的(tcp.stream eq 23080): 09 ...

  10. ModernUI教程:使用预定义的页面布局

    Modern UI for WPF自带了一组页面布局.Modern UI page是继承自control控件的,Page通过是通过ModernWindow.MenuLinkGroups属性来引用显示在 ...