Automatically update DNS records to the current IP address, supporting IPv4 and IPv6, local (private) IP and public IP. Proxy mode supported, with automatic DNS record creation.
⚡ Providers marked with lightning use advanced HMAC-SHA256 signature authentication for enterprise-level security
Choose one of the following methods: binary
version, pip
version, source code
execution, or Docker
.
Docker version is recommended for best compatibility, small size, and optimized performance.
For detailed instructions and advanced usage, see Docker Usage Documentation
Command line CLI
docker run newfuture/ddns -h
Using configuration file (Docker working directory /ddns/
, default config location /ddns/config.json
):
docker run -d -v /host/config/:/ddns/ --network host newfuture/ddns
Using environment variables:
docker run -d \
-e DDNS_DNS=dnspod \
-e DDNS_ID=12345 \
-e DDNS_TOKEN=mytokenkey \
-e DDNS_IPV4=ddns.newfuture.cc \
--network host \
newfuture/ddns
pip install ddns
or easy_install ddns
ddns -h
or python -m ddns
python run.py
or python -m ddns
Apply for API token
, fill in the corresponding id
and token
fields:
DNSPOD (China): Create token | Detailed Configuration |
Alibaba Cloud DNS: Apply for accesskey | Detailed Configuration |
Alibaba Cloud ESA: Apply for accesskey | Detailed Configuration |
DNS.COM: API Key/Secret | Detailed Configuration |
DNSPOD (International): Get token | Detailed Configuration |
CloudFlare: API Key (Besides email + API KEY , you can also use Token , requires list Zone permission) |
Detailed Configuration |
HE.net: DDNS Documentation (Only fill the set password in the token field, id field can be left empty) |
Detailed Configuration |
Huawei Cloud DNS: APIKEY Application (Click Access Keys on the left, then click Create Access Key) | Detailed Configuration |
NameSilo: API Key (Get API Key from API Manager) | Detailed Configuration |
No-IP: Username and Password (Use No-IP account username and password) | Detailed Configuration |
Modify the configuration file, ipv4
and ipv6
fields for domains to be updated, refer to configuration instructions for details
All fields can be configured through three methods, with priority: Command Line Parameters > JSON Configuration File > Environment Variables
ddns --key=value
(use ddns -h
for details), highest priority${ddns_id}
or ${DDNS_ID}
, ${DDNS_LOG_LEVEL}
)📖 Environment Variables Documentation: See Environment Variables Configuration for detailed usage and examples of all environment variables
-c
to specify a configuration file (defaults to config.json in the current directory)ddns -c path/to/config.json
# Or run with Python
python -m ddns -c /path/to/config.json
# Remote configuration file
ddns -c https://ddns.newfuture.cc/tests/config/debug.json
key | type | required | default | description | tips |
---|---|---|---|---|---|
id | string | √ | N/A | API Access ID | Cloudflare uses email (leave empty when using Token) HE.net can be left empty Huawei Cloud uses Access Key ID (AK) |
token | string | √ | N/A | API Auth Token | Some platforms call it secret key, remove when sharing feedback |
dns | string | No | "dnspod" |
DNS Provider | Alibaba DNS: alidns , Alibaba ESA: aliesa , Cloudflare: cloudflare , DNS.COM: dnscom , DNSPOD China: dnspod , DNSPOD International: dnspod_com , HE.net: he , Huawei Cloud: huaweidns , NameSilo: namesilo , Tencent Cloud: tencentcloud , Tencent EdgeOne: edgeone , No-IP: noip , Custom Callback: callback . Some providers have detailed configuration docs
|
ipv4 | array | No | [] |
IPv4 Domain List | When [] , IPv4 address will not be retrieved and updated |
ipv6 | array | No | [] |
IPv6 Domain List | When [] , IPv6 address will not be retrieved and updated |
index4 | string|int|array | No | "default" |
IPv4 Get Method | Can set network interface , private , public , regex etc. |
index6 | string|int|array | No | "default" |
IPv6 Get Method | Can set network interface , private , public , regex etc. |
ttl | number | No | null |
DNS Resolution TTL | Uses DNS default policy when not set |
proxy | string|array | No | N/A | HTTP Proxy Format: http://host:port
|
Multiple proxies tried sequentially until success, DIRECT for direct connection |
ssl | string|boolean | No | "auto" |
SSL Certificate Verification |
true (force verify), false (disable verify), "auto" (auto downgrade) or custom CA certificate file path |
debug | bool | No | false |
Enable Debug | Debug mode, only effective with command line parameter --debug
|
cache | string|bool | No | true |
Cache Records | Keep enabled normally to avoid frequent updates, default location is ddns.cache in temp directory, can also specify a specific path |
log | object | No | null |
Log Config (Optional) | Log configuration object, supports level , file , format , datefmt parameters |
0
, 1
, 2
, 3
, etc.): The i-th network interface IP"default"
(or no this field): System default IP for external access"public"
: Use public IP (query via public API, simplified URL mode)"url:xxx"
: Open URL xxx
(e.g., "url:http://ip.sb"
), extract IP address from returned data"regex:xxx"
Regular expression (e.g., "regex:192.*"
): Extract the first IP address matching from ifconfig
/ipconfig
, note JSON escaping (\
should be written as \\
)
"192.*"
matches all IPs starting with 192 (note: regex:
cannot be omitted)10.00.xxxx
, write as "regex:10\\.00\\..*"
("\\"
JSON escapes to \
)"cmd:xxxx"
: Execute command xxxx
and use stdout output as target IP"shell:xxx"
: Use system shell to run xxx
, and use stdout result as target IPfalse
: Force disable IPv4 or IPv6 DNS resolution updates["public", "regex:172\\..*"]
will first query public API, then look for local IPs starting with 172 if no IP is obtainedid
field: Fill in callback URL starting with HTTP or HTTPS, HTTPS recommended, supports variable replacementtoken
field: POST request parameters (JSON object or JSON string), use GET request if this field is empty or missing. When JSON parameter values contain constants from the table below, they will be automatically replaced with actual contentFor detailed configuration guide, see: Callback Provider Configuration
Constant Name | Constant Content | Description |
---|---|---|
__DOMAIN__ |
DDNS Domain | |
__IP__ |
Obtained corresponding type IP address | |
__RECORDTYPE__ |
DDNS Record Type | |
__TTL__ |
DDNS TTL | |
__TIMESTAMP__ |
Request timestamp | With decimal |
{
"$schema": "https://ddns.newfuture.cc/schema/v4.0.json",
"id": "12345",
"token": "mytokenkey",
"dns": "dnspod or dnspod_com or alidns or aliesa or dnscom or cloudflare or he or huaweidns or namesilo or tencentcloud or noip or callback",
"ipv4": ["ddns.newfuture.cc", "ipv4.ddns.newfuture.cc"],
"ipv6": ["ddns.newfuture.cc", "ipv6.ddns.newfuture.cc"],
"index4": 0,
"index6": "public",
"ttl": 600,
"proxy": ["http://127.0.0.1:1080", "DIRECT"],
"log": {
"level": "DEBUG",
"file": "dns.log",
"datefmt": "%Y-%m-%dT%H:%M:%S"
}
}
If the same configuration item is set in multiple places, the following priority rules apply:
Advanced Usage:
This tool itself does not include loop and scheduled execution functions (to reduce code complexity). You can use system scheduled tasks to run regularly.
task.bat
(or run in administrator command line)task.bat
(a black window will flash during execution)Using init.d and crontab:
sudo ./task.sh
Using systemd:
Install:
sudo ./systemd.sh install
Uninstall:
sudo ./systemd.sh uninstall
Files installed by this script comply with Filesystem Hierarchy Standard (FHS):
Executable files are located in /usr/share/DDNS
Configuration files are located in /etc/DDNS
Docker images, without additional parameters, have a scheduled task enabled by default that runs every 5 minutes
Windows Server default security policy will prohibit any untrusted SSL certificates. You can manually add the corresponding certificates #56
Use the system’s built-in IE browser to visit the corresponding API once:
--debug