Dynamic DNS Update Script for EveryDNS: Difference between revisions

From MikroTik Wiki
Jump to navigation Jump to search
No edit summary
(No difference)

Revision as of 10:07, 5 January 2009

This script allow you to easily maintain dynamic updates at EveryDNS free DNS server.
First you have to setup an account at http://www.everydns.com/, and with few steps create dynamic domain. After that you have to setup EasyDNS servers NS DNS parameters at domain seller site.

Next script is build with target to update DNS with two or more PPPoE connection with dynamics IP addresses.

# Define user variables
:local eduser "USERNAME"
:local edpass "PASS"
:local eddomain "DYNAMIC.DOMAIN" 
:local edinterface "INTERFACE_NAME"

# Change this global variable if you want more than 1 script
:global edlastip1
:local str
:local edip
:local ip

:if ([ :typeof $edlastip1 ] = nil ) do={ :global edlastip1 "0" }

:local ip [ /ip address get [/ip address find interface=$edinterface ] address ]
:local edip [ :pick $ip 0 ([:len $ip]-3)]
:if ([ :typeof $edip ] = nil ) do={
   :log info ("EveryDNS: No ip address on " . $edinterface . ".")
} else={

  :if ($edip != $edlastip1) do={

    :log info ("EveryDNS: " . $eddomain . " -> " . $edip)
    :local str ("/index.php?ver=0.1&ip=" . $edip . "&domain=" . $eddomain)
    /tool fetch address=66.240.223.182 src-path=$str user=$eduser password=$edpass dst-path=("/EveryDNS.".$eddomain)
    :delay 1 
    :local str [/file find name=("EveryDNS.".$eddomain)]
    /file remove $str
    :global edlastip1 $edip

  } 

}
# Coded by Paxy

You should setup this script, so using username and password as you registered at http://www.everydns.com/. Dynamic domain should be name of sub-domain that you want to be updated automaticly ex. r.paxy.in.rs . Interface name field should be exact name of interface that you want to monitor for IP change, in my case it is PPPoE type interfaces.

If you want to monitor more then one interface, create another script, fill username and pass, change sub-domain to another sub-domain name, and change interface that monitor IP address. Because of spoofing protection, you have to change variable "edlastip1" to any other name, like "edlastip2" in whole script.
Script use server with DNS name dyn.everydns.net, which is currently resolved to 66.240.223.182, if EveryDNS change dyndns parameters, just resolve right server DNS and update script.

All what is left now is to make scheduler to run this or those scripts every minute.

/system scheduler add name=EveryDNS1 interval=00:01 on-event="/system script run everyDns1\r\n/system script run everyDns2"


Happy hacking ...