将外部IP地址路由到内部IP否DNS

时间:2018-03-21 17:45:04

标签: redirect ip router dd-wrt

我有一个地址69.39.239.211(外部)我想路由/重定向到192.168.0.22(内部)进行一些调试测试。我有一个dd-wrt路由器,所以我可以根据需要更改iptables,我只是不确定语法。我所看到的一切都试图通过DNS来做到这一点,但由于它是一个地址,所以dns从不参与。

到目前为止

iptables -t nat -A PREROUTING -i br0 -d 69.39.239.211 -j DNAT --to 192.168.0.1

将正确跟踪路由但nmap不会看到任何开放端口。

1 个答案:

答案 0 :(得分:0)

Here's the answer for anyone seeking to do that same thing. What was missing was the second line. I also added the local subnet.

iptables -t nat -A PREROUTING -i br0 -s 192.168.0.0/24 -d 69.39.239.211 -j DNAT --to 192.168.0.1
iptables -t nat -A POSTROUTING -o br0 -j MASQUERADE