Setting up Cloudflare Dynamic DNS on Your EdgeRouter-X
Created 2020-04-01 (But it's not an April Fool's joke!)
There's not a lot of great information out there on getting this set up, and what there is seems to be incorrect. Below is what I have found to be the simplest setup one can do.
First things first, in your Cloudflare control panel, make an A record for the domain you want to change. I would suggest giving it a bogus IP address, so you can see if your configuration is working. Something like 22.214.171.124 is great.
Next, go to your Profile in Cloudflare, then switch to the API Tokens tab. On the API Keys area, click the View button by your Global API Key. Copy this key, and hold on to it for later.
NOTE: This key could give a person full control over your Cloudflare account, even if you have MFA set up! Protect it like your password.
Now that we have the Cloudflare set up out of the way, log into your EdgeRouter- X and go to the Config Tree. If the CLI is more your speed, you can do that, but I'm not going to explain how.
Question: Why go to the Config Tree instead of the Services > DNS Tab?
Answer: As of versions 2.0.8 and 1.10.11, that tab does not have all necessary options.
Drill down through the Configuration Tree to Service > DNS > Dynamic > interface
and click on the
+ Add button. Type in the name of your WAN port. If you're
not sure, it's probably
eth0, but you can check on the Routing tab. Also, if
you're not sure, this is something you should really figure out, because your
firewall might not be configured properly. Okay, that's getting a bit off-topic.
Now that you've typed in the name of your WAN interface, click on
and you'll see that a new option has been added to your Config tree. Click on eth0, and type in the web field:
www.cloudflare.com. Now click on Service in the
Config tree, and click on
+ Add. Type in
custom-Cloudflare, and click on
We're in the home stretch now. Click on the new option in the Config tree,
custom-Cloudflare that we just created. Click on the
+ Add button next to
host-name, and type in the fully-qualified domain name that you want to manage.
In the login field, type in your Cloudflare email address. In options, type
zone=example.com, replacing example.com with the domain you're managing.
NOTE: Say you're setting up a host at
plex.robertdherb.com. For host-name,
you would use
plex.robertdherb.com. For options, you'll use
zone=robertdherb.com. And don't get cute, my Plex server isn't actually exposed.
Now, do you remember the API key I told you to hang onto for later? Put that
into the password field here. In the protocol field, enter
I suspect you can put anything in here. It might be more accurate to put JSON,
but I'm really not sure. Anyway, putting in
cloudflare will definitely work,
but have fun and experiment if you want to!
The final setting, and incidentally, the one that most guides get wrong, is
the server field. Put
api.cloudflare.com/client/v4 in there, then
Preview. Double check your settings, and click
Once your EdgeRouter updates, you will be sent back to the root of the Config
Tree, and will see at the bottom of the page
The configuration has been applied
If you look back at the DNS settings for Cloudflare, they should have updated
almost instantly, but in case they didn't, in your EdgeRouter control panel,
go to the Services tab, then DNS, and click
Force Update at the bottom.
And there you have it. That's really it! I have no idea why there is so much misinformation out there, but hopefully this helps at least one person. If you have any trouble, just let me know!