Skip to content

Latest commit

 

History

History
53 lines (41 loc) · 2.59 KB

README.md

File metadata and controls

53 lines (41 loc) · 2.59 KB

cloudflare-dyndns2

cloudflare-dyndns2 is a dyndns2 API compatible server you can use in Cloudflare workers to update A/AAA records with generic dyndns2 clients like ddclient, python-dyndnsc and many others (like your consumer router, potentially).

Setup

You need a Cloudflare account (free plan is fine) with a domain configured and two API tokens created:

  • CF_ZONE_API_TOKEN: With Zone / Zone / Read permissions, scoped to all your zones.
  • CF_DNS_API_TOKEN: With Zone / DNS / Edit permissions, scoped to the domain you want to update.

To set up cloudflare-dyndns2, follow the Cloudflare Workers: Get started guide until you have a logged in wrangler config.

  • Run wrangler whoami to get your Account ID
  • Copy wrangler.toml.tmpl to wrangler.toml
  • Add your Account ID to wrangler.toml
  • Choose a username and it to the BASIC_USER variable in wrangler.toml

Now add the tree required secrets using wrangler:

# A password of your choosing
wrangler secret put BASIC_PASS
# The Cloudflare API tokens you created
wrangler secret put CF_ZONE_API_TOKEN
wrangler secret put CF_DNS_API_TOKEN

After that you can publish the code by calling:

wrangler publish

You now need to create the A/AAAA records you want to update with your desired settings via the Cloudflare UI (or API). cloudflare-dyndns2 will only update existing records and won't create new ones.

Client configuration

There are two routes that currently do the same thing, /nic/update and /v3/update. For details, please see: https://help.dyn.com/remote-access-api/perform-update

Currently, only the parameters hostname and myip are supported (in addition to a json parameter that makes the API return JSON instead of dyndns2 compatible responses). Multiple hostnames, as well as IPv4 and IPv6 are supported (separated by comma). If multiple IPs of the same type are provided, only the first one is used.

Update URLs:

  • https://<worker-fqdn>/v3/update?hostname=<your-fqdn1>,<your-fqdn2>&myip=<ipv4>,<ipv6>
  • https://<worker-fqdn>/nic/update?hostname=<your-fqdn1>,<your-fqdn2>&myip=<ipv4>,<ipv6>

A ddclient config for IPv6 might look something like:

protocol=dyndns2
usev6=if, if=eth0
ssl=yes
server=<worker-fqdn>
login=<BASIC_USER>
password='<BASIC_PASS>'
<your-fqdn>