iptables PREROUTING和POSTROUTING似乎没有转发任何数据包(OpenWRT)


0

这是我的网络图片

我正在尝试镜像设备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

我在Device A上以混杂模式打开了Wireshark,但是当我在Device B上做事时(比如在我的浏览器中连接到neverssl.com,或者ping google.com,我看不到Device A上的流量。我是什么?做错了?

(注1:如果有任何不同,我也尝试无线连接Device A到OpenWRT路由器,但无济于事。)

(注2:还有其他设备连接到Netgear路由器,但没有其他设备连接到OpenWRT路由器。)


(抱歉,如果这是错误的地方 - 我被引导到这里或Unix / Linux通过网络堆栈交换)
Ian Riley

尝试-t nat而不是mangle看看是否有帮助。
网络时间

刚尝试-t nat而不是-t mangle(重新启动后),并尝试了-t nat和-t mangle(作为连续命令),仍然无法正常工作
Ian Riley

我有cat'd / proc / sys / net / ipv4 / ip_forward,得到1,正如预期的那样
Ian Riley

我正在努力更好地理解预路由和后路由; 我想我可能要切换我的-s和我的-d?因为我希望在它进入路由器之前看起来是.252的数据包,以及在路由之后发往.252的数据包?
Ian Riley
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.