Native Cloudflare Dynamic DNS provider (WAN-aware) — UI mockup and implementation notes included

Summary
Add Cloudflare as a built-in provider under Network > WAN > Dynamic DNS. Cloudflare DNS is free and very widely used, but its API needs a Bearer token, so it can’t be set up with the existing Custom URL option. Today we run external updaters that can’t see Peplink WAN state. Many of us also pay for No-IP or DynDNS purely to CNAME our Cloudflare domain to it.

UI (mockup attached)
This fits into the existing Dynamic DNS form. Only four new fields are needed:

  • Service provider: add “Cloudflare (API token)” to the existing dropdown
  • API token (new): password field plus a Verify button
  • Zone (new): dropdown filled automatically once the token is verified
  • Hostname(s): existing field
  • Record type: A / AAAA checkboxes
  • Proxied (new): on/off
  • TTL: 60s default, or Auto
  • Update mode (new): This WAN only / Follow active WAN (failover) / All healthy WANs
    The status table and Event Log reuse what already exists.

Why “Follow active WAN” matters
Only the router knows WAN health. Updating one hostname to the highest-priority healthy WAN on failover and failback gives inbound failover that no external DDNS client can provide.

Implementation: four HTTPS calls, Bearer auth, JSON
Base URL: https://api.cloudflare.com/client/v4
Header: Authorization: Bearer

  1. Verify token (on Save / Verify button):
    GET /user/tokens/verify
  2. Resolve zone ID (cache it):
    GET /zones?name=example.com → result[0].id
  3. Find the record (cache its ID):
    GET /zones/<zone_id>/dns_records?type=A&name=home.example.com
    4a. Update if it exists:
    PATCH /zones/<zone_id>/dns_records/<record_id>
    {“content”:“203.0.113.24”,“ttl”:60,“proxied”:false}
    4b. Create if not:
    POST /zones/<zone_id>/dns_records
    {“type”:“A”,“name”:“home.example.com”,“content”:“203.0.113.24”,“ttl”:60,“proxied”:false}
    Every response has “success”: true/false plus an “errors” array to show in the status table and log.

Reference logic (shell, for illustration):

API=https://api.cloudflare.com/client/v4
H=“Authorization: Bearer $TOKEN”
ZID=$(curl -s -H “$H” “$API/zones?name=$ZONE” | jq -r ‘.result[0].id’)
REC=$(curl -s -H “$H” “$API/zones/$ZID/dns_records?type=A&name=$HOST”)
RID=$(echo “$REC” | jq -r ‘.result[0].id // empty’)
CUR=$(echo “$REC” | jq -r ‘.result[0].content // empty’)
[ “$CUR” = “$WAN_IP” ] && exit 0
BODY=“{“type”:“A”,“name”:“$HOST”,“content”:“$WAN_IP”,“ttl”:60,“proxied”:false}”
if [ -n “$RID” ]; then
curl -s -X PATCH -H “$H” -H ‘Content-Type: application/json’ -d “$BODY” “$API/zones/$ZID/dns_records/$RID”
else
curl -s -X POST -H “$H” -H ‘Content-Type: application/json’ -d “$BODY” “$API/zones/$ZID/dns_records”
fi

Triggers: reuse the existing hooks

  • WAN IP change (as today’s providers do)
  • WAN health-check up/down events (for the two failover modes)
  • Periodic reconcile, e.g. every 30 minutes, which skips the write if the IP hasn’t changed
    Only ever touch records the router manages.

API documentation

Minimum alternative
If a native provider isn’t feasible, extend Custom Dynamic DNS to allow a chosen HTTP method (PATCH/POST), custom headers (Authorization: Bearer), and a JSON body with an IP placeholder. That alone would unlock Cloudflare and most other API-based DNS providers.

Thanks,
Matt Jones

1 Like

While I agree it would be nice to have cloudflare’s built in, do you know that Incontrol2 has one built in? You can enable it on the device level in IC@ (its called “find my peplink”, and it will give you a hostname back that you could cname other things to:

2 Likes

Thanks Bryn, good shout.

Find My Peplink is great, and a CNAME from Cloudflare to the mypep.link hostname is exactly what I’d recommend to anyone who needs something today. Zero config and it just works.

I’d see the two as complementary rather than either/or. IC2 is perfect for reaching the device. A native Cloudflare provider would make it much easier to stitch the local Peplink into a wider cloud setup:

  • One source of truth: the records live in the same zone as everything else (cloud servers, FusionHub, websites), managed with the same tokens and tooling, rather than a chain of record → mypep.link → IC2.
  • Hybrid failover: the router could repoint a hostname not just between WANs, but to a cloud standby (e.g. a FusionHub Elastic IP or an AWS instance) when all local WANs are down, then back again when they recover. That’s something only the router can do, because only it knows WAN health in real time.
  • Proxied mode: records can sit behind Cloudflare’s DDoS and WAF protection with the origin IP hidden, which a CNAME to a public hostname doesn’t fully give you.
  • Fewer moving parts for people who already pay for a DDNS service just to bridge into Cloudflare.

So: Find My Peplink for device access, native Cloudflare for local-plus-cloud integration. Having both would make Peplink an even better fit for hybrid deployments.

2 Likes