新建端口映射ip--firewall--nat
腳本動態跟新端口映射,system--script
新建一個計劃,system--schedule
爲了方便(我把所有的命名都命名爲5000)
一、
1.建立端口映射,ip--firewall--nat,dst Address是我撥號獲取的動態ip,comment標記爲5000(隨意命名)
2.To Address是內網的ip
二、
1.創建腳本動態更新端口映射,命名爲5000,interval是時間
2.其中ken-test是我建立的動態撥號的名字,5000是端口映射的comment
:global ipaddr [/ip address get [/ip address find interface=ken-test] address]
:set ipaddr [:pick $ipaddr 0 ([len $ipaddr] -3)]
:global oldip [/ip firewall nat get [/ip firewall nat find comment="5000"] dst-address]
:if ($ipaddr != $oldip) do={
:log info [/ip firewall nat set [/ip firewall nat find comment="5000"] dst-address=$ipaddr]
}
三、
新建一個計劃命名爲5000,紅色箭頭處的5000爲script的名字
四、此時配置已完成,可以測試撥號動態ip的更換,對應的nat映射是否有更改