DNS-O-Matic script with all.dnsomatic.com as hostname returns "nohost" error
Hello,
I'm trying to use the following script on my Mikrotik router (taken from the OpenDNS Support Wiki : https://support.opendns.com/hc/en-us/articles/227987847-Mikrotik-WinBox-Dynamic-Update-Script) to update the IP addresses on my account:
#--------------- Change Values in this section to match your setup ------------------
# User account info of OpenDNS
# Update-only password (obtained from OpenDNS Support). With two-factor authentication enabled, the use of an update only password is required.
:local odnsuser "dnsomatic-username"
:local odnspass "hunter2"
# Set the hostname or label of network to be updated. This is the name of your OpenDNS network on the Dashboard.
# Hostnames with spaces are unsupported. Replace the value in the quotations below with your host name.
# Only one host is supported
# Use "all.dnsomatic.com" for the matichost to update all items in dnsomatic with this IP.
# Note, you must have admin or edit (Read/Write/Grant in the OpenDNS Dashboard) to update IP addresses.
:local odnshost "all.dnsomatic.com"
# Change to the name of interface that gets the changing IP address
# May not be needed for your model number - commenting out this line may still work for single interface devices or if this is not supplied in the DNS-O-Matic script currently being used
:local inetinterface "ether8-gateway"
#------------------------------------------------------------------------------------
# No more changes needed, one optional change
:global previousIP;
:log info "Fetching current IP"
# Get the current public IP using DNS-O-Matic service.
/tool fetch url="http://myip.dnsomatic.com/" mode=http dst-path=mypublicip.txt
# Read the current public IP into the currentIP variable.
:local currentIP [/file get mypublicip.txt contents]
:log info "Fetched current IP as $currentIP"
# --------- Optional check to only run if the IP has changed (one line: :if)
# to enable, set line below to: ":if ($currentIP != $currentIP) do={"
:if ($currentIP != 1) do={
:log info "OpenDNS: Update needed"
:set previousIP $currentIP
# The update URL. Note the "\3F" is hex for question mark (?). Required since ? is a special character in commands.
# Some older editions of the MicroTik/WinBox OS require the following line instead (http) whereas newer versions require https.
# :local url "http://updates.opendns.com/nic/update\3Fhostname=$odnshost"
:local url "https://updates.opendns.com/nic/update\3Fhostname=$odnshost"
:log info "OpenDNS: Sending update for $odnshost"
/tool fetch url=($url) user=$odnsuser password=$odnspass mode=http dst-path=("/flush_odns.txt")
:delay 2;
:local odnsReply [/file get flush_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"
}
However, when I run the script I see the following messages in the router log file:
Sep/12/2020 15:26:49 script,info Fetching current IP
Sep/12/2020 15:26:49 info fetch: file "mypublicip.txt" downloaded
Sep/12/2020 15:26:50 script,info Fetched current IP as 2XX.2XX.XX.2XX
Sep/12/2020 15:26:50 script,info OpenDNS: Update needed
Sep/12/2020 15:26:50 script,info OpenDNS: Sending update for all.dnsomatic.com
Sep/12/2020 15:26:50 info fetch: file "flush_odns.txt" downloaded
Sep/12/2020 15:26:53 script,info OpenDNS update complete.
Sep/12/2020 15:26:53 script,info OpenDNS reply was nohost
Can someone please help me figure out why this is happening?
-
You did not configure to update through DNS-O-Matic, but directly to OpenDNS. If you want to go through DNS-O-Matic, then the update URL is:
https://updates.dnsomatic.com/nic/update?hostname=all.dnsomatic.com
or
https://updates.dnsomatic.com/nic/updateIf you want to update OpenDNS directly, then the update URL is:
https://updates.opendns.com/nic/update?hostname=YOURNETWORKLABEL
-
rotblitz Thank you for the tip. Changing the update URL did indeed solve the "nohost" problem!
Unfortunately, now it appears that there is some issue between DNSOMatic and CloudFlare. I keep getting a "err Invalid request headers (6003)" message when I try to update my CloudFlare DNS entries.
I don't think it's a API key issue as I've regenerated it and have verified on my local machine using the CF API that the API key is valid and I can update the DNS Record correctly.
Any ideas?
Please sign in to leave a comment.
Comments
5 comments