Difference between revisions of "Dynamic DNS"

From ArchWiki
Jump to: navigation, search
(Netctl)
(ddclient: duckdns -> +open source)
 
(71 intermediate revisions by 22 users not shown)
Line 1: Line 1:
 
[[Category:Domain Name System]]
 
[[Category:Domain Name System]]
{{Article summary start|Summary}}
+
[[ja:ダイナミック DNS]]
{{Article summary text|Updating Dynamic DNS}}
+
'''Dynamic DNS''' or '''DDNS''' is a method of updating, in real time, a [[DNS]] to point to a changing IP address on the Internet. This is used to provide a persistent domain name for a resource lacking a static IP. To use DDNS, you need to both sign up with a DDNS provider and set up an automatic update tool that will notify the provider when your IP address changes.
{{Article summary end}}
+
  
'''Dynamic DNS''' or '''DDNS''' is a method of updating, in real time, a [[DNS]] to point to a changing IP address on the Internet. This is used to provide a persistent domain name for a resource that may change location on the network.
+
== Update tools ==
  
==Router==
+
=== Router ===
Many routers have built in DDNS Services but can be limited in the services which they update. If the Router supports a the service, or you are willing to pay or donate for a service, you should do this, it is faster and more reliable.
+
In that case, there is no need to use a softwareside solution.
+
  
==Software Dynamic DNS==
+
If the device needing DDNS sits behind a router, you should first check if the router itself can update any DDNS services. Although the selection of services may be limited, there are several advantages to using the router: it will probably be easier to set up, will require little to no maintenance, and will have no downtime (if the router is down you won't have Internet anyway).
=== Afraid ===
+
[http://FreeDNS.afraid.org FreeDNS.afraid.org] is a free Service which is easy and uncomplicated to set up.  
+
  
There are several options to enable automatic DDNS updating for this provider:
+
=== ddclient ===
  
==== afraid-dyndns ====
+
{{Pkg|ddclient}} is compatible with many DDNS services and is the recommended tool for updating DDNS if your [[#Router|router]] is not an option. It includes [[systemd]] support.
The package {{AUR|afraid-dyndns-uv}} is available in the [[AUR]].
+
  
==== ddclient ====
+
After installing, edit the default config {{ic|/etc/ddclient/ddclient.conf}} to set up your DDNS provider (it includes many examples). Then [[enable]] and [[start]] {{ic|ddclient.service}}.
  
The package {{Pkg|ddclient}} is available in the [[AUR]]. It includes [[systemd]] support. Unfortunately, it seems to generate broken update URLs for freedns: http://ddclient.tisnix.be/ticket/58
+
Some of the compatible services are listed below, but you can also check the [http://sourceforge.net/p/ddclient/code/HEAD/tree/trunk/sample-etc_ddclient.conf examples] and [http://sourceforge.net/p/ddclient/wiki/protocols/ protocols] for more.
  
An example config file looks like this:
+
{| class="wikitable"
 +
|+ ddclient compatible services
 +
! Service
 +
! Cost
 +
! Available Records
 +
! Hostname Limit
 +
! Config Notes
 +
! Alternative tools
 +
|-
 +
! [http://www.changeip.com/ ChangeIP]
 +
| Free or paid || A, AAAA, CNAME, MX, codomains || 7 free || ||
 +
|-
 +
! [http://www.dnsdynamic.org/ DNSdynamic]
 +
| Free || || || [https://www.dnsdynamic.org/api.php example] ||
 +
|-
 +
! [https://www.duckdns.org/ Duck DNS]
 +
| Free and open source || || || || {{aur|duckdns}}
 +
|-
 +
! [http://freedns.afraid.org/ FreeDNS]
 +
| Free or paid || CNAME, A, AAAA, MX, NS, TXT, LOC, RP, HINFO, SRV || 5 free || [http://freedns.afraid.org/scripts/freedns.clients.php example] || {{aur|afraid-dyndns-uv}}, {{aur|petrified}}
 +
|-
 +
! [http://www.noip.com/ No-IP]
 +
| Free or paid || || 3 free, 25+ paid || Use protocol {{ic|dyndns2}}, server {{ic|dynupdate.noip.com}} || {{aur|noip}}
 +
|-
 +
! [https://www.nsupdate.info/ nsupdate.info]
 +
| Free and open source || A, AAAA || || Use protocol {{ic|dyndns2}} || {{aur|inadyn-fork}}
 +
|-
 +
|}
  
daemon=600
+
==== Starting ddclient after networking is up ====
cache=/tmp/ddclient.cache
+
syslog=yes
+
+
use=web, web=checkip.dyndns.com/, web-skip='IP Address'
+
+
ssl=yes
+
+
## Configuration variables applicable to the 'freedns' protocol are:
+
#  protocol=freedns            ##
+
#  server=fqdn.of.service      ## defaults to freedns.afraid.org
+
#  login=service-login          ## login name and password registered with the service
+
#  password=service-password    ##
+
#  fully.qualified.host        ## the host registered with the service.
+
#
+
protocol=freedns,                                            \
+
login=my-freedns.afraid.org-login,                            \
+
password=my-freedns.afraid.org-password                      \
+
myhost.afraid.org
+
  
To enable the [[systemd]] service:
+
If you find that ddclient is unable to update your IP properly, it may be that the ddclient process is starting before networking is up. To fix it, you can edit the unit file to depend on {{ic|network-online.target}} (added lines in bold):
  
systemctl enable ddclient
+
{{hc|# systemctl edit --full ddclient.service|2=
 +
[Unit]
 +
Description=Dynamic DNS Update Client
 +
After=network.target
 +
'''PartOf=network-online.target'''
  
==== cron ====
+
[Service]
 +
Type=forking
 +
PIDFile=/var/run/ddclient.pid
 +
ExecStart=/usr/bin/ddclient
  
Another option is to:
+
[Install]
* goto [http://freedns.afraid.org/dynamic/index.php Dynamic DNS] page on freedns.afraid.org
+
'''WantedBy=network-online.target'''
* add A record and select your prefered domain name
+
}}
* copy link under '''Direct URL''', it will be something like "<nowiki>http://freedns.afraid.org/dynamic/update.php?ZRRJZ...................bzo4Njc1M4DA</nowiki>"
+
* use '''crontab -e''' to enter new schedulled command:
+
*/10 * * * * curl -ks http://freedns.afraid.org/dynamic/update.php?ZRRJZ...................bzo4Njc1M4DA > /dev/null
+
  
==== Netctl ====
+
{{Note|
To add the record of your IP to freedns.afraid.org along with a network connection through the use with [[Netctl]]. You can append the following line to your netctl profile.
+
* A full replacement must be created, because a drop-in override cannot modify the {{ic|[Install]}} section of a unit file. Make sure to disable and reenable the {{ic|ddclient.service}} so that the symlink is put into the right place.
{{bc|<nowiki>ExecUpPost='curl -ks http://freedns.afraid.org/dynamic/update.php?ZRRJZ...................bzo4Njc1M4DA'</nowiki>}}
+
* It may be necessary to configure the network manager to activate {{ic|network-online.target}} (for [[netctl]] see [[netctl#Activate network-online.target]]).
 +
}}
  
=== DynDNS ===
+
=== Other tools ===
[http://dyn.com/dns/ DynDNS] is another Dynamic DNS service.
+
  
DynDNS can be [[Pacman|installed]] with the package {{AUR|dyndns}}, available in the [[AUR]].
+
Other DDNS updaters that work with several providers are {{AUR|inadyn-mt}} ([http://sourceforge.net/projects/inadyn-mt supported providers]) and {{AUR|ndyndns}} (supports DynDNS and Namecheap).
 +
 
 +
== Other providers ==
 +
 
 +
The following DDNS providers are not compatible with [[#ddclient|ddclient]] so updating your IP with them may require a special tool or some custom scripting. Remember that if the service allows you to update your IP using the command line, you can automate the process using tools such as [[cron]] or [[systemd/Timers]].
 +
 
 +
=== duiadns ===
 +
[https://www.duiadns.net Duiadns.org] is a free service which can be automated with {{AUR|duiadns}}{{Broken package link|{{aur-mirror|duiadns}}}}.
 +
 
 +
=== FreeDns.io ===
 +
 
 +
[https://freedns.io FreeDns.io] provides free A and AAAA DNS records and CNAME, TXT and MX records with a premium membership. You can update your IP using their HTTP API (with a 60 requests-per-hour limit). They provide [https://github.com/nkovacne/freedns-samples several example scripts].
 +
 
 +
===  Now-IP ===
 +
[https://now-ip.com Now-IP.com] is a free service which is easy and uncomplicated to set up.
 +
 
 +
=== System-NS ===
 +
 
 +
[http://system-ns.com/ System-NS] is a free service which can be updated via the command line. See [https://system-ns.com/services/dynamic the official documentation].

Latest revision as of 00:23, 4 July 2016

Dynamic DNS or DDNS is a method of updating, in real time, a DNS to point to a changing IP address on the Internet. This is used to provide a persistent domain name for a resource lacking a static IP. To use DDNS, you need to both sign up with a DDNS provider and set up an automatic update tool that will notify the provider when your IP address changes.

Update tools

Router

If the device needing DDNS sits behind a router, you should first check if the router itself can update any DDNS services. Although the selection of services may be limited, there are several advantages to using the router: it will probably be easier to set up, will require little to no maintenance, and will have no downtime (if the router is down you won't have Internet anyway).

ddclient

ddclient is compatible with many DDNS services and is the recommended tool for updating DDNS if your router is not an option. It includes systemd support.

After installing, edit the default config /etc/ddclient/ddclient.conf to set up your DDNS provider (it includes many examples). Then enable and start ddclient.service.

Some of the compatible services are listed below, but you can also check the examples and protocols for more.

ddclient compatible services
Service Cost Available Records Hostname Limit Config Notes Alternative tools
ChangeIP Free or paid A, AAAA, CNAME, MX, codomains 7 free
DNSdynamic Free example
Duck DNS Free and open source duckdnsAUR
FreeDNS Free or paid CNAME, A, AAAA, MX, NS, TXT, LOC, RP, HINFO, SRV 5 free example afraid-dyndns-uvAUR, petrifiedAUR
No-IP Free or paid 3 free, 25+ paid Use protocol dyndns2, server dynupdate.noip.com noipAUR
nsupdate.info Free and open source A, AAAA Use protocol dyndns2 inadyn-forkAUR

Starting ddclient after networking is up

If you find that ddclient is unable to update your IP properly, it may be that the ddclient process is starting before networking is up. To fix it, you can edit the unit file to depend on network-online.target (added lines in bold):

# systemctl edit --full ddclient.service
[Unit]
Description=Dynamic DNS Update Client
After=network.target
PartOf=network-online.target

[Service]
Type=forking
PIDFile=/var/run/ddclient.pid
ExecStart=/usr/bin/ddclient

[Install]
WantedBy=network-online.target
Note:
  • A full replacement must be created, because a drop-in override cannot modify the [Install] section of a unit file. Make sure to disable and reenable the ddclient.service so that the symlink is put into the right place.
  • It may be necessary to configure the network manager to activate network-online.target (for netctl see netctl#Activate network-online.target).

Other tools

Other DDNS updaters that work with several providers are inadyn-mtAUR (supported providers) and ndyndnsAUR (supports DynDNS and Namecheap).

Other providers

The following DDNS providers are not compatible with ddclient so updating your IP with them may require a special tool or some custom scripting. Remember that if the service allows you to update your IP using the command line, you can automate the process using tools such as cron or systemd/Timers.

duiadns

Duiadns.org is a free service which can be automated with duiadnsAUR[broken link: archived in aur-mirror].

FreeDns.io

FreeDns.io provides free A and AAAA DNS records and CNAME, TXT and MX records with a premium membership. You can update your IP using their HTTP API (with a 60 requests-per-hour limit). They provide several example scripts.

Now-IP

Now-IP.com is a free service which is easy and uncomplicated to set up.

System-NS

System-NS is a free service which can be updated via the command line. See the official documentation.