2013-11-23 18 views
1

我使用的MikroTik 750GL,我有这样一个问题:的MikroTik NAT重定向到地方,从地方

subnet 10.0.0.0/16

路由器有local ip 10.0.0.1external ip (e.g. 1.1.1.1)

我一些端口转发到我的地方主机(e.g. firewal nat dst-nat 1.1.1.1:444 -> 10.0.0.2:80)

当我从互联网去1.1.1.1:444时,我可以访问我的网络服务器在10.0.0.2,但是当我从局域网去1.1.1.1:444时,我可以访问我的网络服务器,但是 (例如。 10.0.0.3),我坚持在加载页面。

我明白,10.0.0.2只能通过交换机的路由回答10.0.0.3和我绑通过使用新的SRC-NAT规则一样10.0.0.0/16 -> 2.2.2.2修复它,但没有任何进展顺利

如果我做了错误?

回答

4

你的问题没有给出情况的全貌, 从控制台出口将是有用的。

src-nat and dst-nat的简单使用必须得到connection-mark的支持,那么您可以使用某种网络服务将流量从本地IPS伪装成特定本地IP。

在示例:

[[email protected]] > ip address export 
/ip address 
add address=1.1.1.1/24 disabled=no interface=ether1-gateway network=1.1.1.0 
add address=10.0.0.1/24 disabled=no interface=ether2-master-local network=10.0.0.0 

[[email protected]] > ip firewall mangle export 
/ip firewall mangle 
add action=mark-connection chain=prerouting disabled=no dst-address=1.1.1.1 dst-port=444 new-connection-mark=int_to_444 passthrough=no protocol=tcp src-address=10.0.0.0/24 

[[email protected]] > ip firewall nat export 
/ip firewall nat 
add action=dst-nat chain=dstnat disabled=no dst-address=1.1.1.1 dst-port=444 protocol=tcp to-addresses=10.0.0.2 to-ports=80 
add action=masquerade chain=srcnat disabled=no out-interface=ether1-gateway 
add action=masquerade chain=srcnat connection-mark=int_to_444 disabled=no 

你可以看到,裂伤规则,标志着其从本地子网给1.1.1.1:444和最后一个NAT规则的是伪装这个connection-mark连接(int_to_444)。 Explanation of similar cheating without mikrotik

问候,我希望它会有用。

+0

非常感谢!这就是我正在寻找的答案。但是您的解决方案需要在每次添加NAT规则时再添加一个Mangle规则。我制定了从所有本地IP地址到所有本地IP地址的伪装规则。它会增加路由器的CPU负载,但没有理由为本地路由添加更多特定的规则 – red

相关问题