FIXME This page is not fully translated, yet. Please help completing the translation.
(remove this paragraph once the translation is finished)

DDNS 客户端配置

另请参阅: DDNS 客户端文档

  • 由于功能扩展,并非所有设置在所有 OpenWrt 版本中都受支持。
  • 如果某项设置并非在所有版本中都可用,说明中会注明支持的版本。
  • 请注意, ddns-scripts 设计为每个配置段仅支持一个主机或 IP 协议版本。
  • 从 BB 14.07 起, ddns-scripts 仅支持 IPv4 地址的更新。
  • 从 ddns-scripts 2.7.6 (trunk) 开始,选项命名将进行调整,以便更好地进行功能分组。
  • 更新 ddns-scripts 到新版本时,现有配置文件中的选项名称将自动重命名。
  • 此外,一些选项也将 在全局配置中可用 ,因此无需在每个服务段中重复定义。
  • 在服务段中定义的选项将覆盖全局段设置。

ddns-scripts 包配置文件位于 /etc/config/ddns

你可以在 GitHub 上找到最新版本的完整文档 ddns.sample_config
使用默认设置时,最小配置如下:

config service "myddns_ipv4"
	option service_name	"example.org"
	option domain		"yourhost.example.org"
	option username		"your_username"
	option password		"your_password"
	option interface	"wan"
	option ip_source	"network"
	option ip_network	"wan"

:!: 从 CC 15.05 起支持

config service "myddns_ipv6"
	option use_ipv6		"1"
	option service_name	"example.org"
	option domain		"yourhost.example.org"
	option username		"your_username"
	option password		"your_password"
	option interface	"wan6"
	option ip_source	"network"
	option ip_network	"wan6"

:!: 每个 DDNS 提供商和主机都需要定义一个 “service”
:!: 如果你希望向 DDNS 提供商更新 IPv4IPv6 地址,也需要分别定义
(从 CC 15.05起)

Name
(old)
Name
(new)
Type Required Default Description
enabled boolean yes '0' 启用(1)或禁用(0)此服务段。
interface network name yes (none) 指定用于检测外部 IP 的网络接口(如 wan)。当该接口启动时,DDNS 脚本将开始监控并更新 IP。
use_ipv6 boolean no '0' 是否使用 IPv6 地址。 BB 14.07 起不支持 IPv6,
从CC 15.05 支持。
service_name string yes(*) (none) 用哪个DDNS?
/usr/lib/ddns/services 中选择。
从 CC 15.05 起 如果 option use_ipv6 启用(1) 从 /usr/lib/ddns/services_ipv6 中选择一个
最新信息 Github.com
(*) 如果没有你想要的DDNS提供商, 删除这个选项然后使用 'option update_url' 或者从 CC 15.05 起使用'option update_script' 替代。
update_url string yes(*) (none) 查看DDNS提供商配置信息。使用他们的URL
(*) 若设置 'option service_name' 则弃用该选项
update_script string no (none) 从 CC 15.05 起 自定义更新脚本路径 /path/to/update_script.sh
若选择的DDNS提供商因为脚本原因不更新IP地址,原因是他们添加额外参数或步骤导致,需要写个自定义脚本更新。
详情看 update_sample.sh
:!: 使用该选项请移除'option service_name' 并且 'option update_url' 与该选项二选一
domain string yes (none) The DNS name / Hostname to update
(this name must already be registered with the DDNS provider)
:!: If your DDNS provider don't need this information being send for update, put it in anyway. ddns-scripts use it to compare local IP with registered IP.
:!: Since DD ddns-scripts use 'option lookup_host' (see below) to detect your registered IP.
So this option can be used for special multihost update configurations supported by some providers.
username string yes(*) (none) Username of your DDNS providers account
Have a look at DDNS providers help, because some providers are using different information as “username” for DDNS updates (i.e. hostname).
Look at DDNS client for additional information.
(*)If your DDNS provider don't need this information being send for update, put in an “X” instead.
password string yes(*) (none) Password of your DDNS providers account
Have a look at DDNS providers help, because some providers are using different information as “password” for DDNS updates (i.e. tokenid). e.g. for afraid.org, put your 25 character random TOKEN here in the password field.
Look at DDNS client for additional information.
(*)If your DDNS provider don't need this information being send for update, put in an “X” instead.
use_https boolean no '0' disable(0) / enable(1) the use of HTTPS for secure communication with your DDNS provider.
Some providers having problems, when not sending updates via HTTPS.
You must NOT specify 'http“s”:', simply use 'http:' in update_url above, if used.
:!: Needs “Wget” or “cURL” package being installed.
Look at DDNS client for additional information.
cacert string no(*) (none) /path/to/certificates directory or /path/to/certificate.crt file.
Package “ca-certificates” installs certificates to /etc/ssl/certs directory.
Look at DDNS client for additional information.
(*)required, if option use_https set to '1' (enabled)
since CC 15.05 a value 'IGNORE' is supported.
:!: This uses secure http for transfer, but do not verify the DDNS providers server certificate. (insecure)
ip_source string yes 'network' Defines the source to determine you local IP send to the DDNS provider.
Valid values are:
- 'network' uses/needs 'option ip_network'
- 'web' uses/needs 'option ip_url'
- 'interface' uses/needs 'option ip_interface'
- 'script' uses/needs 'option ip_script'
See details below.
ip_network string no(*) 'wan' Specify a network from your /etc/config/network file (e.g. “wan”) with the “ip_network” option. If you specify “wan”, you will send update with whatever the IP for your wan is.
(*)required, if option ip_source set to 'network'
ip_url string no(*) (none) Detects the current local IP from specified webside that response with the IP address of calling host. If you are behind a firewall/NAT this is the best option since none of the local networks or interfaces will have the external IP.
The correct URL might depend on the DDNS provider being used. Check with the DDNS providers's documentation to determine, if they offer this feature and, if so, what the correct URL is.
Sample: http://checkip.dyndns.org/ or http://checkipv6.dyndns.org/
(*)required, if value of option ip_source set to 'web'
ip_interface string no(*) (none) Specify a locally installed physical (hardware) interfaces (e.g. 'eth1') to detect your current IP address, independent from network they configured to.
(*)required, if value of option ip_source set to 'interface'
ip_script string no(*) (none) Useful, if you want to write your own script to detect your current local IP.
Put in full path '/path/to/script.sh'.
Have a look into getlocalip_sample.sh and Get IP from modem scripts collection
:!: The script must be marked executable.
(*)required, if value of option ip_source set to 'script'
check_interval number no '10' Defines the time interval to check if local IP has changed.
Accepted unit values: 'seconds' 'minutes' 'hours'.
:!: Checks below 5 minutes make no sense, because the DNS Servers in Internet needs about 5 minutes to sync.
:!: either both options are set or not set.
check_unit string no 'minutes'
force_interval number no '72' Force to send an update to service provider, if no IP change was detected. Consult DDNS providers documentation, if your DDNS entry might timeout.
Accepted unit values: 'minutes' 'hours' 'days'
:!: Minimum needs to be greater or equal check interval (see above).
:!: either both options are set or not set.

since CC 15.05 a value '0' is supported. This will stop script execution after one successful update.
force_unit string no 'hours'
retry_interval number no '60' If error happen on detecting, sending or updating, the script will retry the relevant action.
Here you define the time to wait before retry is started.
Accepted unit values: 'seconds' 'minutes'
:!: either both options are set or not set.
retry_unit string no 'seconds'
retry_max_count number no '0' Since CC 15.05 (23→master, retry_count renamed to retry_max_count) Number of retries before the script terminates execution, when communication errors happen.
:!: A setting of '0' will retry indefinitely.
use_syslog boolean no '0' Since BB 14.07 disable(0) / enable(1) logging events to syslog.
Since CC 15.05 Level of events logged to syslog:
0 == disable
1 == info, notice, warning, errors
2 == notice, warning, errors
3 == warning, errors
4 == errors
:!: Critical errors forcing ddns-scripts to stop are always logged to syslog.
use_logfile boolean no '1' Since CC 15.05 disable(0) / enable(1) logging to log file.
You find the file per default in /var/log/ddns/[sectionname].log
The path can be modified for all log files in section 'ddns' (see below)
dns_server string no (none) Since CC 15.05 Normally the current (in the internet) registered ip is detected using the local defined name lookup policies (i.e. /etc/resolve.conf etc.)
Specify here a DNS server to be used instead of the defaults.
You can use FQDN, hostname or IP address.
force_dnstcp boolean no '0' Since CC 15.05 disable(0) / enable(1) DNS requests via TCP protocol.
By default every DNS call is made via UDP protocol. Some internet provider offer modems, caching UDP DNS requests. They redirect every request to external servers to local modem cache.
To force the usage of TCP for DNS requests enable this option.
:!: Needs BIND host package to be installed.
proxy string no (none) Since CC 15.05 If a Proxy is need to access HTTP/HTTPS pages on the WEB, it can be configured here also for sending updates to the DDNS provider.
If you configured option use_https '1' above, you need to setup your HTTPS proxy here, otherwise your HTTP proxy.
:!: You should not detect your current IP (option ip_source 'web' above) because this request is also send via the configured proxy.
Syntax: [user:password@]proxy:port :!: port is required !
IPv6 address must be in squared brackets '[...]'
force_ipversion boolean no '0' Since CC 15.05 disable(0) / enable(1) this option.
Normally the system decide by various settings mostly compiled into the software, if it prefers IPv4 or IPv6 communication. Some DDNS providers update their DDNS record by using the IP address you send the update from.
Then you need to force the usage of the IP version you want to update or you want to force it for other reasons depending on your environment.
:!: Needs Wget or cURL package and BIND host package to be installed !
bind_network string no (none) Since CC 15.05 Network to use for communication when detecting IP and sending updates.
:!: Needs Wget or cURL package to be installed !
Wget will bind to the IP and cURL to physical interface of given network.
lookup_host string yes (none) Since DD Option domain (see above) is no longer used to get the registered ip. Configure here the host you like to get registered ip for. This is useful if updating multiple hosts in one configuration section.
rec_id string no (none) Since DD If this is set and the service is CloudFlare, updates the specified record (useful when there are multiple records for the same domain). Determined automatically when not set (but in case of multiple records for the same domain one will be arbitrarily chosen).
is_glue boolean no '0' Since DD This option is mandatory if the ddns record is a glue record and the registered ip should be compared against the glue record. This option requires bind host and does only work if the dns_server option is used. The dns_server value has to be the dns server where the glue record is defined.

从 CC 15.05 起支持
:!: 不建议普通用户更改此设置。
:!: 仅支持段名为 “global”
:!: 此设置由 ddns-scripts 和对应的 luci-app-ddns 使用。

Name
(old)
Name
(new)
Values Required Default Description
allow_local_ip upd_privateip boolean no '0' disallow(0) / allow(1) to send Private/Special IP's to the DDNS provider
blocked IPv4: 0/8, 10/8, 100.64/10, 127/8, 169.254/16, 172.16/12, 192.168/16
blocked IPv6: ::/32, f000::/4
date_format ddns_dateformat string no '%F %R' set date format to use for display date in logfiles and LuCI WebUI.
For supported codes look here.
run_dir ddns_rundir string no '/var/run/ddns' Set directory to use for '*.pid' and '*.update' files.
There are separate files for every running service section.
log_dir ddns_logdir string no '/var/log/ddns' Set directory to use for '*.log' files.
There are separate files for every running service section, if option use_logfile set to '1' (enable) (see above).
log_lines ddns_loglines number no '250' Set number of lines stored in .log file before auto truncated.
use_curl boolean no '0' If Wget and cURL package are installed, Wget is used for communication by default.
Set to '1' will use cURL instead.

:!: Wget 1.x 在使用多个 WAN 接口(如 mwan)时无法正常工作。 Issue 8277

原因: wget 1.x 无法绑定到接口,只能更改 IP 地址(bind-address)

解决方法: 使用 curl,通过设置 use_curl

(未经测试)wget2(截至 2021 年 3 月尚未发布)支持 bind-interface


:!: 从 2021 年 6 月起, OpenDNS 在使用 Wget 1.xuclient-fetch (the default for OpenWRT 21.02.0) 时会返回错误 “badauth

原因: 为了与 OpenDNS正常工作, Wget 1.x 需要在命令行中添加 --auth-no-challenge 选项

解决方法: 安装并使用 curl, 通过在 Global 段中设置 use_curl = 1

This website uses cookies. By using the website, you agree with storing cookies on your computer. Also you acknowledge that you have read and understand our Privacy Policy. If you do not agree leave the website.More information about cookies
  • Last modified: 2025/06/23 02:22
  • by starsfall