A Cloudflare Worker that provides a Dynamic DNS (DDNS) service compatible with FritzBox routers. This allows your FritzBox to automatically update DNS records in Cloudflare when your IP address changes.
- ✅ FritzBox DDNS protocol compatible
- ✅ Basic Authentication support
- ✅ IPv4 and IPv6 support
- ✅ Automatic DNS record creation and updates
- ✅ Cloudflare API integration
- ✅ Standard DDNS response codes
- A Cloudflare account
- A domain managed by Cloudflare
- Node.js and npm (for deployment)
- Wrangler CLI (Cloudflare Workers CLI)
- A FritzBox router
git clone https://github.com/r-ising/cloudflare-ddns.git
cd cloudflare-ddnsnpm installnpx wrangler login- Go to your Cloudflare dashboard
- Select your domain
- Scroll down on the Overview page to find your Zone ID
- Copy the Zone ID
- Go to Cloudflare API Tokens
- Click "Create Token"
- Use the "Edit zone DNS" template
- Select your zone
- Create the token and copy it
Set up the required secrets using Wrangler:
# Set your DDNS username (you choose this)
npx wrangler secret put DDNS_USERNAME
# Set your DDNS password (you choose this)
npx wrangler secret put DDNS_PASSWORD
# Set your Cloudflare API token
npx wrangler secret put CLOUDFLARE_API_TOKEN
# Set your Cloudflare Zone ID
npx wrangler secret put CLOUDFLARE_ZONE_IDnpx wrangler deployAfter deployment, you'll get a URL like: https://cloudflare-ddns.your-subdomain.workers.dev
-
Log into your FritzBox admin interface (usually http://fritz.box)
-
Go to Internet → Permit Access → DynDNS
-
Enable DynDNS and select Custom
-
Configure the following:
- Update-URL:
https://your-worker.your-subdomain.workers.dev/update?hostname=<domain>&myip=<ipaddr> - Domain Name:
subdomain.yourdomain.com(the full hostname you want to update) - Username: The username you set in
DDNS_USERNAME - Password: The password you set in
DDNS_PASSWORD
- Update-URL:
-
Click Apply
The update endpoint supports the following FritzBox standard parameters:
hostname(required): The full hostname to update (e.g.,home.example.com)myip(optional): The IP address to set. If not provided, uses the client's IP address
Example:
https://your-worker.workers.dev/update?hostname=home.example.com&myip=1.2.3.4
The service returns standard DDNS response codes:
good <ipaddr>- Update successfulbadauth- Authentication failedbadparam- Missing or invalid parameters911- Server error
You can test the service using curl:
curl -u username:password \
"https://your-worker.workers.dev/update?hostname=subdomain.yourdomain.com&myip=1.2.3.4"Expected response: good 1.2.3.4
- Verify your username and password are correctly set using
npx wrangler secret list - Check that FritzBox is sending the correct credentials
- Verify your Cloudflare API token has DNS edit permissions
- Check that the Zone ID matches your domain
- View worker logs with
npx wrangler tail
- Check the Update-URL format is correct
- Ensure
<domain>and<ipaddr>placeholders are used (not replaced) - Verify the hostname exists or can be created in your zone
- Always use HTTPS for the update URL
- Store credentials as Worker secrets, never in code
- Use a strong, unique password for DDNS authentication
- Limit API token permissions to only DNS edit for the specific zone
- Consider IP-based rate limiting for production use
To test locally:
npx wrangler devThis starts a local development server. You can test with:
curl -u testuser:testpass \
"http://localhost:8787/update?hostname=test.example.com&myip=1.2.3.4"MIT License - feel free to use and modify as needed.
Contributions are welcome! Please feel free to submit a Pull Request.