Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- :local odnsuser "mail@email.com"
- :local odnspass "passwd"
- :local odnshost "Your networks dashboard LABEL"
- :local inetinterface "ether1-gateway"
- :global previousIP;
- :log info "Fetching current IP"
- /tool fetch url="http://myip.dnsomatic.com/" mode=http dst-path=mypublicip.txt
- :local currentIP [/file get mypublicip.txt contents]
- :log info "Fetched current IP as $currentIP"
- :if ($currentIP != 1) do={
- :log info "OpenDNS: Update needed"
- :set previousIP $currentIP
- :local url "https://updates.opendns.com/nic/update?hostname=$odnshost"
- :log info "OpenDNS: Sending update for $odnshost"
- /tool fetch url=($url) user=$odnsuser password=$odnspass mode=http dst-path=("/net_odns.txt")
- :delay 2;
- :local odnsReply [/file get net_odns.txt contents];
- :log info "OpenDNS update complete."
- :log info "OpenDNS reply was $odnsReply";
- } else={
- :log info "OpenDNS: Previous IP $previousIP and current IP equal, no update need"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement