Guide: Setup DDNS with DuckDNS

arunix

n3wb
Joined
Jun 21, 2015
Messages
10
Reaction score
3
I've tested this on Dahua NVR but it should work on both any Dahua component. Skip to SOLUTION if you just want to know how to setup DuckDNS.
I am hiding my personal information in this post. DuckDNS token will be deleted after I post and I'm editing the IP Address in the picture. Let me know if I miss something


INTRODUCTION

Dahau comes with 4 DDNS options: Dahua own DDNS, NO-IP, CN99, DynDns.
  • If you don't trust Chinese DDNS then that rules out Dahua and CN99.
  • NO-IP has a free tier, which I've been using, but you need to verify each domain each month.
  • DynDns is a paid service.
PROBLEM
I have multiple Dahua NVRs so I want a free service with multiple DDNS domains that is set and forget. When searching for a free DDNS service I was recommended DuckDNS. DuckDNS even has a DynDns compatible endpoint.
Unfortunately when setting up my NVR according to DuckDNS instructions I could never get the DDNS domain to update.

DuckDNS instructions:
1681177382868.png
Dahua NVR:
1681177608951.png
After looking around on Google, I'm certain this is the correct setup. I was suspicious of the password as DuckDNS token is very long, maybe too long. I manually inputted the token into the password field and tried copy/paste but neither worked.
I tried looking around to get a shorter DuckDNS token but I don't think it's possible. Time to get more technical.

I enable port mirroring on my switch and breakout WireShark.
This is the capture on WireShark. We can see the NVR sending a DDNS update to DuckDNS.
1681178088032.png
Here is what the NVR is sending:
1681178236355.png

Looking at Credentials we get:
nouser:87e07ed6-0208-4d5e-88d1-4ea0514
The correct Credentials according to DuckDNS is
nouser:87e07ed6-0208-4d5e-88d1-4ea05149ad69
So the username is correct but the password as I suspected is wrong because the token is too long.

Lets also check if the URL is correct. The sent URL is
And the expected URL is
The URL is correct! The part after the IP Address can be ignored.

So the problem is the DuckDNS token. It's too long to be inputted into the web interface. I come from a datacenter background so my first instinct when I encounter an issue with the web interface is to use SSH. Unfortunately Dahua SSH is mostly useless.
While looking around this forum I saw someone reply to a problem with a http solution. Apparently you can use HTTP API to program Dahua. I searched around and found the Dahua HTTP API (Included below) and have my solution.

SOLUTION
We will use Dahua HTTP API to set the token password.
  1. First setup DynDns according to your DuckDNS
  2. Next verify your Dahua DDNS settings use the following link:
    • http://IP:PORT/cgi-bin/configManager.cgi?action=getConfig&name=DDNS
    • Look for the table entry for DynDns which is usually [3]
    • 1681179460961.png
    • From this we can also verify our DuckDNS settings are correct.
  3. Now we create the HTTP API
    • http://username:password@IP:PORT/cgi-bin/configManager.cgi?action=setConfig&DDNS[3].UserName=nouser&DDNS[3].Password=TOKEN
      • username: Is your device login username
      • password: Is your device login password
      • IP: PORT: Is your device IP Address and Port Number
      • TOKEN: Is your DuckDNS Token
    • You should get an "OK" after you use the link.
  4. Check DuckDNS
    • WireShark shows the DuckDNS update now has the correct info
    • 1681180444137.png
    • And DuckDNS shows as successful update
    • 1681180491635.png
 

Attachments

Last edited:

rawsy1

n3wb
Joined
Aug 29, 2022
Messages
1
Reaction score
0
Location
leeds
great work. is there a solution to get hikvision to work with duckdns?
 
Top