Here is my do-nsupdate script: server is the nameserver to which updates will be sent. The update lines specify the changes to be made to one or more DNS records.The show line is optional, and causes nsupdate to display the records after updating.At first glance, one would think this is impossible.It is NOT impossible, thanks to some scripting and a couple of free services.
In fact, I would be surprised if spam fighters are not already using nsupdate to update their anti-spam and anti-virus DNS blackhole lists.
So, we need a method to update our DNS entry…a SCRIPT!
Mikrotik Dynamic DNS Update Script # DNSo Matic automatic DNS updates # User account info of DNSo Matic :global maticuser "user" :global maticpass "password" :global matichost "Yourhost" # No more changes need :global previous IP # Print values for debug :log info "DNSo Matic: Updating dynamic IP on DNS for host $matichost" :log info "DNSo Matic: User $maticuser y Pass $maticpass" :log info "DNSo Matic: Last IP $previous IP" # get the current IP address from the internet (in case of double-nat) /tool fetch mode=http address="checkip.dyndns.org" src-path="/" dst-path="/dyndns.checkip.html" :local result [/file get dyndns.contents] # parse the current IP result :local result Len [:len $result] :local start Loc [:find $result ": " -1] :set start Loc ($start Loc 2) :local end Loc [:find $result "" -1] :global current IP [:pick $result $start Loc $end Loc] :log info "DNSo Matic: IP actual $current IP" # Touching the string passed to fetch command on "src-path" option :local str "/nic/update?
While googling around for a better solution, a friend on IRC pointing me to a utility that has been around since BIND 8: nsupdate.
nsupdate is a fantastic little utility that enable quick and secure DNS zone updates.