http://sg.ros.tw/wp/?p=1100&variant=zh-hans

 

如果你的电脑在路由器底下想要透过公网IP或是网址访问同一个区网底下伺服器的话,

这时因为NAT loopback问题会导致你无法访问你的区网内的伺服器.

底下是官网的教学,官方称它叫作 Hairpin NAT

 

设定方式如下..

 

1.假设你的网段是192.168.88.xxx

2.假设你的WEB伺服器是192.168.88.8

底下这张图第0行是基本的port mapping,就不另外多解释.

/ip firewall nat
add chain=dstnat in-interface=pppoe-out1 protocol=tcp dst-port=80 \
  action=dst-nat to-address=192.168.88.8 to-port=80
add chain=srcnat out-interface=pppoe-out1 action=masquerade

 


 

防火墙第1行开始做起(底下5900改成你自己需要的PORT,例如80)

/ip firewall nat
add chain=dstnat dst-address-type=local protocol=tcp dst-port=80 \
  action=dst-nat to-address=192.168.88.8 to-port=80


 

 

第三行的设定(底下5900改成你自己需要的PORT,例如80)

/ip firewall nat add chain=srcnat src-address=192.168.88.0/24 \ dst-address=192.168.88.8 protocol=tcp dst-port=80 \ out-interface=bridge-local action=masquerade

大功告成

 

 

文章標籤
全站熱搜
創作者介紹
創作者 Archer61 的頭像
Archer61

Archer61 單純筆記

Archer61 發表在 痞客邦 留言(0) 人氣(782)