I'm trying to configure Dynamic DNS client on my router with dd-wrt (v24-sp2) firmware so it would dynamically change IP address in one of the DNS records. Unfortunately I encountered a problem… Here is an example request from their ddclient configuration:


It works if I use it in browser, but in dd-wrt I get this output:

Tue Jan 24 00:36:47 2012: INADYN: Started 'INADYN Advanced version 1.96-ADV' - dynamic DNS updater. 
Tue Jan 24 00:36:47 2012: I:INADYN: IP address for alias '<my_record>' needs update to '<my_ip>' 
Tue Jan 24 00:36:48 2012: W:INADYN: Error validating DYNDNS svr answer. Check usr,pass,hostname! (HTTP/1.1 303 See Other 
Server: cloudflare-nginx 
Date: Mon, 23 Jan 2012 14:36:48 GMT 
Content-Type: text/plain 
Connection: close 
Expires: Sun, 25 Jan 1981 05:00:00 GMT 
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 
Pragma: no-cache 
Location: https://www.cloudflare.com/api.html?a=DIUP&u=<my_login>&tkn=<my_token>&ip=<my_ip>&hosts=<my_record> 
Vary: Accept-Encoding 
Set-Cookie: __cfduid=<id>; expires=Mon, 23-Dec-2019 23:50:00 GMT; path=/; domain=.cloudflare.com 
Set-Cookie: __cfduid=<id>; expires=Mon, 23-Dec-2019 23:50:00 GMT; path=/; domain=.www.cloudflare.com 

You must include an `a' paramiter, with a value of DIUP|wl|chl|nul|ban|comm_news|devmode|sec_lvl|ipv46|ob|cache_lvl|fpurge_ts|async|pre_purge|minify|stats|direct|zone_check|zone_ips|zone_errors|zone_agg|zone_search|zone_time|zone_grab|app|rec_se

URL from "Location" works perfectly and parameter "a" is included. What's the problem?

  • I'm unclear what you're trying to achieve here, can you be more clear please.
    – Chopper3
    Jan 23, 2012 at 15:11
  • I'm trying change A record in CloudFlare using service in router that manages changing IP addresses and updates domain information dynamically.
    – Roman
    Jan 23, 2012 at 15:22
  • I have the same problem but I found something that may help to point us in the right direction. Entering the same URL string in wget exhibits the same problem but firefox does not.
    – user108628
    Jan 28, 2012 at 14:04
  • Did you ever figure this out?
    – bjtitus
    Jun 18, 2012 at 15:21
  • Not yet, unfortunately. I wrote a simple python script and using it to update IP manually.
    – Roman
    Jun 19, 2012 at 6:14

4 Answers 4


I don't think you can set it up where DD-WRT calls CloudFlare directly. The way I have it configured is to have DD-WRT call a PHP script on a remote web server, which then detects the client IP and sends the update request to CloudFlare via their API.

DD-WRT DDNS settings

DDNS Service: Custom
DYNDNS Server: <yourserver.com>
Username: <anything>
Password: <anything>
Host Name: <your domain name to update on cloudflare>
URL: /cloudflare_update.php?key=<your secret key>&hostname=


if(empty($_GET['key']) || ($_GET['key'] != "<your secret key>")) die;
$hostname = $_GET['hostname'];
$username = "<yourcloudflareusername@email.com>";
$api = "<your cloudflare api key>";
$curl = "https://www.cloudflare.com/api_json.html?a=DIUP&hosts=$hostname&u=$username&tkn=$api&ip=$ip";
$ch = curl_init($curl);

Instead of using HTTP basic auth I just use a random key.

Make sure you create the DNS entry for the domain name you want to update on CloudFlare; the DIUP action parameter will only update the IP for an entry that already exists.

  • 2
    Thanks for you suggestion. I had to fix your code a little bit because it couldn't detect my IP address correctly. I used code from this answer to another question. Here's the result - https://gist.github.com/3149751.
    – Roman
    Jul 20, 2012 at 9:09

If you want to execute the update from your router then there is no getting around the fact that you need a little extra 'something' in the middle to convert your call into the CloudFlare format (if only DNS-O-Matic would add them to their supported services...). Rather than have to host an intermediate script yourself you can just use Google AppEngine (which is free) to do this re-posting for you. I use this:


Okay, you still have to call something other than CloudFlare to issue the update but at least you don't need to run an extra host or VPS etc. to do it yourself. It's completely transparent - only problem is that you don't get an errors returned so you need to check it's working yourself. Once it is working it should just run and run.

  • I got the error: Error validating DYNDNS svr answer. Check usr,pass,hostname! (HTTP/1.0 302 Found
    – ayr-ton
    Dec 2, 2014 at 19:55

Noticing this is all outdated and now requires v4 api code to work.

tested above an it fails - bad user,pass,xxxx info.

reviewing this method https://github.com/ScottHelme/CloudFlareDDNS


Managed to get this working using this: https://github.com/dcerisano/Cloudflare-dynamic-dns

Once you have your Cloudflare account setup the info required is easy to locate:

You need: Zone ID

Authorization key (aka Global api key)

A-record ID for your domain (this is obtained by running the cloudflare-dns-id.sh script) I had to trim the script a little to make it work..

curl -X GET "https://api.cloudflare.com/client/v4/zones/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/dns_records?type=A&name=dynamic" \ -H "X-Auth-Email: you@youremail.com" \ -H "X-Auth-Key: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \ -H "Content-Type: application/json"

I stored both scripts in /jffs making them executable.

In terms of the Cloudflare side of things, I setup as per this guide for just the Cloudflare domain records:


At Cloudflare you must set the following records:

  • Type: A | Name: dynamic | Value: “your WAN IP” ***

  • Type: CNAME | Name: “yourdomain.xyz” | Value: dynamic.”yourdomain.xyz”

  • Type: CNAME | Name: www | Value: “yourdomain.xyz”

I setup a cron job to run cloudflare-ddns.sh every 5 minutes to check for IP changes.

My DD-WRT router now auto updates Cloudflare whenever the WAN IP is changed...

The above takes about 10 minutes to setup.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.