namesilo_ddns_cli
is a command line tool for Namesilo DDNS, which is written in Bash depending on wget/curl only.
It is designed mainly to reduce dependences and system load as much as possible. Therefore, light-weight Linux distributions are especially appropriate to use it, like Raspberry, Openwrt, Merlin, Unraid, DSM, QTS...
- Rewrite based on Bash builtin commands, and remove all other dependences except for
wget
orcurl
. - No API request needed for normal running by using cache in log, and possible for IP-checking with high frequency.
- Create running log with automatic compression and length control.
- Enable command-line support.
- Multi-Domains Support
- IPv4 & IPv6 Support
- Load Balancing for IP-Check
- Minimal API requests by Cache
- Logging with Length Control
- Necessary:
wget
orcurl
- Optional:
date
,sleep
DSM 6.2.3
Ubuntu 20.04.1 LTS (WSL2)
EdgeRouter X v2.0.8-hotfix.1 (EdgeOS based on Debian 9)
Usage: namesilo_ddns.sh <command> ... [parameters ...]
Commands:
--help Show this help message
--version Show version info
--key, -k <apikey> Specify API key of Namesilo
--host, -h <host> Add a host to filter current records
--ipv4 <ipaddr> Only update A records
with specified IP (default: auto)
--ipv6 <ipaddr> Only update AAAA records
with specified IP (default: auto)
--force-fetch Forcely fetch records ignoring cache
--force-update Forcely update IP even if not change
Example:
namesilo_ddns.sh -k c40031261ee449037a4b44b1 \
-h yourdomain1.tld \
-h subdomain1.yourdomain1.tld \
-h subdomain2.yourdomain2.tld
Exit codes:
0 All hosts have been updated successful.
1 Occur error during preparing parameters.
2 Occur error during fetching & updating records.
Tips:
Recommand to force fetching records or delete cache in log,
if one of your DNS records have been modified in other ways.
You can also edit the configs and settings in the head of script.
-
SSH to your device , and place
namesilo_ddns.sh
into somewhere, like/opt/ddns/
. (Note: For EdgeOS, the script should be placed in/config/scripts/
) -
Make sure your permissions of destination and script:
chmod u+w /opt/ddns
chmod u+x /opt/ddns/namesilo_ddns.sh
- Edit crontab config:
crontab -e
- Insert and save this line (updating the two hosts every 5 minutes):
*/5 * * * * /opt/ddns/namesilo_ddns.sh -k c40031261ee449037a4b44b1 -h subdomain1.yourdomain1.tld -h subdomain2.yourdomain2.tld
-
Place
namesilo_ddns.sh
into somewhere in your NAS, e.g./homes/<yourname>/ddns/
. -
Start
Control Panel
, clickAdvanced Mode
, openTask Scheduler
. -
Access
Create
-->Scheduled Task
-->User-defined script
. -
Toggle to
Schedule
tab, set running every 5 minutes daily. -
Toggle to
Task Settings
tab, inRun command
input edited command below, e.g.
/var/services/homes/<yourname>/ddns/namesilo_ddns.sh -k c40031261ee449037a4b44b1 -h subdomain1.yourdomain1.tld -h subdomain2.yourdomain2.tld
- If you check out
Send run details by email
and... only when ... terminates abnormally
, you will receive mail when occur error.
-
DDNS multiple hosts
-
DDNS IPv6 hosts
-
reduce API requests greatly
-
check updating log
- Edit the API key and hosts in this script, and save as
ddns-start
.
#! /bin/bash
./namesilo_ddns.sh -k c40031261ee449037a4b44b1 \
-h subdomain1.yourdomain1.tld \
-h subdomain2.yourdomain2.tld \
--ipv4 "$1"
--ipv6 auto
if [ $? -eq 0 ]; then
/sbin/ddns_custom_updated 1
else
/sbin/ddns_custom_updated 0
fi
-
SSH to your router and place
ddns-start
andnamesilo_ddns.sh
under/jffs/scripts/
. -
Make sure your permissions of destination and script:
chmod u+w /jffs/scripts
chmod u+x /jffs/scripts/namesilo_ddns.sh
chmod u+x /jffs/scripts/ddns-start
- Log into the router web UI:
- Go to
Advanced Settings
>WAN
>DDNS
- Set
Server
toCustom
- Click the
Apply
button
- Go to