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!

skywayskase

Occasional Visitor
I keep getting a "ddns: Custom ddns update failed" error when using the script provided for Google Domains in the wiki. I made sure to set the correct permissions as outline in the User Scripts section of the wiki
(chmod a+rx /jffs/scripts/*). I'm not really sure of what I'm doing, any help or insight would be appreciated. I just can't figure out what I'm missing.
Code:
#!/bin/sh

set -u

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

google_dns_update ProvidedUserName ProvidedPassword Example.com
 
Have you set your username, password and subdomian for your sevice ?

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

google_dns_update <username> <password> <subdomain>
 
Yep, although I took them out of the brackets.
Have you done "chmod a+rx /jffs/scripts/ddns-start" from ssh or telnet and put your script in "ddns-start" ?
Don't forget to make sure you use CR only and not CR/LF, best thing is save script from winscp.
 
Have you done "chmod a+rx /jffs/scripts/ddns-start" from ssh or telnet and put your script in "ddns-start" ?
Don't forget to make sure you use CR only and not CR/LF, best thing is save script from winscp.

I did the chmod, but if I'm being honest I'm not sure what you mean by "CR only and not CR/LF". I wrote the script with nano through ssh directly on the device.
 
I did the chmod, but if I'm being honest I'm not sure what you mean by "CR only and not CR/LF". I wrote the script with nano through ssh directly on the device.
Okey that it should be okey. Carriage Return – CR – \r Line Feed – LF – \n
 
That script won't work as is. The username and passwords are not passed as arguments to the ddns-start script, only the WAN IP is.
 
Then how should I edit it?

Replace $1 and $2 by the actual username and password.

EDIT: Actually nevermind. When I expanded the code block, I saw you were manually calling the function with the appropriate parameters.

Just to be safe, test by hardcoding them in the URL in place of $1 and $2.
 
Replace $1 and $2 by the actual username and password.

EDIT: Actually nevermind. When I expanded the code block, I saw you were manually calling the function with the appropriate parameters.

Just to be safe, test by hardcoding them in the URL in place of $1 and $2.
I tried that as well but it still didn't seem to work.
 
Did you by chance change your router logon from the default of 'admin'? If so, try and reset it to 'admin' and give it a try then.
Another idea is to telnet/ssh to the router and enter each of the commands individually so you can see the response, if any (of course substituting your actual username, password and subdomain for $1,$2,$3 in the curl command).
 
I also played with this same code for many hours and never got it to work. I am not skilled at scripts so I don't have anything to offer. When you get it working I would be interested in the solution.
 
Does your password contain any non alpha-numeric characters? If so, they need to be escaped.

You should start by manually running the curl command over SSH, you will be able to see the exact error message that comes up.
 
Okay, so after taking a break for a couple days: changing my username back to admin did not fix it (so I changed it back to my own username), my password only contains alpha numeric characters, and running the curl command manually from ssh with the IP address appended to the end actually works. So maybe it had something to do with how the script sends the WAN address as an 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.
 
Just an idea: Google clearly states on their website, that you must set a user agent in your request. Does curl have any default user agent that it sends? Based on my research: I don't think so...

So I think the right command would be something like (if the code in the OP would otherwise work):
Code:
curl -s -A "Asuswrt-Merlin" https://$1:$2@domains.google.com/nic/update?hostname=$3
 
Last edited:

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