Difference between revisions of "Dynamic DNS"

From ArchWiki
Jump to: navigation, search
(Afraid and Now-IP: rm afraid. already mentioned in ddclient section and has no clear connection to now-ip)
(DNSdynamic: rm, already mentioned in ddclient)
Line 83: Line 83:
 
===  Now-IP ===
 
===  Now-IP ===
 
[https://now-ip.com Now-IP.com] is a free service which is easy and uncomplicated to set up.
 
[https://now-ip.com Now-IP.com] is a free service which is easy and uncomplicated to set up.
 
=== DNSdynamic ===
 
 
[http://www.dnsdynamic.org/ DNSdynamic] "will always be absolutely free" and works with {{Pkg|ddclient}}. [https://www.dnsdynamic.org/api.php This page] has information on how to configure {{Pkg|ddclient}}.
 
  
 
=== duiadns ===  
 
=== duiadns ===  

Revision as of 02:47, 27 January 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.

DDNS 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, available in the community repository, 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 Records Hostname Limit Config Notes Alternative tools
ChangeIP Free or paid A, AAAA, CNAME, MX, codomains 7 free
DNSdynamic Free example
Duck DNS Free 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-mt
inadyn-mtAUR. Supported providers listed here.
ndyndns
ndyndnsAUR. Supports DynDNS and Namecheap.

Dynamic DNS Providers

There are many different DDNS providers and some are supported by official or third-party tools. A partial list is given below. Many of these providers are also supported by the generic tools listed in the section below.


Now-IP

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

duiadns

Duiadns.org. The package duiadnsAUR[broken link: archived in aur-mirror] is available in the AUR.

No-IP

noipAUR is a dynamic DNS client updater for no-ip.com services.

Configure the client by running

# noip2 -C

See noip2 -h for more options. Start noip2.service to run the host updater and enable it to run automatically at boot.

nsupdate.info

nsupdate.info is a free and open source dynamic DNS service. One can use inadyn-forkAUR to update the ip. An example configuration:

/etc/inadyn.conf
background
verbose        5
period         300
cache-dir      /mnt/ddns
startup-delay  60
syslog

#logfile /var/log/ddns.log
#pidfile /var/run/ddns.pid

system ipv4@nsupdate.info
	ssl
	username your_host_name.nsupdate.info
	password PassWoRd_given_on_site
	alias your_host_name.nsupdate.info

You should then start inadyn.service and enable it to automatically start on boot.

System-NS

System-NS free DNS service. It can be configured to update using a cron script through the following steps. Make a directory and create a script file within it:

$ cd ~
$ mkdir systemns
$ cd systemns
$ vi systemns.sh

Put the following text in systemns.sh. You should change the domain and token parameters.

#!/bin/bash
wget -q -O- --post-data "type=dynamic&domain=mydomain.system-ns.net&command=set&token=880078764367979fe765c0fa3f4efff1" http://system-ns.com/api | grep -v '"code":0' | awk '{print d, $0}' "d=$(date)" >> ~/systemns/systemns.log

Make the systemns.sh file executable.

$ chmod +x systemns.sh

Open crontab.

$ crontab -e

Put this text in the crontab (run every 5 minutes)

*/5 * * * * ~/systemns/systemns.sh

DuckDNS

duckdnsAUR is a dynamic DNS client updater for DuckDNS.org services. After installation go to your /etc/duckdns.d and copy/edit the default.cfg. Just enter the hostname and token you received from DuckDNS. Any file ending on .cfg will be read by the script and used to contact the DuckDNS services. The script also writes debug messages to logger.

Do not forget to enable the duckdns.timer so your IP will be updated every 5 minutes.

FreeDns.io

FreeDns.io is a dynamic DNS provider. They provide free A and AAAA DNS records for free, and optionally you can apply for a Premium account which includes CNAME, TXT and MX records.

They provide an API which can be called from a script written in any of the most used programming languages, including PHP, Python and Ruby. Samples might be reached here. Once chosen and copied to the machine which will update the host, a cron-job should be created in this form:

*/5 * * * * ~/update-my-freedns-host

(Assuming the ~/update-my-freedns-host script has execution permissions)

This provider allows up to 60 requests per hour, so even a cron-job run every minute is ok, because if your IP doesn’t change in two consecutive requests, it’s not considered a “hit”.

ChangeIP

ChangeIP.com provides free A, AAAA, CNAME, MX, URL DNS records, you can also apply for free codomain like {ic|git.example.changeip.com} and many more.

They provide easy api such as {ic|curl -u 'user:pass' https://nic.ChangeIP.com/nic/update}.