Difference between revisions of "Dynamic DNS"

From ArchWiki
Jump to navigation Jump to search
(Undo revision 459229 by Wild Penguin (talk) - the previous example was almost correct, Talk:Dynamic_DNS#Starting_ddclient_after_networking_is_up)
(ddclient: don't compare services, only describe configuration, afraid-dyndns-uv is abandoned)
(28 intermediate revisions by 13 users not shown)
Line 1: Line 1:
 
[[Category:Domain Name System]]
 
[[Category:Domain Name System]]
 
[[ja:ダイナミック DNS]]
 
[[ja:ダイナミック 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.
+
According to [[Wikipedia:Dynamic DNS|Wikipedia]]:
  
== Update tools ==
+
:'''Dynamic DNS''' ('''DDNS''' or '''DynDNS''') is a method of automatically updating a [[Wikipedia:name server|name server]] in the [[Wikipedia:Domain Name System|Domain Name System]] (DNS), often in real time, with the active DDNS configuration of its configured hostnames, addresses or other information.
  
=== Router ===
+
:The term is used to describe two different concepts. The first is "dynamic DNS updating" which refers to systems that are used to update traditional DNS records without manual editing. These mechanisms are explained in [[RFC:2136|RFC 2136]], and use the [[Wikipedia:TSIG|TSIG]] mechanism to provide security. The second kind of dynamic DNS permits lightweight and immediate updates often using an update client, which do not use the RFC2136 standard for updating DNS records. These clients provide a persistent addressing method for devices that change their location, configuration or [[Wikipedia:IP address|IP address]] frequently.
 +
 
 +
For RFC2136 there is {{man|1|nsupdate}} from {{Pkg|bind-tools}}. For dynamic DNS services there are several packages available, see [[#Update clients]].
 +
 
 +
== 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).
 
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).
 +
 +
== Update clients ==
 +
 +
Note that some dynamic DNS providers do not require a dedicated client and can be updated with {{Pkg|curl}}.
 +
 +
=== Multi-service clients ===
 +
 +
* {{App|ddclient|Update dynamic DNS entries for accounts on many dynamic DNS services.|https://github.com/ddclient/ddclient|{{Pkg|ddclient}}}}
 +
* {{App|inadyn-fork|Dynamic DNS client with SSL/TLS support.|http://troglobit.com/inadyn.html|{{AUR|inadyn-fork}}, {{AUR|inadyn-fork-git}}}}
 +
* {{App|inadyn-mt|A simple dynamic DNS client based on inadyn.|http://inadyn-mt.sourceforge.net/|{{AUR|inadyn-mt}}}}
 +
* {{App|ndyndns|Supports DynDNS and Namecheap.|https://github.com/niklata/ndyndns|{{AUR|ndyndns}}}}
 +
 +
=== Single-service clients ===
 +
 +
* {{App|duckdns|Update your DuckDNS.org entries from your computer with systemd.|https://www.duckdns.org/|{{AUR|duckdns}}}}
 +
* {{App|noip|Dynamic DNS Client Updater for no-ip.com services.|3=http://www.no-ip.com/downloads.php?page=linux|4={{AUR|noip}}}}
 +
* {{App|petrified|Bash client to update dynamic DNS at freedns.afraid.org.|https://gitlab.com/troyengel/petrified|{{AUR|petrified}}}}
  
 
=== ddclient ===
 
=== ddclient ===
Line 20: Line 41:
 
|+ ddclient compatible services
 
|+ ddclient compatible services
 
! Service
 
! Service
! Cost
 
! Available Records
 
! Hostname Limit
 
 
! Config Notes
 
! Config Notes
! Alternative tools
 
 
|-
 
|-
 
! [http://now-dns.com/ Now-DNS]
 
! [http://now-dns.com/ Now-DNS]
| Free || A, AAAA || unlimited || Use protocol {{ic|dyndns2}}, server {{ic|now-dns.com/update}} ||
+
| [https://now-dns.com/client/ddclient.conf example]
 
|-
 
|-
 
! [http://www.changeip.com/ ChangeIP]
 
! [http://www.changeip.com/ ChangeIP]
| Free or paid || A, AAAA, CNAME, MX, codomains || 7 free || ||
+
| [https://sourceforge.net/p/ddclient/wiki/protocols/#changeip example]
|-
 
! [http://www.dnsdynamic.org/ DNSdynamic]
 
| Free || || || [https://www.dnsdynamic.org/api.php example] ||
 
 
|-
 
|-
 
! [https://www.duckdns.org/ Duck DNS]
 
! [https://www.duckdns.org/ Duck DNS]
| Free and open source || || || || {{aur|duckdns}}
+
| [https://sourceforge.net/p/ddclient/wiki/protocols/#duckdns example]
 
|-
 
|-
 
! [http://freedns.afraid.org/ FreeDNS]
 
! [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://freedns.afraid.org/scripts/freedns.clients.php example]
 
|-
 
|-
 
! [http://www.noip.com/ No-IP]
 
! [http://www.noip.com/ No-IP]
| Free or paid || || 3 free, 25+ paid || Use protocol {{ic|dyndns2}}, server {{ic|dynupdate.no-ip.com}} || {{aur|noip}}
+
| Use protocol {{ic|noip}}, server {{ic|dynupdate.no-ip.com}}
 
|-
 
|-
 
! [https://www.nsupdate.info/ nsupdate.info]
 
! [https://www.nsupdate.info/ nsupdate.info]
| Free and open source || A, AAAA || || Use protocol {{ic|dyndns2}} || {{aur|inadyn-fork}}
+
| Use protocol {{ic|dyndns2}}
 +
|-
 +
! [https://dyn.com/dns/ Dyn DNS]
 +
| [https://sourceforge.net/p/ddclient/wiki/protocols/#dyndns2 example]
 
|-
 
|-
 +
! [https://www.namecheap.com/ Namecheap]
 +
| [https://sourceforge.net/p/ddclient/wiki/protocols/#namecheap example]
 +
|-
 +
! [https://www.dynu.com/ Dynu]
 +
| [https://www.dynu.com/DynamicDNS/IPUpdateClient/DDClient example]
 
|}
 
|}
 +
{{Note| Free users of no-ip are required to manually confirm their domain(s) every 30 days. Domain confirmation is not required for Enhanced users though. More info at [http://www.noip.com/support/knowledgebase/why-is-my-hostname-pending-deletion/ Why is My Hostname Pending Deletion?]}}
  
==== Starting ddclient after networking is up ====
+
==== Use an external website to determine IP address  ====
  
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):
+
If ddclient is unable to detect your IP address, you can configure ddclient to fetch your IP from an external webpage such as [http://whatismyip.org/ whatismyip.org]. Add somewhere in the config file:
  
{{hc|# systemctl edit --full ddclient.service|2=
+
{{hc|/etc/ddclient/ddclient.conf|2=
[Unit]
+
# use whatismyip.org to determine IP address
Description=Dynamic DNS Update Client
+
use=web
After=network.target
+
web=whatismyip.org
'''PartOf=network-online.target'''
+
}}
  
[Service]
+
==== Starting ddclient after networking is up ====
Type=forking
 
PIDFile=/var/run/ddclient.pid
 
ExecStart=/usr/bin/ddclient
 
  
[Install]
+
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}}:
'''WantedBy=network-online.target'''
 
}}
 
  
{{Note|
+
{{hc|# systemctl edit ddclient.service|2=
* 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.
+
[Unit]
* It may be necessary to configure the network manager to activate {{ic|network-online.target}} (for [[netctl]] see [[netctl#Activate network-online.target]]).
+
After=network-online.target
 +
Wants=network-online.target
 
}}
 
}}
  
=== Other tools ===
+
Additional configuration for {{ic|network-online.target}} may be necessary, see [https://www.freedesktop.org/wiki/Software/systemd/NetworkTarget#cutthecraphowdoimakenetwork.targetworkforme].
 
 
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 ==
 
== 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]].
+
Other 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-DNS ===
 
[https://now-dns.com Now-DNS.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].
 

Revision as of 05:11, 9 October 2018

According to Wikipedia:

Dynamic DNS (DDNS or DynDNS) is a method of automatically updating a name server in the Domain Name System (DNS), often in real time, with the active DDNS configuration of its configured hostnames, addresses or other information.
The term is used to describe two different concepts. The first is "dynamic DNS updating" which refers to systems that are used to update traditional DNS records without manual editing. These mechanisms are explained in RFC 2136, and use the TSIG mechanism to provide security. The second kind of dynamic DNS permits lightweight and immediate updates often using an update client, which do not use the RFC2136 standard for updating DNS records. These clients provide a persistent addressing method for devices that change their location, configuration or IP address frequently.

For RFC2136 there is nsupdate(1) from bind-tools. For dynamic DNS services there are several packages available, see #Update clients.

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).

Update clients

Note that some dynamic DNS providers do not require a dedicated client and can be updated with curl.

Multi-service clients

  • ddclient — Update dynamic DNS entries for accounts on many dynamic DNS services.
https://github.com/ddclient/ddclient || ddclient
  • inadyn-fork — Dynamic DNS client with SSL/TLS support.
http://troglobit.com/inadyn.html || inadyn-forkAUR, inadyn-fork-gitAUR
  • inadyn-mt — A simple dynamic DNS client based on inadyn.
http://inadyn-mt.sourceforge.net/ || inadyn-mtAUR
  • ndyndns — Supports DynDNS and Namecheap.
https://github.com/niklata/ndyndns || ndyndnsAUR

Single-service clients

  • duckdns — Update your DuckDNS.org entries from your computer with systemd.
https://www.duckdns.org/ || duckdnsAUR
  • noip — Dynamic DNS Client Updater for no-ip.com services.
http://www.no-ip.com/downloads.php?page=linux || noipAUR
  • petrified — Bash client to update dynamic DNS at freedns.afraid.org.
https://gitlab.com/troyengel/petrified || petrifiedAUR

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 Config Notes
Now-DNS example
ChangeIP example
Duck DNS example
FreeDNS example
No-IP Use protocol noip, server dynupdate.no-ip.com
nsupdate.info Use protocol dyndns2
Dyn DNS example
Namecheap example
Dynu example
Note: Free users of no-ip are required to manually confirm their domain(s) every 30 days. Domain confirmation is not required for Enhanced users though. More info at Why is My Hostname Pending Deletion?

Use an external website to determine IP address

If ddclient is unable to detect your IP address, you can configure ddclient to fetch your IP from an external webpage such as whatismyip.org. Add somewhere in the config file:

/etc/ddclient/ddclient.conf
# use whatismyip.org to determine IP address
use=web
web=whatismyip.org

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:

# systemctl edit ddclient.service
[Unit]
After=network-online.target
Wants=network-online.target

Additional configuration for network-online.target may be necessary, see [1].

Other providers

Other 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.