RouterOS設置Nat Loopback的注意事項

最近有些朋友私信給我,要幫忙處理RouterOS的Nat Loopback.
也因如此我發現過去沒跟用戶提醒注意的事項.

要讓Nat Loopback工作,除新增專屬的Rule外:

/ip firewall nat
add action=masquerade chain=srcnat comment="NAT Loopback" \
dst-address=192.168.22.0/24 src-address=192.168.22.0/24

還要注意…

方法1:

/ip firewall nat
add action=dst-nat chain=dstnat comment="http server" disabled=no \
dst-port=80 in-interface=pppoe-out1 protocol=tcp to-addresses=192.168.22.10 \
to-ports=80

是指定interface進來的連線,映射到指定的Server上.

方法2:

/ip firewall nat
/ip firewall nat add chain=dstnat dst-address=69.69.69.69 protocol=tcp \
dst-port=80 action=dst-nat to-addresses=192.168.22.10 to-ports=80

指定對固定ip連接的連線,映射到指定的Server上.

方法3:

/ip firewall nat
add action=dst-nat chain=dstnat comment="Synology DSM" dst-address-type=local \
dst-port=5000-5006 protocol=tcp to-addresses=192.168.22.10

對local清單上的地址ip所進行的連線,都映射到指定的Server上.

不知道有沒有人看出其中差異,
其中 方法2&3是對指定目的ip連線,進行映射;
而方法1是從指定interface進來的連線,才進行映射.

而這差異就剛好決定設置Nat Loopback的成敗!!

Recent Articles

spot_img

Related Stories

Stay on op - Ge the daily news in your inbox