Code: Select all
:global newIP 1.1.1.1
:foreach i in=[/ip firewall nat find comment=TEST] do={
/ip firewall nat set $i to-addresses=$newIP
}
Its not possible to use ddns name from ip-cloud, so there is another thing i can do? I am having dyndns account and i tried something like this, but its a raw code, never worked
Code: Select all
:global newIP
:global ddnsServer dyn.com
:global hostname myhostname
:global username myusername
:global password mypassword
:log info "Getting current IP from $ddnsServer"
/tool fetch url="http://members.dyndns.org/nic/update?hostname=$hostname" user=$username password=$password
:set newIP [/tool fetch get value]
:log info "New IP is $newIP"
:foreach i in=[/ip firewall nat find comment=TEST] do={
/ip firewall nat set $i to-addresses=$newIP
}