Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :local noipuser value="tuanbasri03";
- :local noippass value="24m412et2003";
- :local noiphost value="permataabadi.ddns.net";
- :local inetinterface value="pppoe-1";
- :local currentIP value="0.0.0.0/0";
- :local url value="http://dynupdate.no-ip.com/nic/update?myip=";
- :if ([/interface get $inetinterface value-name=running] = true) do={
- :set $currentIP value=[/ip address get [find where interface=$inetinterface] address];
- :for i from=([:len $currentIP] - 1) to=0 do={
- :if ([:pick $currentIP $i] = "/") do={
- :set $currentIP value=[:pick $currentIP 0 $i];
- }
- }
- :if ($currentIP != $previousIP) do={
- :log info message=("No-IP: Current IP ".$currentIP." is not equal to previous IP, update needed");
- :set $previousIP value=$currentIP;
- :log info message=("No-IP: Sending update for ".$noiphost);
- /tool fetch url=($url.$currentIP."&hostname=".$noiphost) user=$noipuser password=$noippass mode=http dst-path=("no_ip_ddns_update_".$noiphost.".txt");
- :log info message=("No-IP: Host ".$noiphost." updated on No-IP with IP ".$currentIP);
- } else={
- :log info message=("No-IP: Previous IP ".$previousIP." is equal to current IP, no update needed");
- }
- } else={
- :log info message=("No-IP: ".$inetinterface." is not currently running, so therefore will not update.");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement