RouterOS 重新拨号后,从接口获得新ip并更新规则

备忘,
范例

1
2
3
4
5
6
7
:global ipaddr [/ip address get [/ip address find interface=pppoe4plex] address]
:set ipaddr [:pick $ipaddr 0 ([len $ipaddr]3)]
:global oldip [/ip firewall nat get [/ip firewall nat find comment=“plexdstnat”] dst-address]
:if ($ipaddr != $oldip) do={
:log info [/ip firewall nat set [/ip firewall nat find comment=“plexdstnat”] dst-address=$ipaddr]
:log info [/ip firewall nat set [/ip firewall nat find comment=“plexsrcnat”] to-addresses=$ipaddr]
}

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注