How to running a test of a DDNS Update Script?

So after looking at two articles on how to do so (link1) and (link 2) , I believe I've gotten my Dynamic DNS to update (manually) with wget.

However; the OpenWRT DDNS program is still acting a little squirrelly.

Here's how I did this manually:

  1. Started by registering a google domains domain name (see link1)
  2. After reading a bit in link 2 came up with my own script and configuration for updating the IP of my google domains domain DNS name, see below:
 #!/bin/sh
 
 result=$(wget -4 -O-  https://$username:$password@domains.google.com/n
 echo "$result" | grep -i -e "good|nochg"
 logger ddns "DDNS Result: $result"
 return 0
  1. Then, configuring /etc/config/ddns (similar to link 2) I have been able to get this thing to update the google domains dns, but ONLY MANUALLY.
 config ddns 'global'
         option ddns_dateformat '%F %R'
         option ddns_loglines '250'
         option upd_privateip '0'
 
 config service 'googledomains_ddns_ipv4'
         option lookup_host 'host.medomain.com'
         option update_script '/etc/ddns/ddns_update.sh'
         option domain 'medomain.com'
         option username 'meusrname'
         opiton password 'mepasswd'
         option enabled '1'

But I'm still getting pretty strange log files back that seem to indicate that it didn't work (and they repeat alot):

Tue Jun  2 18:34:36 2020 user.err ddns-scripts[23255]: googledomains_ddns_ipv4: No update send to DDNS Provider
Tue Jun  2 18:44:36 2020 user.warn ddns-scripts[23255]: googledomains_ddns_ipv4: Updating IP at DDNS provider failed - starting retry 114/0
Tue Jun  2 18:44:36 2020 user.err ddns-scripts[23255]: googledomains_ddns_ipv4: No or private or invalid IP 192.168.0.118 given! Please check your configuration
Tue Jun  2 18:44:36 2020 user.err ddns-scripts[23255]: googledomains_ddns_ipv4: No update send to DDNS Provider
Tue Jun  2 18:54:37 2020 user.warn ddns-scripts[23255]: googledomains_ddns_ipv4: Updating IP at DDNS provider failed - starting retry 115/0
Tue Jun  2 18:54:37 2020 user.err ddns-scripts[23255]: googledomains_ddns_ipv4: No or private or invalid IP 192.168.0.118 given! Please check your configuration
Tue Jun  2 18:54:37 2020 user.err ddns-scripts[23255]: googledomains_ddns_ipv4: No update send to DDNS Provider

It looks to me like the log messages aren't even coming from my script...maybe I installed something in luci, I did follow the DDNS page as well and installed dns_scripts thinking initially that it would be the way to go.

When I try this manually it works like this, but the results coming back are still confusing...

wget -4 -O- https://$username:$password@domains.google.com/nic/update?hostname=$lookup_host&myip=$(dig short myip.opendns.com @resolver1.opendns.com)

The string nohost appears in the prompt after that (maybe it should be good, instead?), but it also seems to have updated the address; I believe I did it wrong and should have included a +short instead of just short above, but any time after that, that I call it again using the correct syntax I get back a HTTP request sent, awaiting response... 401 Unauthorized even though it updates, and the prompt shows nochg xxx.xxx.xxx.xxx where xxx.xxx.xxx.xxx is my current IP address (i.e. it's already been updated).

So I have to wait until it needs updated to try it again. Is there some way to stop the repeating messages in the logs and maybe fix my script so that it works correctly? Also, documentation into the google domains "webservice" I am calling would be useful, if anybody has any, so I can better understand what values are returned.

Not sure why you're making your own script... but I think the problem is that you have a private IP detected.

On my configuration, the directive in the global section to prevent the use of a local IP is:

	option allow_local_ip '0'

And in the service stanza, you can specify the IP check URL (for the external IP check)... in my case, I use this:
option ip_url 'http://ip.changeip.com'

I'd recommend that you create a fresh ddns config entry and see what happens when you use the built-in scripts, rather than creating your own.

3 Likes

Where do the built-in scripts reside?

Also, I'm using a "poor man's bridge" with my ISP router using the OpenWrt router as a DMZ host; if that makes any difference.

I'm not sure off hand. But it's all handled by the ddns package. There is also a luci-app to give you a GUI for configuration and status.

the main ones are ddns-scripts, luci-app-ddns, and any other specific ones that you might need for your service provider.

# opkg list | grep ddns
ddns-scripts - 2.7.8-13 - Dynamic DNS Client scripts (with IPv6 support) - Info: https://openwrt.org/docs/guide-user/services/ddns/client
ddns-scripts_cloudflare.com-v4 - 2.7.8-13 - Dynamic DNS Client scripts extension for CloudFlare.com API-v4 (require/install cURL)
ddns-scripts_freedns_42_pl - 2.7.8-13 - Dynamic DNS Client scripts extension for freedns.42.pl
ddns-scripts_godaddy.com-v1 - 2.7.8-13 - Dynamic DNS Client scripts extension for GoDaddy.com (require/install cURL)
ddns-scripts_no-ip_com - 2.7.8-13 - Dynamic DNS Client scripts extension for No-IP.com
ddns-scripts_nsupdate - 2.7.8-13 - Dynamic DNS Client scripts extension for direct updates using Bind nsupdate
ddns-scripts_route53-v1 - 2.7.8-13 - Dynamic DNS Client scripts extension for Amazon AWS Route53. Note: You must also install ca-certificate or ca-bundle. It requires: "option username" to be a valid AWS access key id "option password" to be the matching AWS secret key id "option domain" to contain the hosted zone ID
kea-dhcp-ddns - 1.6.2-1 - The DHCP Dynamic DNS process. This process acts as an intermediary between the DHCP servers and DNS servers. It receives name update requests from the DHCP servers and sends DNS Update messages to the DNS servers.
luci-app-ddns - 2.4.9-7 - LuCI Support for Dynamic DNS Client (ddns-scripts)

If it is properly configured, it should not present a problem. My OpenWrt router (which is used only as a VPN endpoint) is behind my main router.

Yes, the Poor Man's bridge does appear to work correctly, as long as the IP address is updated in the DDNS.

I'm using my own script because the opkg one didn't work...

I believe before I found those two articles, I read the DDNS Services Guide and clicked domains.google.com from the providers sidebar in the wiki.

When I followed those instructions, they didn't work...so that's why I wrote my own script.

That particular guide was updated 4 years ago. The current version of the ddns scripts appears to have Google support.

From the /etc/ddns/services file:

"google.com"		"https://[USERNAME]:[PASSWORD]@domains.google.com/nic/update?hostname=[DOMAIN]&myip=[IP]"	"good|nochg"

btw, you may also need to install wget so that https works properly.

Since the documentation is out of date; how do I use it?

if you use the LuCI configuration, it's pretty self explanatory, at least IMO. Have you tried it yet?