Hello,
i need a script that copy address from the dynamic pptp-out1 from ip address to ip firewall nat and set to address
/ip firewall nat set [ find comment="PPTP UPDATE" ] to-address=$local-address
:global status [/interface get pptp-out1 running]
:if ($status) do={
:global old [/ip firewall nat get [find where comment="Loopback"] to-addresses]
:global new [/ip address get [find where dynamic=yes and interface="pptp-out1"] address]
:set new [:pick $new 0 [:find $new "/"] ]
:if ($new != $old) do={
/ip firewall nat set [find where comment="Loopback"] to-addresses=$new
}
}
Noted with thanksssssssssssssssssssssBetter on this way:Code: Select all:global status [/interface get pptp-out1 running] :if ($status) do={ :global old [/ip firewall nat get [find where comment="Loopback"] to-addresses] :global new [/ip address get [find where dynamic=yes and interface="pptp-out1"] address] :set new [:pick $new 0 [:find $new "/"] ] :if ($new != $old) do={ /ip firewall nat set [find where comment="Loopback"] to-addresses=$new } }