What's new

DDNS issue

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Not sure what it means but here is what I see if a add the command to a terminal session
> User-Agent: curl/7.21.7 (arm-unknown-linux-gnu) libcurl/7.21.7 OpenSSL/1.0.0r zlib/1.2.5
 
Not sure what it means but here is what I see if a add the command to a terminal session
> User-Agent: curl/7.21.7 (arm-unknown-linux-gnu) libcurl/7.21.7 OpenSSL/1.0.0r zlib/1.2.5
The question is: Is it passed on as an http header to the server?
 
When running manually, the URL is: "https://username:password@domains.g...ostname=subdomain.yourdomain.com&myip=1.2.3.4". I have been working under the assumption that the script automatically appended the the "&myip=x.x.x.x" to the end when running.

I'm not familiar with updating the DNS records on the Google side but I did set up my own ddns-start script the other day to update my domain at he.net using a custom curl command.

From my findings, there is definitely nothing appended or done automatically for you within the /jffs/scripts/ddns-start script. You have to write all the commands and error checking, etc.

Like @john9527 mentioned, the WAN IP is automatically passed in as the first argument.

I wouldn't bother with complicating things and creating a function within the shell script and calling it right after.

What I ended up doing was storing my current WAN IP in an nvram variable (wan_last_ip). Each time the ddns-start script runs, it checks my current WAN IP (via the $1 argument passed in automatically) and compares it to the nvram wan_last_ip variable. If different, I issue a curl command to update; otherwise I simply skip and call "/sbin/ddns_custom_updated 1".

I can post my script later if needed...
 
Very little new to report yet, although I've been focusing on other projects lately.
Running the curl command on it's own (without manually adding any addition header information) works and I receive the desired "nochg" response. but I'm still having issues with the script. In the logs on the webui I see "Apr 15 17:38:31 custom script: Running /jffs/scripts/ddns-start (args: x.x.x.x)" (where x.x.x.x is of course my actual ip address). But I'm not sure from looking at the sample script where it would insert that argument.
 
How are you calling the google_dns_update function? If you are taking advantage of the passed WAN IP to ddns-start wouldn't the correct call be

google_dns_update ProvidedUserName ProvidedPassword $1

since the WAN IP is the first arg to ddns-start.

What I provided in the first post is pretty much how the script is typed up on my device (just with my actual username, password, and subdomain in place of the argument calls and the quotation marks placed around the url as you suggested) and placed in the appropriate JFFS folder.

If $1 is the WANIP should the script be

Code:
#!/bin/sh

set -u

# args: username password hostname
google_dns_update() {          
  case $(curl -s https://$2:$3@domains.google.com/nic/update?hostname=$4&myip=$1) in
    good|nochg*) /sbin/ddns_custom_updated 1 ;;                          
    *) /sbin/ddns_custom_updated 0 ;;                                    
  esac                                                                   
}                                                                        

google_dns_update ProvidedUserName ProvidedPassword Example.com
 

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top