问题描述
我在 ubuntu 中使用 tcpdump 和 tcpreplay 来捕获数据包和重新发送(在 raspBerry pi 中为 ap 模式重写和 openwrt。@H_404_1@
我的问题是我无法捕获重新发送的数据包。@H_404_1@
这是我的网络:@H_404_1@
A ----> B(RPI) -----------> C
192.168.0.199 eth0. wlan0 | 192.168.2.172
192.168.0.100 192.168.2.1 |
------------> D
192.168.2.222
我从 A 向 B 发送数据包(使用 nping),并使用端口转发@H_404_1@
nping A :@H_404_1@
nping --udp --dest-port 7777 --dest-ip 192.168.0.100
在 B 中使用 iptables 进行端口转发:@H_404_1@
iptables -t nat -A PREROUTING -i eth0 --dport 7777 -j DNAT --to 192.168.2.222
我用 D 写的@H_404_1@
tcpdump -i wlan0 dst port 7777 -w packet.pcap
tcprewrite -i packet.pcap -o packet_rewrite.pcap -D 192.168.2.222:192.168.2.172
tcpreplay -i wlan0 --topspeed packet_rewrite.pcap
但是,在 C 中,我无法捕获修改后的数据包...@H_404_1@
tcpdump dst port 7777
我真的很想知道为什么我不能...请告诉我
我真的很抱歉我的解释不好......@H_404_1@
解决方法
进一步搜索..我在B(wlan0)中捕获了数据包 因为我将数据包的源 mac 编辑为我的 ubuntu wlan mac 地址... 但是和以前一样,我无法在 C 中捕获数据包... This is captured packets in B
甚至重放的数据包都没有通过 iptables...
我解决了!!!!!!!!!!!!!!!
我不得不将 dmac 更改为 C 的 mac 地址....我是愚蠢的....