Advertisement
karanik

mikrotik_no-ip1

Oct 13th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #Dynamic DNS Update Script for No-IP DNS behind NAT
  2. # Set needed variables
  3. :local username "MY"
  4. :local password "MY"
  5. :local host "MY.ddns.net"
  6. :global previousIP
  7. # behind NAT - using MikroTik IP Cloud feature
  8. #current IP
  9. /ip cloud force-update
  10. :delay 5
  11. :local currentIP [/ip cloud get public-address]
  12. :log info "No-IP DNS: currentIP = $currentIP"
  13. #compare IPs
  14. :if ($currentIP not $previousIP) do={
  15. :log info "No-IP: Current IP $currentIP is not equal to previous IP, update needed"
  16. #current IP overrides previous
  17. :set previousIP $currentIP
  18. :local url "https://dynupdate.no-ip.com/nic/update/?myip=$currentIP&hostname=$host"
  19. :log info "No-IP DNS: Sending update for $host"
  20. #sending infos which are required in the no-ip API via https
  21. /tool fetch url=$url user=$username password=$password mode=https keep-result=no
  22. :log info "No-IP DNS: Host $host updated on No-IP with IP $currentIP"
  23. } else={
  24. :log info "No-IP: update not needed "
  25. }
  26. # end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement