简体   繁体   English

Linux:如何模拟接口上的传入数据包?

[英]Linux: How to simulate incoming packets on an interface?

How can I simulate some incoming traffic on a specific software interface? 如何模拟特定软件界面上的某些传入流量? The reason for this need is that we have a couple of software interfaces between Ether level and IP level, which will parse our own L2.5 headers along the network stack, ie 产生这种需求的原因是,我们在Ether级别和IP级别之间有几个软件接口,它们将沿着网络堆栈解析我们自己的L2.5标头,即

eth header -> virt_dev1 -> virt_dev2 -> IP -> TCP

I was looking at TAP, which looks like it can help. 我正在查看TAP,它看起来可以提供帮助。 But I do not understand how to chain this TAP interface to our own software interfaces so the packets will go through the expected network stack? 但是我不明白如何将此TAP接口链接到我们自己的软件接口,以便数据包将通过预期的网络堆栈? Maybe my understanding of TAP is not correct? 也许我对TAP的理解不正确?

Thanks, 谢谢,

The tap interface acts like a Layer 2 port to the networking stack - reading and writing from the device node will ingest/retrieve packets from the networking layer. tap接口的作用类似于网络堆栈的第2层端口-从设备节点读取和写入将从网络层接收/检索数据包。 Where those packets go after that point is up to the networking configuration (forwarding, bridging, etc). 这些数据包在此之后到达的位置取决于网络配置(转发,桥接等)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM