!!! README !!! Documentation/Usage - Refer to Blog Post
Make sure you have following dependencies installed.
curl
jq
ip
Suppose you have already ssh into your EdgeOS based router, in my case, Ubiquiti ER-X(v1.10.11).
cd /config/scripts/ && pwd
# /config/scripts/
curl -LS -o /config/scripts/cloudflare-ddns-edgeos.tar.gz https://github.com/n1cogrv/cloudflare-ddns-edgeos/raw/releases/cloudflare-ddns-edgeos.tar.gz
cd /config/scripts/ && pwd
# /config/scripts/
curl -LS -o /config/scripts/cloudflare-ddns-edgeos.tar.gz https://cdn.jsdelivr.net/gh/n1cogrv/cloudflare-ddns-edgeos@releases/cloudflare-ddns-edgeos.tar.gz
tar -xvf /config/scripts/cloudflare-ddns-edgeos.tar.gz
!!! This step is IMPORTANT !!!
Alter variables in /config/scripts/cloudflare-ddns-edgeos/cfddns.sh
Meanings & where-can-be-found of global parameters is provided in cfddns.sh
via code comments.
Variable in cfddns.sh
- CF_ACCESS_TOKEN
Visit Cloudflare Api-tokens, Click Create Token
.
Use Edit zone DNS template.
Fill in the form.
Continue to Summary, and Create Token.
Copy following token string into CF_ACCESS_TOKEN
, starting with Bearer
.
Variable in cfddns.sh
- ZONE_IDENTIFIER
.
Variable in cfddns.sh
- RECORD_NAME
Full domain name(With subdomain)
eg. subdomain.mijazz.icu, example.subdomain.yourdomain.com
+x
to files using chmod +x /config/scripts/cloudflare-ddns-edgeos/cfddns.sh
Before you set it as a scheduled task, dryrun/execute it first.
/config/scripts/cloudflare-ddns-edgeos/cfddns.sh
If it creates and updates your domain record both successfully and correctly, proceed to next step.
Otherwise, feel free to open a issue
configure
set system task-scheduler task cloudflareddns executable path /config/scripts/cloudflare-ddns-edgeos/cfddns.sh
set system task-scheduler task cloudflareddns interval 20m
commit
save
exit
Inspired by rehiy/dnspod-shell, I wrote this project. At the beginning, this is just a random script I wrote and configured it on my router with crontab
, all because of my sudden switch of dns provider.
There're plenty of ddns(ddns-client
) projects on Github.
-
Some of them are written in
shell-script
and don't require extra language or framework support. (I don't want my poor router host a docker container everytime just for ddns update...) -
Some of them are specifically optimized, ( or let's say ) , are only written for cloudflare ddns update, but in other language except
shell-script
.
Thus, cloudflare-ddns-edgeos aims at
-
For routers running EdgeOS (Ubiquiti EdgeRouter), light-weighted design.
-
Written in
shell-script
, avoid complex language and framework dependencies. -
Specifically for Cloudflare DNS update, via Cloudflare v4 api.
And...EdgeOS didn't have official support for ddns on cloudflare, at least not an option in their web-ui. You need to configure it under cli, and it communicates with cloudflare through v1 api (currently v4 is actively supported & maintained by cloudflare)...
- Documentation Support on mijazz.icu.
- Continuous-Delivery via
Github Action
is configured, build and push artifact toreleases
branch.
-
Automatically create dns record (No need to create record manually in advance).
-
Documentation & comments update (following shell style guideline).
-
Fix script import error. (MUST use absolute path to import
cloudflare-ddns
) -
Update usage documentation.
- Initial release, test passed on er-x.
Copyright © 2022 MijazzChan mijazz@qq.com
This work is free. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.