lede
lede copied to clipboard
端口转发后无法在路由器本机访问
详细叙述
Router (10.0.0.1) -> Ubuntu (10.0.0.122, 在 54321 监听 HTTP)
Router 上设置端口转发从 wan 到 10.0.0.122:54321 之后,
- 外网设备可以通过
公网IP:54321访问到 Ubuntu 上的 HTTP 服务 - Ubuntu 自己可以通过
公网IP:54321访问到自己上的 HTTP 服务 - 外网设备通过 IPSec VPN 加入内网获得内网 IP 后可以通过
公网IP:54321访问到 Ubuntu 上的 HTTP 服务 -
但是 Router 无法通过
公网IP:54321访问到 Ubuntu 上的 HTTP 服务(Connection refused),只能通过内网地址10.0.0.122:54321访问。
重复 issue
- [x] 没有类似的 issue
具体型号
x86_64, 自编译 OpenWrt R22.11.11
详细日志
root@OpenWrt:~# iptables-save | grep 54321
-A zone_lan_postrouting -s 10.0.0.0/8 -d 10.0.0.122/32 -p tcp -m tcp --dport 54321 -m comment --comment "!fw3: test (reflection)" -j SNAT --to-source 10.0.0.1
-A zone_lan_postrouting -s 10.0.0.0/8 -d 10.0.0.122/32 -p udp -m udp --dport 54321 -m comment --comment "!fw3: test (reflection)" -j SNAT --to-source 10.0.0.1
-A zone_lan_prerouting -s 10.0.0.0/8 -d 192.168.1.3/32 -p tcp -m tcp --dport 54321 -m comment --comment "!fw3: test (reflection)" -j DNAT --to-destination 10.0.0.122:54321
-A zone_lan_prerouting -s 10.0.0.0/8 -d 192.168.1.3/32 -p udp -m udp --dport 54321 -m comment --comment "!fw3: test (reflection)" -j DNAT --to-destination 10.0.0.122:54321
-A zone_lan_prerouting -s 10.0.0.0/8 -d 公网IP/32 -p tcp -m tcp --dport 54321 -m comment --comment "!fw3: test (reflection)" -j DNAT --to-destination 10.0.0.122:54321
-A zone_lan_prerouting -s 10.0.0.0/8 -d 公网IP/32 -p udp -m udp --dport 54321 -m comment --comment "!fw3: test (reflection)" -j DNAT --to-destination 10.0.0.122:54321
-A zone_wan_prerouting -p tcp -m tcp --dport 54321 -m comment --comment "!fw3: test" -j DNAT --to-destination 10.0.0.122:54321
-A zone_wan_prerouting -p udp -m udp --dport 54321 -m comment --comment "!fw3: test" -j DNAT --to-destination 10.0.0.122:54321
访问公网地址的时候做一个源nat,随便转换成一个和内外网不一个网段的地址就可以了
@wushenghn 感谢回复!请问可以提供一个具体的命令示例吗?
@wushenghn 尝试做了一个 -A zone_wan_postrouting -d 公网IP/32 -m comment --comment "!fw3: snat" -j SNAT --to-source 8.8.4.4 ,但还是 connection refused 。
我也是这个问题,路由器自身无法访问转发端口的服务地址,外网和内网其他机器都可以访问,内网部署的opkg源路由器访问不了。
@Co1lin 你的这个问题解决了吗?