添加映射策略:
ip firewall nat add chain=dstnat dst-address=5.2.2.2 protocol=tcp dst-port=3389 action=dst-nat to-
addresses=192.168.2.110 to-ports=3389 comment="3389"
一些相關的信息可根據自己的實際情況更改,比如需要映射的地址和端口等等。
下面是腳本的添加
設置 10 秒鐘運行一次,UN 是撥號名字。3389 是剛才添加映射策略時候的備註。
:global newipaddress
:global lodipaddress
:set newipaddress [/ip address get [/ip address find dynamic=yes interface="UN"] address]
:set newipaddress [:pick $newipaddress 0 ([:len $newipaddress] -3)]
:set lodipaddress [/ip firewall nat get [/ip firewall nat find comment="3389"] dst-address]
:if ($newipaddress != $lodipaddress) do={/ip firewall nat set [/ip firewall nat find comment="3389"]
dst-address=$newipaddress}
最後再結合第三方 DDNS 即可