English
ddns-scripts provides the core shell helpers that refresh public DNS records for OpenWrt systems. It drives the /etc/init.d/ddns service, polls your current IPv4/IPv6 addresses, and invokes provider-specific update endpoints so that hostnames always resolve to the router's latest IP.
- Supports dozens of popular dynamic DNS providers via pluggable update scripts.
- Handles IPv4 and IPv6 addresses, including SLAAC neighbours and custom detection URLs.
- Flexible IP source selection: network interfaces, devices, external web checks, or custom scripts.
- Extensive logging with per-service log files and optional syslog integration.
- Sample configuration snippets under samples/to accelerate onboarding.
- OpenWrt 21.02 or newer (earlier releases may work but are untested).
- busybox,- wgetor- curl, and appropriate SSL libraries for HTTPS-based providers.
- Optional helpers: bind-host,drill, orknot-hostwhen custom DNS lookups are required.
opkg update
opkg install ddns-scripts
# Install extra providers as needed
opkg install ddns-scripts_cloudflare-v4 ddns-scripts_godaddyIf you are developing locally, copy the files in files/ to the OpenWrt root and restart the service:
/etc/init.d/ddns restart- Create or edit /etc/config/ddnsusing the examples insamples/ddns.config_sample.
- Define one or more servicesections with at least:- service_name(or- update_url/update_scriptfor custom providers)
- lookup_host
- use_ipv6(0 or 1)
 
- Adjust advanced options such as ip_source,interface,bind_network, and retry intervals.
- Reload the service: /etc/init.d/ddns reload
Tip: Enable detailed logs with
option use_logfile '1'and inspect/var/log/ddns/<section>.log.
- Core helper logic lives in files/usr/lib/ddns/, including the generic updater and provider adapters.
- Utility scripts such as dynamic_dns_functions.shcan be sourced in custom provider implementations.
- Run ./files/usr/bin/ddns.sh --helpon the router to inspect available CLI parameters.
- Fork the repository and create a feature branch.
- Add or update provider scripts under files/usr/lib/ddns/.
- Update files/etc/config/ddnsdefaults when new options are introduced.
- Provide relevant translations and documentation.
- Submit a pull request with testing notes (provider, IPv4/IPv6 path, etc.).
The scripts follow the licensing model used by OpenWrt packages (typically GPL-2.0). Refer to the file headers for exact terms.
- Enhanced IPv6 neighbour handling: helper utilities expose richer metadata consumed by the companion LuCI app (see ../luci-app-ddns).
- Documentation now highlights IPv6-specific configuration paths and verification workflows.
- Base logic otherwise tracks ImmortalWrt; any bug fixes are contributed upstream when possible.
中文
ddns-scripts 是 OpenWrt 平台上用于刷新动态 DNS 记录的核心脚本集合。它作为 /etc/init.d/ddns 服务的后台程序,自动检测当前 IPv4/IPv6 地址,并调用各个运营商的更新接口,确保域名始终解析到路由器最新的公网地址。
- 通过可插拔脚本支持数十家常见的动态 DNS 服务商。
- 同时处理 IPv4、IPv6 地址,支持 SLAAC 邻居及自定义检测 URL。
- 多种 IP 源选择:网络接口、设备、外部网页检测或自定义脚本。
- 详细的日志机制:每个服务独立 log 文件,并可选同步到 syslog。
- samples/目录提供示例配置,方便快速上手。
- 建议使用 OpenWrt 21.02 或更新版本(旧版本未全面验证)。
- 需具备 busybox,以及wget或curl(部分 HTTPS 服务需额外安装 SSL 库)。
- 如果需要自定义 DNS 查询,建议安装 bind-host、drill或knot-host等工具。
opkg update
opkg install ddns-scripts
# 根据需要额外安装具体服务脚本
opkg install ddns-scripts_cloudflare-v4 ddns-scripts_godaddy开发调试时,可将 files/ 下的文件同步到路由器根目录,然后重启服务:
/etc/init.d/ddns restart- 参考 samples/ddns.config_sample创建或编辑/etc/config/ddns。
- 针对每个服务定义所需字段:
- service_name(或自定义- update_url/- update_script)
- lookup_host
- use_ipv6(0 或 1)
 
- 视需求调整高级选项,如 ip_source、interface、bind_network、重试间隔等。
- 执行 /etc/init.d/ddns reload使配置生效。
小提示:开启
option use_logfile '1'可在/var/log/ddns/<section>.log查看详细日志。
- 核心实现位于 files/usr/lib/ddns/,包含通用更新逻辑与各服务适配器。
- dynamic_dns_functions.sh等工具脚本可在自定义服务脚本中复用。
- 在路由器上执行 ./files/usr/bin/ddns.sh --help可查看命令行参数说明。
- Fork 仓库并创建功能分支。
- 在 files/usr/lib/ddns/中新增或更新服务脚本。
- 若引入新配置项,请同步更新 files/etc/config/ddns默认设置。
- 记得完善相关文档与翻译。
- 提交 Pull Request 时附上测试说明(服务商、IPv4/IPv6 测试路径等)。
脚本遵循 OpenWrt 软件包通用的授权方式(通常为 GPL-2.0)。具体条款请参考各文件头部声明。
- 强化 IPv6 邻居处理:工具脚本输出更丰富的信息,供配套的 LuCI 前端(见 ../luci-app-ddns)使用。
- 文档重点说明 IPv6 的配置路径与校验流程,方便部署者快速上手。
- 其余核心逻辑与 ImmortalWrt 主线保持一致,若有修复会尽量回馈上游。