Advertisement
Guest User

NO-IP Basri

a guest
Dec 14th, 2016
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.27 KB | None | 0 0
  1. :local noipuser value="tuanbasri03";
  2. :local noippass value="24m412et2003";
  3. :local noiphost value="permataabadi.ddns.net";
  4. :local inetinterface value="pppoe-1";
  5. :local currentIP value="0.0.0.0/0";
  6. :local url value="http://dynupdate.no-ip.com/nic/update?myip=";
  7. :if ([/interface get $inetinterface value-name=running] = true) do={
  8. :set $currentIP value=[/ip address get [find where interface=$inetinterface] address];
  9. :for i from=([:len $currentIP] - 1) to=0 do={
  10. :if ([:pick $currentIP $i] = "/") do={
  11. :set $currentIP value=[:pick $currentIP 0 $i];
  12. }
  13. }
  14. :if ($currentIP != $previousIP) do={
  15. :log info message=("No-IP: Current IP ".$currentIP." is not equal to previous IP, update needed");
  16. :set $previousIP value=$currentIP;
  17. :log info message=("No-IP: Sending update for ".$noiphost);
  18. /tool fetch url=($url.$currentIP."&hostname=".$noiphost) user=$noipuser password=$noippass mode=http dst-path=("no_ip_ddns_update_".$noiphost.".txt");
  19. :log info message=("No-IP: Host ".$noiphost." updated on No-IP with IP ".$currentIP);
  20. } else={
  21. :log info message=("No-IP: Previous IP ".$previousIP." is equal to current IP, no update needed");
  22. }
  23. } else={
  24. :log info message=("No-IP: ".$inetinterface." is not currently running, so therefore will not update.");
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement