Problem with cloudflare DDNS

Started by CoderDes, April 20, 2024, 10:55:38 AM

Previous topic - Next topic
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.

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