OpenWrt Forum Archive

Topic: Setup DDNS with GratisDNS

The content of this topic has been archived on 17 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

The wiki DDNS Client guide didn't quite work for me with GratisDNS.
This is how I did it:

1: Install the "luci-app-ddns" application (and remember to enable it afterwards in web UI menu "System\Startup")

2: Add an entry in the file "/usr/lib/ddns/services":

"GratisDNS"  https://ssl.gratisdns.dk/ddns.phtml?u=[USERNAME]&p=[PASSWORD]&d=Mydomain&h=[DOMAIN]&i=[IP]

     Replace "Mydomain" with your own domain, e.g. e.g. "openwrt.com"

3: Add an DDNS entry in the file "/etc/config/ddns":

config service 'gratisdns'
  option interface 'wan'
  option use_syslog '1'
  option use_https '1'
  option force_interval '72'
  option force_unit 'hours'
  option check_interval '10'
  option check_unit 'minutes'
  option retry_interval '60'
  option retry_unit 'seconds'
  option enabled '1'
  option service_name 'GratisDNS'
  option domain 'YourHost'
  option username 'YourUserName'
  option password 'YourPassword'
  option ip_source 'network'
  option ip_network 'wan'

     *Peplace "YourUserName", "YourPassword" and "YourHost" e.g. "ftp.openwrt.com"

4: Install the application "Curl" to enable SLL/HTTPS support

5: Install the application "ca-certificates"

6: Insert the following line into the file "/etc/profile":

export SSL_CERT_DIR=/etc/ssl/certs

7: Execute this command with SSH (PuTTY or WinSCP):

source /etc/profile

Done! :-)
(you might need to reboot)

To test the script use this command with SSH:

/usr/lib/ddns/dynamic_dns_updater.sh gratisdns

I get this result:

root@OpenWrt:~# /usr/lib/ddns/dynamic_dns_updater.sh gratisdns
update_url=https://ssl.gratisdns.dk/ddns.phtml?u=[USERNAME]&p=[PASSWORD]&d=wit.dk&h=[DOMAIN]&i=[IP]
force seconds = 259200
check seconds = 600
old process id (if it exists) = ""
time_since_update = 0 hours
Running IP check...
current system ip = xx.xx.83.207
registered domain ip = xx.xx.83.156
update necessary, performing update ...
updating with url="https://ssl.gratisdns.dk/ddns.phtml?u=XX&p=XXt&d=XX&h=XX&i=xx.xx.83.207"
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100     6  100     6    0     0      9      0 --:--:-- --:--:-- --:--:--     9
Update Output:
OK<br>

Good luck :-)

The way I see it there are two issues getting DDNS to work with GratisDNS:

1: GratisDNS have an extra parameter in his DDNS update URL called "domain". But he might be the only one in this world having that, so it might not be worth the trouble to change/update the script.

2: I guess the Curl and certificate problems is out of scope for the DDNS script. It's rather a problem with the wiki guide, but I did make a small comment on the guide.

But I'm very humble about suggesting and improvement because I'm very new to OpenWRT (and Linux), I'm actually very impressed that I got this to work - I really don't know what am doing *LOL*

I just found your documentation when thinking about how to optimize ddns client wiki.
In your above article I don't see any information about ddns-script version.
I suggest not to edit "/usr/lib/ddns/services*" files because they are subject of change (WIKI needs to be updated) use "Custom service" settings instead. So use "option update_url" inside /etc/config/ddns configuration file.

It should be possible to build a provider specific script for GratisDNS.dk that split FQDN so we get the domain and build the needed URL.
Here my questions:
- What ddns-script version are you using
- Does GratisDNS support subdomains
- Does GratisDNS support IPv6 addresses
- would you like to support me in testing this script

Christian

Christian, if you tell me what section of which page should be replaced with what, I'll gladly update it. There seem to be multiple DDNS-related pages so don't want to take any chances.

Hi Christian
I'm happy your're able to help :-)
It's been a while since I opened my OpenWRT  and I'm fully occupied with some construction activities at the moment, so I hope I can get back to you at some time when I get time to dig myself back into the OpenWRT world.
Thanks :-)

The discussion might have continued from here.