Cloudflare Dynamic DNS updates with Multi-WAN support.
- Multi-WAN Support: Detect and manage multiple public IPv4 addresses across different network interfaces.
- Automatic IPv4 address detection.
- Cloudflare API integration.
systemd
service integration.
IPv6 support is currently unsupported.
- Domain managed by Cloudflare.
- API token for Cloudflare account with permissions to modify DNS records.
- Cloudflare DNS Zone Id.
- DNS A record to update.
- Clone this repository; or
- Download the scripts and make them executable:
chmod +x cf-ddns-install.sh cf-ddns-uninstall.sh cf-ddns-sync.py
To manually update DNS records:
API_TOKEN=YOUR_CLOUDFLARE_API_TOKEN
ZONE_ID=YOUR_CLOUDFLARE_ZONE_ID
TARGET_HOSTNAME=myhost.example.com
./cf-ddns-sync.py --apiToken API_TOKEN --zoneId $ZONE_ID --target $TARGET_HOSTNAME --verbose
This retrieves the primary public IPv4 address of your system and updates the DNS record accordingly.
You can optionally specify multiple network interfaces using the --source
argument:
./cf-ddns-sync.py --apiToken $API_TOKEN --zoneId $ZONE_ID --target $TARGET_HOSTNAME --verbose --source eth0 --source eth1
This will query the public IPv4 address for each specified interface.
For each unique IPv4 address obtained, the script will create a DNS A record for that hostname, essentialy establishing a round-robin DNS record.
Interfaces without connectivity to the public internet will be disregarded.
If only one public IPv4 address is acquired, the hostname will default to a single DNS A record (without round-robin).
To install a systemd
service which will keep the DNS records updated, use:
./cf-ddns-install.sh <additional-arguments>
passing the same arguments needed for cf-ddns-sync.py
script.
The service will run cf-ddns-sync.py
script every 60 seconds, utilizing a local cache to minimize the number of calls needed to the Cloudflare API.
Multiple instances of the services could be created, one for each --target
.
To remove the service
./cf-ddns-uninstall.sh --target $TARGET_HOSTNAME
This work is the result of a research project examining the current state of AI in code generation.
This codebase was completely generated by GitHub Copilot (powered by Claude 3.5 Sonnet) based on human-written specifications contained in the .spec.md
files.
The only files I authored are the .md
documents, including this README.md
. I have not modified any bash or python script files in any way.
You can review the commit history of this project to track its evolution and the features that have been added.
While the implementation was AI-generated, the design, requirements, and testing were performed under human supervision to ensure quality and security.