Cristian Gutierrez/Configure DDNS in OpenWrt Cloudflare

Created Mon, 10 Jan 2022 00:19:14 +0200 Modified Thu, 02 May 2024 15:09:36 +0000
269 Words Reading time 2 min

If you have services in your home as in my case, your company will probably give you a dynamic public IP, so it is a hassle to have to be changing by hand the IP where your domain points every time your company changes the IP, so let’s see how to configure our router with OpenWRT with Cloudflare as DNS in a very simple way.

Cloudflare Token

First of all we will need a cloudflare token, we can get it from here with our account.

Create a new token with this configuration:

Zone, Zone: Read
Zone, DNS: Edit

Configure OpenWRT

Now we need to install the following packages (in my case via shell but it can also be done from Luci):

For OpenWRT 19.07 we need to install For OpenWRT 20.02 or higher the package is ddns-scripts-cloudflare.

For OpenWRT 20.02 or higher the package is ddns-scripts-cloudflare.

opkg update
opkg install ddns-scripts-cloudflare luci-app-ddns
opkg install wget ca-certificates
opkg install curl ca-bundle

Once everything is installed we go to the router IP in the browser Services -> Dynamic DNS.

Edit the IPv4:

  • Select DDNS Service provider
  • In Lookup Hostname we place our subdomain or domain for example in my case, in Domain the same but in this format [email protected]
  • In username Bearer and in password our cloudflare token.

Once this is done, click on Save and Apply.


To see that it is working we can see it in Services -> Dynamic DNS and we see how it takes our IP and if we go to the DNS of cloudflare we see that it has changed it.