问题标签 [tun]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
sockets - 内核如何将 ip 地址和 nic 分配给套接字
当你写这样的东西时:
当没有提供有关绑定套接字的信息时,linux内核如何知道它应该从哪个网卡发送数据包。
例如,我如何用我自己的 tun/tap 接口替换这个默认的 nic?
另外,我在哪里可以获得有关此主题的更多深入信息?
c - 转换从 TUN 接口接收的原始数据包数据
我正在尝试拦截通过 TUN 接口的数据包。我想将原始数据包信息转换为可读信息,以便以后使用。
我正在使用以下代码:
似乎我无法读取数据包的协议和 ip src 地址。我得到了奇怪的结果。
你能帮忙吗?
谢谢!
linux - how to test user space tcp/ip stack?
I am working on a user space tcp stack (mostly just for fun) and I am having some trouble testing it against the unix tcp stack. Currently the only form of testing is done via unit tests. However, I want to test my tcp stack against a real kernel tcp stack. I tried the following setups without much success.
using raw sockets: I wrote a simple echo tcp server that accepts connection using the kernel tcp socket. The tcp server listens to port 8080 on localhost. My tcp client uses the user space tcp stack. However, the kernel sends a tcp rst whenever the client sends a syn to the server. It kind of work after I modified iptable to drop all tcp rst packets. However, even though the 3 way syn, syn+ack, ack handshake is established, the server cannot recv any packet that my client sends. I eventually gave up on raw sockets.
using tun/tap: Similarly the echo server uses kernel tcp socket and listens on localhost port 8080. The client opens a tap device. The tap device has an ip of 10.0.0.1 and my client assumes an ip of 10.0.0.2. I am able to ping 10.0.0.2 from my computer. However, when my client sends a syn to the tcp server over the tap device, the server does not respond.
Note: I am using ubuntu 12.04.
android-ndk - 如何使用本机代码 C 在 android 上打开水龙头设备?
我正在尝试为基于 Android 的应用程序构建一个 VPN 客户端移动设备,这些应用程序通过 VPN 隧道连接到虚拟基础设施。我有一个类似的 Linux/Windows 应用程序,我知道如何打开 tun/tap 设备(打开 /dev/net/tun)。我们如何使用 C 为 Android 做同样的事情?
另外,android.net API 中的 VpnService 类究竟做了什么?
python - 大于 MTU 的数据包到达 TUN 接口
我正在使用pytun设置一个 TUN 并将到达它的数据包转发到使用 UDP 的另一台机器。令我不解的是,即使我已将 TUN 配置为具有 141 字节的 MTU,我仍在读取大小为 145 的数据包。请看下面的代码:
我已经使用 . 验证了接口的实际 MTU ifconfig
。
我错过了什么吗?
linux - difference tun/tap, is the interfaces that handle protocols or the OS?
I have difficulties to understand difference between tap and tun interface. I know it is an often asked question and I apologize for that.
I read tap work at layer 2 and tun works at layer 3. I also read that tap is used for bridging and tun is used for routing. I already heard things like "ROUTERS work at layer 3" or "BRIDGES work at layer 3" : this make sense for me because routers manipulate layer 3 protocols and bridge manipulate layer 2 protocols? but, because tap and tun are "interfaces", it means the sentence like "INTERFACES work at layer 3" has a sense but i don't understand what it is : I mean interfaces doesn't manipulate protocols(the OS do that but not an interface) so it sounds like tun interface == tap interface:
If I create two tap interfaces(with tunctl) with two ip that are on different networks (192.168.2.1/24 and 192.168.3.1/24), then I link these to two kvm virtual machine (one tap interface match to one VM) and if I enable routing on the host, my two VM can communicate.
So tap interfaces can also be used for routing : what is the difference with tun ? maybe a tap is also a tun interface?
Also I can create a tap interface with tunctl command but how can I create a tun interface with the same command(the command is called TUNctl not TAPctl...)?
Can you help me to clarify that? Thank you.
c - 如何使用 TUN/TAP 接口在两个进程之间发送数据包?
我有两个进程,我试图模拟两个进程代表两个switches
通过电线连接的情况。我希望能够将数据包从一个进程发送到另一个进程。另一个用例是,这些过程中的每一个也可以连接到数据包生成器。
我是网络新手,遇到了 TUN/TAP 接口,似乎是在这里使用的逻辑接口。但是,我对一件事有点困惑:
- 这两个进程是否各有自己的接口?当我必须从进程 A 向 B 发送数据包时,我会向 B 接口发送数据包吗?
或者
- 如果两个进程连接到同一个接口怎么办?那将如何运作?
python - 如何从两个不同的进程附加到 TAP 接口
我有一个这样创建的点击界面:
然后我附加到tap0
使用 python 和另一个用 C++ 编写的程序
Python:
(仅用于模拟)如果我尝试附加到 tap0 两次:
当我运行它时出现错误f2
:
如何从多个进程附加到 Tap 接口?
android - 如何克服 Android for VPN 中的 TUN.KO 驱动程序问题
如何克服少数安卓设备中的“Tun.ko”驱动程序问题,因为 VPN 无法连接。有什么方法可以识别“Tun.ko”驱动程序的存在并禁用VPN,或者如果可能的话在不root的情况下安装驱动程序?
谢谢
linux - 如果命令 "cat /dev/net/tun" 结果 $string 然后
我正在创建一个脚本来检查 VPS 是否启用了 TUN 驱动程序。检查命令是:
如果它返回:
该模块已启用。否则返回错误。
这是我的脚本:
我得到ERROR
消息。
我用一个文本文件尝试了相同的脚本,它工作了......