Dynamic DNS

It's impractical to run your own DNS servers if your IP address is dynamic changes. Even if you wanted to pay for a static address, you're probably better off taking advantage of someone else's infrastructure if you can. Many top tier hosting companies are giving away DNS services for free anyway, so pick a provider and install a client.

The Service Provider
As with many things, there are two parts; the Service Provider and the Client. Here's a good list of them. I've used editDNS and subsequently ZoneEdit and also NameCheap, the latter being now free.

    http://www.gnutomorrow.com/best-free-dynamic-dns-services-in-2013/

The Client

For Ubuntu, the most used client for ddns seems to be ddclient.  The instructions are at  http://help.ubuntu.com/community/DynamicDNS or, after installing you can enter ddclient -help for the most up-to-date info on the client



sudo DEBIAN_FRONTEND=noninteractive apt install -y ddclient


sudo vi /etc/ddclient.conf

# General Options
verbose=yes
ssl=yes
use=web, web=checkip.dyndns.com/, web-skip='IP Address'

# NameCheap Options, some.domain.name is the example
protocol=namecheap
login=DOMAIN.NAME
password=XXXXXXX
HOSTNAME


sudo vi /etc/default/ddclient.conf

run_daemon="true"


sudo ddclient -foreground

Advanced Client Useage


An advanced use case is one where you have multiple address to maintain, such as when combining openvpn and dyndns. Below is a an example configuration that accomplishes this by retrieving the external IP using a web service, and the internal IP from the local eth0.

sudo vim /etc/ddclient.conf

ssl=yes
protocol=zoneedit1
use=web, web=checkip.dyndns.com/, web-skip='IP Address', server=dynamic.zoneedit.com, login=YourLogin, password='YourPassword' external.gattis.org
use=if, if=eth0, ssl=yes, server=dynamic.zoneedit.com, login=YourLogin, password='YourPassword' internal.gattis.org

The placing of commas are important. When using two host updates, there seems to be no output so to debug:

sudo ddclient -daemon=0 -debug -verbose -noquiet

Alternatives

 For some providers, such as zoneedit, you can use a simple curl script, or even a one-liner in cron.

curl -s -u user_name:password https://dynamic.zoneedit.com/auth/dynamic.html?host=host.domain.org


Sources:
http://ascending.wordpress.com/2011/02/04/advanced-dynamic-dns-with-ddclient/
http://permalink.gmane.org/gmane.network.dns.ddclient.user/17

Comments