Warning: Undefined array key "error" in /home/nevyxvrt/ubntwiki.com/lib/plugins/bootnote/syntax.php on line 81

Warning: Undefined array key "error" in /home/nevyxvrt/ubntwiki.com/lib/plugins/bootnote/syntax.php on line 81

Warning: Undefined array key "error" in /home/nevyxvrt/ubntwiki.com/lib/plugins/bootnote/syntax.php on line 81

Warning: Undefined array key "text" in /home/nevyxvrt/ubntwiki.com/lib/plugins/bootnote/syntax.php on line 101

Warning: Undefined array key "error" in /home/nevyxvrt/ubntwiki.com/lib/plugins/bootnote/syntax.php on line 81

Warning: Undefined array key "error" in /home/nevyxvrt/ubntwiki.com/lib/plugins/bootnote/syntax.php on line 81

Warning: Undefined array key "error" in /home/nevyxvrt/ubntwiki.com/lib/plugins/bootnote/syntax.php on line 81

Warning: Undefined array key "error" in /home/nevyxvrt/ubntwiki.com/lib/plugins/bootnote/syntax.php on line 81

Warning: Undefined array key "error" in /home/nevyxvrt/ubntwiki.com/lib/plugins/bootnote/syntax.php on line 81

Warning: Undefined array key "error" in /home/nevyxvrt/ubntwiki.com/lib/plugins/bootnote/syntax.php on line 81

Warning: Undefined array key "text" in /home/nevyxvrt/ubntwiki.com/lib/plugins/bootnote/syntax.php on line 101

Warning: Cannot modify header information - headers already sent by (output started at /home/nevyxvrt/ubntwiki.com/lib/plugins/bootnote/syntax.php:81) in /home/nevyxvrt/ubntwiki.com/inc/Action/Export.php on line 106

Warning: Cannot modify header information - headers already sent by (output started at /home/nevyxvrt/ubntwiki.com/lib/plugins/bootnote/syntax.php:81) in /home/nevyxvrt/ubntwiki.com/inc/Action/Export.php on line 106
notebook:cloudflare_ddns_configuration

Cloudflare DDNS Configuration using config.gateway.json


Recent firmware on the USG (tested on 4.5.3dev, but should work on recent 4.4x also) allows for native configuration of CloudFlare DDNS without a third party service (like the ever popular DNS-O-Matic).

The only catch [for now], is you have to use config.gateway.json (this file is on/needs to be created on the controller in the applicable site) to accomplish this (as of Controller 5.9.4).

If you need further information please see UniFi Advanced USG Configuration for help about where to create the config.gateway.json.


PLEASE NOTE:



Below is an example of the config.gateway.json needed to make this work:

Note: Do not include the < > when adding the data, only add the information between the " " (quotes).

{
	"service": {
		"dns": {
			"dynamic": {
				"interface": {
					"<WAN interface eg eth0>": {
						"service": {
							"cloudflare": {
								"host-name": [
									"<insert A record name here eg. usg.example.com>"
								],
								"login": "<CloudFlare E-Mail>",
								"options": [
									"zone=<DNS Zone eg. example.com>"
								],
								"password": "<CloudFlare Global API Key>",
								"protocol": "cloudflare",
								"server": "www.cloudflare.com"
							}
						}
					}
				}
			}
		}
	}
}

Note: To obtain your Cloudflare Global API Key, visit the https://www.cloudflare.com/ site, log in, and click Get your API key from the Overview Tab.


If the above does not work

The above did not work for me, on 4.4.36.5146617. But the following does

  1. Upgrade ddclient to 3.9.0 (from 3.8.3)
  2. Install the required dependency libdata-validate-ip-perl (Requires adding remotes, so make sure do not do upgrade of any packages)
  3. Make sure the subdomain you want to automatically is set to any value at cloudflare.
  4. Do the same config as above but skip server (as in remove that part of the json)
  5. Now it should work.

If it complaints about

 Invalid Value for keyword 'ip' = ''"

don't worry it has nothing to do with getting the dynamic dns working.