DDNS with Cloudflare API – closingtags </>

DDNS with Cloudflare API

Cloudflare is fantastic but they aren’t a common option for setting up DDNS on your average home router like other services are. Fortunately, it’s super simple to get around this minor inconvenience with the help of their thoroughly documented API. If you’re interested in hosting a website on your own network, are using Cloudflare’s DNS service, and have the problem of your IP changing frequently, then look no further; I’ve done the legwork already.

I took the liberty of borrowing some code I found from Rohan Jain. His post is great and explains how to get your script running as a systemd service. I was lazy and just set the script below to run every 5 minutes in cron job because it’s simple.

To get your DIY DDNS solution up and running follow these steps:

  1. save the bash script from below to a machine on your network
  2. get the appropriate credentials for the script (Cloudflare Email, Auth token, Zone ID, DNS ID, and domain name)
  3. put credentials in the script
  4. create a cron job that runs the script at your desired interval

By Dylan Hildenbrand

Full stack web developer experienced with #PHP, #SvelteKit, #JS, #NodeJS, #Linux, and #Ansible. I love a good challenge.

profile for Dylan Hildenbrand on Stack Exchange, a network of free, community-driven Q&A sites  

Do you like these posts? Consider sponsoring me or making a donation!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.