我已在我的http://no-ip.org/帐户中创建了帐户和主机名,这是迄今为止我使用最常见的服务器类型服务。有人可以指导我如何在命令行上使用ddclient与no-ip进行配置吗?
我已在我的http://no-ip.org/帐户中创建了帐户和主机名,这是迄今为止我使用最常见的服务器类型服务。有人可以指导我如何在命令行上使用ddclient与no-ip进行配置吗?
ddclient
是一个动态更新客户端 (DUC),可用于更新动态 DNS 条目。它会定期检查当前 IP 地址,并在检测到更改时更新 DNS 信息。以下是如何安装和配置它以使用 No-IP (noip.com/no-ip.com) 服务的方法。
首先,安装 ddclient
包。稍后我们将手动配置它,所以对于所有配置问题,只需按回车键即可。
sudo apt-get install ddclient
ddclient
守护进程。由于 Ubuntu 12.04 存在一个 bug,所以 sudo service ddclient stop
命令无法正常工作,我们改用 pkill
命令来代替。sudo pkill ddclient
/etc/ddclient.conf~
),这是gedit
默认创建的,可能包含你认为已经删除的密码,请关闭以下设置:Edit -> Preferences -> Editor -> Create a backup copy of files before saving
。sudo gedit /etc/ddclient.conf /etc/default/ddclient
删除/etc/ddclient.conf
文件中的旧内容,并粘贴下面显示的模板。
阅读模板的注释并根据您的需求自定义文件。
使用noip.com子账户可能是一个好主意,即带有密码的组(此功能是付费服务)。这样,密码只能用于更新指定的主机,而不能完全访问您的整个No-IP账户,其中可能包括MX记录(攻击者如果获得您的密码,可以更改MX记录以截取您的电子邮件)或其他服务,如IMAP账户。
您应该将daemon_interval=3600
设置为适当的值(请参考模板注释)。
使用以下命令测试您的配置:
sudo ddclient -daemon=0 -debug -verbose -noquiet -force
sudo service ddclient start
sudo dpkg-reconfigure ddclient
sudo apt-get purge ddclient
sudo service ddclient status
sudo service ddclient start
sudo service ddclient stop
# The stop command above does not work on Ubuntu 12.04 due to a bug, but
# it works on 14.04. Here are alternative ways to control the daemon:
ps -A f | grep -i ddclient
sudo pkill ddclient
sudo pkill ddclient
sudo rm /var/cache/ddclient/ddclient.cache
sudo service ddclient start
# See the result:
tail /var/log/syslog
# If you have set up mail=..., you should also receive an e-mail.
# The syslog and e-mail should show a "good" or "nochg" response.
sudo pkill ddclient
sudo ddclient -daemon=0 -debug -verbose -noquiet -force -use ip -ip 1.2.3.4
sleep 30 # ddclient will not perform updates less than 30 seconds apart
sudo service ddclient start
调试运行(更新 DNS 记录永不/根据需要/始终):
sudo ddclient -daemon=0 -debug -verbose -noquiet -noexec
sudo ddclient -daemon=0 -debug -verbose -noquiet
sudo ddclient -daemon=0 -debug -verbose -noquiet -force
sudo ddclient -query
/etc/ddclient.conf
/etc/default/ddclient
/var/cache/ddclient/ddclient.cache
/var/log/syslog
文档:
ddclient -help
/usr/share/doc/ddclient/examples/sample-etc_ddclient.conf.gz
################################################################################
# Configuration file for ddclient
################################################################################
################################################################################
# Misc. configurations
# To choose between ipup mode (for dial-on-demand) and daemon mode, please edit
# /etc/default/ddclient.
#mail=root # E-mail messages to this address
#mail-failure=root # E-mail messages about failed updates to this address
################################################################################
# How to obtain current IP address
# Methods:
# use=ip, ip=ADDRESS # Set the IP address to ADDRESS
# use=if, if=INTERFACE, if-skip=PATTERN # Obtain IP address by calling 'ifconfig INTERFACE'
# use=web, web=PROVIDER|URL, web-skip=PATTERN # Obtain IP address from IP discovery web page
# use=cmd, cmd=PROGRAM, cmd-skip=PATTERN # Obtain IP address by calling PROGRAM
# use=fw|FWMODEL, fw=ADDRESS|URL, fw-skip=PATTERN # Obtain IP address from firewall web page
# fw-login=LOGIN, fw-password=SECRET
#
# The *-skip options can be used to skip IP addresses found before PATTERN.
#
# NOTE: The ddclient IP detection routines do not respect the HTTPS prefix in
# URLs, and instead fall back to HTTP (this is fixed in version 3.8.1). The
# option ssl=yes does not apply to the IP detection either (this is at least
# how versions 3.8.0 to 3.8.2 behave).
#
# The default time between each IP address change check is daemon_interval=300
# (5 minutes), which may be a bit too frequent when using an external IP
# discovery service. To set the checking interval to e.g. one hour instead,
# please edit /etc/default/ddclient and set daemon_interval=3600.
# Obtain IP address from network interface
#use=if, if=eth0
# Obtain IP address from no-ip.com IP discovery web page (unencrypted connection)
use=web, web='http://ip1.dynupdate.no-ip.com:8245/'
# Obtain IP address from no-ip.com IP discovery web page (encrypted connection)
# Encryption does not offer any real protection since a man-in-the-middle
# attack could route the HTTPS connection through a host belonging to the
# attacker, thus causing an incorrect IP address to be reported.
#use=cmd, cmd='bash -c "set -o pipefail; timeout 120 wget -qO- \
# --header=Host:ip1.dynupdate.no-ip.com https://dynupdate.no-ip.com/ | head -c 1000"'
################################################################################
# Dynamic DNS service setup
protocol=noip
#server= # Defaults to dynupdate.no-ip.com for noip protocol
ssl=yes # NOTE: Does not apply when obtaining IP address, just when updating the DNS entry!
login='nobody@nowhere.com' # Username. For No-IP sub-accounts (groups with passwords), use '<groupname>%3A<username>'.
password='1234'
################################################################################
# Hosts to update, with optional per-host options
# Examples:
# protocol=hammernode1, \
# login='my-hn-login', password='my-hn-password' \
# myhost.hn.org,myhost2.hn.org
#
# login='group2%3Ajohndoe@domain.com', password='1234' myhost3.no-ip.biz,myhost4.no-ip.biz
#
# myhost.no-ip.biz,myhost2.no-ip.biz
my.full.hostname
这里有一个好的步骤指南... http://www.ubuntugeek.com/update-ip-addresses-at-dynamic-dns-services-using-ddclient.html
希望能对你有所帮助 :)