Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #Dynamic DNS Update Script for No-IP DNS behind NAT
- # Set needed variables
- :local username "MY"
- :local password "MY"
- :local host "MY.ddns.net"
- :global previousIP
- # behind NAT - using MikroTik IP Cloud feature
- #current IP
- /ip cloud force-update
- :delay 5
- :local currentIP [/ip cloud get public-address]
- :log info "No-IP DNS: currentIP = $currentIP"
- #compare IPs
- :if ($currentIP not $previousIP) do={
- :log info "No-IP: Current IP $currentIP is not equal to previous IP, update needed"
- #current IP overrides previous
- :set previousIP $currentIP
- :local url "https://dynupdate.no-ip.com/nic/update/?myip=$currentIP&hostname=$host"
- :log info "No-IP DNS: Sending update for $host"
- #sending infos which are required in the no-ip API via https
- /tool fetch url=$url user=$username password=$password mode=https keep-result=no
- :log info "No-IP DNS: Host $host updated on No-IP with IP $currentIP"
- } else={
- :log info "No-IP: update not needed "
- }
- # end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement