This is an old revision of the document!

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).

User Tips:

  • On a Cloud Key install: The path for the .json file is: /srv/unifi/data/sites/[site name/default]/
  • On an Ubuntu install: The path for the .json file is: /usr/lib/unifi/data/sites/[site name/default]/

to edit the file, navigate to the directory and use vi editor, e.g.

cd /srv/unifi/data/sites/default/
vi config.gateway.json


  • Prior to creating the .json file on your gateway, create the file in a text editor, such as Atom or Notepad++, and then validate your file at a JSON validator site such as
  • If the syntax fails verification, and you provision it on your gateway, it could cause reboot issues.
  • If your unsure, reach out to the Ubiquiti Discord Chat or the UBNT Community Forums prior to saving/provisioning for support.

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

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


  • Do not include the < > when adding the data, only add the information between the " " (quotes).
  • To obtain your Cloudflare Global API Key, visit the site, log in, and click Get your API key from the Overview Tab.
  • notebook/cloudflare_ddns_configuration.1526437274.txt.gz
  • Last modified: 2018/05/16 02:21
  • by fester