Advertisement
orocknet

OpenDNS MikroTik Scheduler

Aug 12th, 2017
476
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. :local odnsuser "mail@email.com"
  2. :local odnspass "passwd"
  3. :local odnshost "Your networks dashboard LABEL"
  4. :local inetinterface "ether1-gateway"
  5. :global previousIP;
  6. :log info "Fetching current IP"
  7. /tool fetch url="http://myip.dnsomatic.com/" mode=http dst-path=mypublicip.txt
  8. :local currentIP [/file get mypublicip.txt contents]
  9. :log info "Fetched current IP as $currentIP"
  10. :if ($currentIP != 1) do={
  11. :log info "OpenDNS: Update needed"
  12. :set previousIP $currentIP
  13. :local url "https://updates.opendns.com/nic/update?hostname=$odnshost"
  14. :log info "OpenDNS: Sending update for $odnshost"
  15. /tool fetch url=($url) user=$odnsuser password=$odnspass mode=http dst-path=("/net_odns.txt")
  16. :delay 2;
  17. :local odnsReply [/file get net_odns.txt contents];
  18. :log info "OpenDNS update complete."
  19. :log info "OpenDNS reply was $odnsReply";
  20. } else={
  21. :log info "OpenDNS: Previous IP $previousIP and current IP equal, no update need"
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement