Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Set needed variables
- :global username "yourname"
- :global password "yourpasswd"
- :global hostname "yourhostname"
- :global wanInt "waninterface"
- :global noipForce
- :global previousIP2
- # print some debug info
- #:log info ("DDNS: username = $username")
- #:log info ("DDNS: password = $password")
- :log info ("DDNS: hostname = $hostname")
- :log info ("DDNS: previousIP = $previousIP2")
- # Grab the current IP address on that interface.
- :global ddnsip [/ip address get [/ip address find interface="$wanInt"] address]
- :global currentIP [:pick $ddnsip 0 [:find $ddnsip "/"]]
- #:log info ("DDNS: ddnsip = $ddnsip")
- :log info ("DDNS: currentIP = $currentIP")
- # Remove the # on next line to force an update every single time - useful for debugging, but you could end up getting blacklisted by No-IP!
- #:set noipForce true
- # Determine if no-ip update is needed
- # more no-ip updater request details available at http://www.no-ip.com/integrate/request/
- :if (($currentIP != $previousIP2) || ($noipForce = true)) do={
- :set noipForce false
- :set previousIP2 $currentIP
- :log info ("DDNS: No-IP update needed")
- :log info ("DDNS: Start of Fetch")
- global tmp [/tool fetch mode=http port=80 address=dynupdate.no-ip.com host=dynupdate.no-ip.com src-path="/nic/update?hostname=$hostname&myip=$currentIP" user=$username password=$password dst-path="/noip2.txt"]
- :log info ("DDNS: End of Fetch")
- :global result [/file get noip2.txt contents]
- :log info ("DDNS: No-IP Update Result: $result")
- :put ("No-IP Update Result: $result")
- # Update HE.net Tunnel
- # :execute script=HE-NET
- } else={
- :log info ("DDNS: No No-IP update needed")
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement