Created
January 8, 2017 14:06
-
-
Save sabueso/8ad0b9ad02e3ce8b60ae39305eefba60 to your computer and use it in GitHub Desktop.
Mikrotik bind dynamic zone update
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:global ipaddressfull [/ip address get [find interface="vlan2"] address] | |
:global ipaddress [:pick $ipaddressfull 0 [:find $ipaddressfull "/"]] | |
:global actualhostnameip 0.0.0.0 | |
:do { | |
:put [:global actualhostnameip [:resolve host.toupdate.com]]; | |
} on-error={ :log info "update_bind_test: Error retrieving host ip";} | |
:if ($ipaddress != $actualhostnameip) do={ | |
:log info "update_bind_test: Different data, local ip $ipaddress => remote hostname $actualhostnameip, updating..."; | |
/tool dns-update dns-server=ip_server name="toupdate" address="$ipaddress" key-name="name_of_the_key" key="yourhashkey" zone="toupdate.com" ttl=300; | |
} else={ | |
:log info "update_bind_test: nothing to do, all updated..."; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment