OPNsense Forum

English Forums => General Discussion => Topic started by: CoderDes on April 20, 2024, 10:55:38 AM

Title: Problem with cloudflare DDNS
Post by: CoderDes on April 20, 2024, 10:55:38 AM
Hi, I have a problem with opnsense ddns service. The connection between opnsense and cloudflare works but in the wrong way: opnsense check cloudflare A record and takes the IP inside the A record (for example I put 0.0.0.0 inside the record) instead update the record with my public IP.

This is the ddns log:

Account xxxxxxxxxxxxxxxxxxxxxxxxxxxx [cloudflare - Cloudflare_DDNS] set new ip [0.0.0.0]

Why? This is absurd!

Thank you.
Title: Re: Problem with cloudflare DDNS
Post by: h3zwe on April 22, 2024, 12:31:02 AM
This doesn't directly answer your question, but I've been running the below script for years and it has yet to fail me:


#!/usr/bin/env bash

IP="$(curl -s http://ipv4.icanhazip.com)"

curl -s -X PUT "https://api.cloudflare.com/client/v4/zones/$ZONE_ID_GOES_HERE/dns_records/$RECORD_ID_GOES_HERE" -H "Authorization: Bearer $API_KEY_GOES_HERE" -H "Content-Type: application/json" --data '{"type":"A","name":"$DOMAIN_GOES_HERE","content":"'"$IP"'","proxied":false}' 1>/dev/null
Title: Re: Problem with cloudflare DDNS
Post by: CoderDes on April 25, 2024, 11:53:51 AM
Thank you, this works very well!