The following script works great:
:global currentIPD;
:local pppoePtr [/ip address find interface=“pppoe-out1”];
:local newIPD [/ip address get $pppoePtr address];
:local natPtr [/ip firewall nat find comment=“pppoe-out2”];
:if ($newIPD != $currentIPD) do={
:log info “ip address $currentIPD changed to $newIPD”;
:set currentIPD $newIPD;
}
/ip firewall nat set $natPtr action=src-nat chain=srcnat
src-address=192.168.88.254/24 to-addresses=1.2.3.4
If I try to change the last command to
:global currentIPD;
:local pppoePtr [/ip address find interface=“pppoe-out1”];
:local newIPD [/ip address get $pppoePtr address];
:local natPtr [/ip firewall nat find comment=“pppoe-out2”];
:if ($newIPD != $currentIPD) do={
:log info “ip address $currentIPD changed to $newIPD”;
:set currentIPD $newIPD;
}
/ip firewall nat set $natPtr action=src-nat chain=srcnat
src-address=192.168.88.254/24 to-addresses=$currentIPD
The script “fail”
How can I set to-addresses parameter by a variable?
thanks