![iptables PREROUTING 和 POSTROUTING 似乎没有转发任何数据包(OpenWRT)](https://linux22.com/image/1550048/iptables%20PREROUTING%20%E5%92%8C%20POSTROUTING%20%E4%BC%BC%E4%B9%8E%E6%B2%A1%E6%9C%89%E8%BD%AC%E5%8F%91%E4%BB%BB%E4%BD%95%E6%95%B0%E6%8D%AE%E5%8C%85%EF%BC%88OpenWRT%EF%BC%89.png)
我正在尝试镜像设备 B 发送或接收的所有数据包并将其发送到设备 A 进行记录。我有一个 OpenWRT 作为无线接入点,并且我已通过 ssh 向 OpenWRT 路由器发出以下命令:
iptables -A PREROUTING -t mangle -d 192.168.1.252 -j TEE --gateway 192.168.1.251
iptables -A POSTROUTING -t mangle -s 192.168.1.252 -j TEE --gateway 192.168.1.251
当我运行 iptables --list -t mangle 时,我得到以下信息:
root@OpenWrt:~# iptables --list -t mangle
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
fwmark all -- anywhere anywhere
TEE all -- anywhere 192.168.1.252 TEE gw:192.168.1.251
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
mssfix all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
TEE all -- 192.168.1.252 anywhere TEE gw:192.168.1.251
Chain fwmark (1 references)
target prot opt source destination
Chain mssfix (1 references)
target prot opt source destination
TCPMSS tcp -- anywhere anywhere tcp flags:SYN,RST/SYN /* wan (mtu_fix) */ TCPMSS clamp to PMTU
我已经在混杂模式下在设备 A 上打开了 Wireshark,但是当我在设备 B 上执行操作时(例如在浏览器中连接到 neverssl.com,或者 ping google.com,我看不到设备 A 上的流量。我做错了什么?
(注 1:如果有任何区别,我也尝试过将设备 A 无线连接到 OpenWRT 路由器,但无济于事。)
(注 2:有其他设备连接到 Netgear 路由器,但没有其他设备连接到 OpenWRT 路由器。)