在 Linux 上设置 Tap 接口

在 Linux 上设置 Tap 接口

我在用着斯卡皮学习如何制作数据包,但是当我尝试执行某些特定操作时,我似乎受到了来自内核的一些干扰。有人建议我使用 tap 接口,这样我就可以更轻松地在本地机器上处理原始数据包,但是我在设置它以使其正常工作时遇到了困难。

到目前为止我所做的是这样的:

[me@localhost hw1]$ ip tuntap add mode tap tap0
[me@localhost hw1]$ ifconfig tap0 192.168.0.254 up
[me@localhost hw1]$ route add -host 192.168.0.253 dev tap0

我的路由表有以下条目

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface    
192.168.0.253   0.0.0.0         255.255.255.255 UH    0      0        0 tap0

当我尝试tcpdump在 tap0 上运行并 ping 它时,tcpdump 没有显示任何发往 tap0 的数据包。

我基本上是想设置一个虚拟接口,以便使用 Scapy 嗅探和发送数据包。如果有人能帮我指明正确的方向,我将不胜感激。

相关内容