使用 dyndns noip.com 配置 debian ddclient

使用 dyndns noip.com 配置 debian ddclient

我在将 debian jessie 配置为 noip.com 更新程序时遇到问题。我的配置如下所示:

# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf

use=web
web=checkip.dyndns.com
web-skip='Current IP Address: '

protocol=dyndns2
server=dynupdate.no-ip.com/nic/update
login=myusername
password='mypass'
myhost.noip.me

一切似乎都很好,但如果我 ping myhost.noip.me,IP 地址不会更新。通过检查

ddclient -daemon=0 -debug -verbose -noquiet 2 /etc/ddclient.conf

我得到以下回复:

.conf
=== opt ====
opt{cache}                           : <undefined>
opt{cmd}                             : <undefined>
opt{cmd-skip}                        : <undefined>
opt{daemon}                          : 0
opt{debug}                           : 1
opt{exec}                            : <undefined>
opt{facility}                        : <undefined>
opt{file}                            : <undefined>
opt{force}                           : <undefined>
opt{foreground}                      : <undefined>
opt{fw}                              : <undefined>
opt{fw-login}                        : <undefined>
opt{fw-password}                     : <undefined>
opt{fw-skip}                         : <undefined>
opt{geturl}                          : <undefined>
opt{help}                            : <undefined>
opt{host}                            : <undefined>
opt{if}                              : <undefined>
opt{if-skip}                         : <undefined>
opt{ip}                              : <undefined>
opt{login}                           : <undefined>
opt{mail}                            : <undefined>
opt{mail-failure}                    : <undefined>
opt{max-interval}                    : 2592000
opt{min-error-interval}              : 300
opt{min-interval}                    : 30
opt{options}                         : <undefined>
opt{password}                        : <undefined>
opt{pid}                             : <undefined>
opt{postscript}                      : <undefined>
opt{priority}                        : <undefined>
opt{protocol}                        : <undefined>
opt{proxy}                           : <undefined>
opt{query}                           : <undefined>
opt{quiet}                           : 0
opt{retry}                           : <undefined>
opt{server}                          : <undefined>
opt{ssl}                             : <undefined>
opt{syslog}                          : <undefined>
opt{test}                            : <undefined>
opt{timeout}                         : <undefined>
opt{use}                             : <undefined>
opt{verbose}                         : 1
opt{web}                             : <undefined>
opt{web-skip}                        : <undefined>
=== globals ====
globals{daemon}                      : 60
globals{debug}                       : 1
globals{login}                       : myusername
globals{password}                    : mypass
globals{protocol}                    : dyndns2
globals{quiet}                       : 0
globals{server}                      : dynupdate.no-ip.com/nic/update
globals{use}                         : web
globals{verbose}                     : 1
globals{web}                         : checkip.dyndns.com
globals{web-skip}                    : Current IP Address:
=== config ====
config{myhost.noip.me}{atime}          : 0
config{myhost.noip.me}{backupmx}       : 0
config{myhost.noip.me}{cacheable}      : ARRAY(0x1770c50)
config{myhost.noip.me}{cmd}            : <undefined>
config{myhost.noip.me}{cmd-skip}       :
config{myhost.noip.me}{custom}         : 0
config{myhost.noip.me}{fw}             :
config{myhost.noip.me}{fw-login}       : <undefined>
config{myhost.noip.me}{fw-password}    :
config{myhost.noip.me}{fw-skip}        :
config{myhost.noip.me}{host}           : myhost.noip.me
config{myhost.noip.me}{if}             : ppp0
config{myhost.noip.me}{if-skip}        :
config{myhost.noip.me}{ip}             : <undefined>
config{myhost.noip.me}{login}          : myusername
config{myhost.noip.me}{max-interval}   : 2592000
config{myhost.noip.me}{min-error-interval} : 300
config{myhost.noip.me}{min-interval}   : 30
config{myhost.noip.me}{mtime}          : 0
config{myhost.noip.me}{mx}             :
config{myhost.noip.me}{password}       : mypass
config{myhost.noip.me}{protocol}       : dyndns2
config{myhost.noip.me}{script}         : /nic/update
config{myhost.noip.me}{server}         : dynupdate.no-ip.com/nic/update
config{myhost.noip.me}{static}         : 0
config{myhost.noip.me}{status}         :
config{myhost.noip.me}{use}            : web
config{myhost.noip.me}{warned-min-error-interval} : 0
config{myhost.noip.me}{warned-min-interval} : 0
config{myhost.noip.me}{web}            : checkip.dyndns.com
config{myhost.noip.me}{web-skip}       : Current IP Address:
config{myhost.noip.me}{wildcard}       : 0
config{myhost.noip.me}{wtime}          : 30
=== cache ====
cache{myhost.noip.me}{atime}           : 0
cache{myhost.noip.me}{backupmx}        : 0
cache{myhost.noip.me}{custom}          : 0
cache{myhost.noip.me}{host}            : myhost.noip.me
cache{myhost.noip.me}{ip}              : 12.34.56.78
cache{myhost.noip.me}{mtime}           : 1437992275
cache{myhost.noip.me}{mx}              :
cache{myhost.noip.me}{script}          : /nic/update
cache{myhost.noip.me}{static}          : 0
cache{myhost.noip.me}{status}          :
cache{myhost.noip.me}{warned-min-error-interval} : 0
cache{myhost.noip.me}{warned-min-interval} : 0
cache{myhost.noip.me}{wildcard}        : 0
cache{myhost.noip.me}{wtime}           : 30
DEBUG:    proxy  =
DEBUG:    url    = checkip.dyndns.com
DEBUG:    server = checkip.dyndns.com
CONNECT:  checkip.dyndns.com
CONNECTED:  using HTTP
SENDING:  GET / HTTP/1.0
SENDING:   Host: checkip.dyndns.com
SENDING:   User-Agent: ddclient/3.8.2
SENDING:   Connection: close
SENDING:
RECEIVE:  HTTP/1.1 200 OK
RECEIVE:  Content-Type: text/html
RECEIVE:  Server: DynDNS-CheckIP/1.0
RECEIVE:  Connection: close
RECEIVE:  Cache-Control: no-cache
RECEIVE:  Pragma: no-cache
RECEIVE:  Content-Length: 103
RECEIVE:
RECEIVE:  <html><head><title>Current IP Check</title></head><body>Current IP Address: 12.34.56.78</body></html>
DEBUG:    get_ip: using web, checkip.dyndns.com reports 12.34.56.78
SUCCESS:  myhost.noip.me: skipped: IP address was already set to 12.34.56.78.

我认为我当前的(人工)IP“12.34.56.78”已正确设置。现在,如果我 ping(我的人工主机)myhost.noip.me,我会得到一个不同的 IP。

有什么建议我需要更改什么才能让 ddclient 与 noip.com 一起使用吗?

答案1

您显示的跟踪显示ddclient轮询checkip.dyndns.com了您机器的 IP,发现 IP 没有更改,因此决定跳过联系dynupdate.no-ip.com更改IP。如果它已联系dynupdate.no-ip.com,您将在跟踪中看到类似这样的行

CONNECT:  dynupdate.no-ip.com

后面会跟着一堆SENDINGRECEIVE行。

我发现,如果您想强制ddclient执行整个操作,您应该使用 停止任何当前正在运行的守护进程,sudo service ddclient stop并使用 删除其缓存文件sudo rm /var/cache/ddclient/ddclient.cache。然后任何后续运行都必须执行所有检查。

另外,你的配置文件是错误的。您不应该/nic/updateserver设置中,因为这是设置的一部分protocol。 (使用dyndns2协议意味着/nic/update附加。)作为参考,我当前的配置是:

use=cmd
cmd='dig +short myip.opendns.com @resolver1.opendns.com'

protocol=dyndns2
ssl=yes
server=dynupdate.no-ip.com
login=<YOUR LOGIN>
password=<YOUR PASSWORD>
<YOUR HOST>

我使用该dig命令来获取我的公共 IP,而不是通过 HTTP 联系服务器。

答案2

protocol=noip

我正在使用 noip,但使用 noip 协议,就像它在 --help 标志内一样,请查看此帮助以获取更多信息。

答案3

您的配置唯一的问题是服务器更新地址。它应该是:

# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf

use=web
web=checkip.dyndns.com
web-skip='Current IP Address: '

protocol=dyndns2
server=dynupdate.no-ip.com
login=myusername
password='mypass'
myhost.noip.me

您可以通过执行以下命令来测试配置:

sudo ddclient -verbose -foreground

您应该看到路由器部分(使用“网络”提供商提取 IP 地址),然后使用 no-ip 进行身份验证并更新 IP 地址:

ONNECT:  checkip.dyndns.com
CONNECTED:  using HTTP
SENDING:  GET / HTTP/1.0
SENDING:   Host: checkip.dyndns.com
SENDING:   User-Agent: ddclient/3.8.3
SENDING:   Connection: close
SENDING:   
RECEIVE:  HTTP/1.1 200 OK
RECEIVE:  Content-Type: text/html
RECEIVE:  Server: DynDNS-CheckIP/1.0.1
RECEIVE:  Connection: close
RECEIVE:  Cache-Control: no-cache
RECEIVE:  Pragma: no-cache
RECEIVE:  Content-Length: 106
RECEIVE:  
RECEIVE:  <html><head><title>Current IP Check</title></head><body>Current IP Address: X.X.X.X</body></html>
INFO:     setting IP address to X.X.X.X for myhost.noip.me
UPDATE:   updating myhost.noip.me
CONNECT:  dynupdate.no-ip.com
CONNECTED:  using HTTP
SENDING:  GET /nic/update?system=dyndns&hostname=myhost.noip.me&myip=X.X.X.X HTTP/1.0
SENDING:   Host: dynupdate.no-ip.com
SENDING:   Authorization: Basic bHBlbmFwQGdtYWlsLmNvbToyNjg3OGxhcA==
SENDING:   User-Agent: ddclient/3.8.3
SENDING:   Connection: close
SENDING:   
RECEIVE:  HTTP/1.0 200 OK
RECEIVE:  server: envoy
RECEIVE:  content-type: text/plain; charset=UTF-8
RECEIVE:  cache-control: no-cache
RECEIVE:  date: Fri, 26 Jul 2019 18:48:25 GMT
RECEIVE:  connection: close
RECEIVE:  
RECEIVE:  good X.X.X.X
SUCCESS:  updating myhost.noip.me: good: IP address set to X.X.X.X

答案4

protocol=dyndns2
use=web, if=eth0
server=dynupdate.no-ip.com
[email protected]
password='mysuperpassword'
myhost.no-ip.org

你有“if = ppp0”。您使用“拨号”连接吗?我的有“if=eth0”,因为 dsl ppp 在调制解调器/路由器上。

Your ping test is on the same network, or you try on a different (outside) computer? Could be a local DNS issue.

相关内容