home January 01, 2017

ddclient examples


Dyndns.org or NameCheap.com

Dyndns.org and NameCheap.com (namecheap uses freedns) offers a completely free service that allows one to update a custom dyndns host name with your home dynamic IP address like what you receive on the comcast or verizon networks. This will allow you to give out a host name like "calomel.gotdns.org" to friends, family or colleagues pointing to your dynamic IP your use for home. Now you won't have to remember the IP of your machine and you do not care if it changes as you always have the dyndns host name to point to.

Getting Started

First, take a look at Dyndns.org and FreeDNS to decided which service you like. We have included exampels for both services in the ddclient.conf file found below. Always make an informed decision.

It should take you no more than five minutes to register for the service of your choice. Remember you do not have to pay anything and no one gets any credit or recognition for your visit. Once registered you need to choose a host name you want to use. They have many base domains to choose from. For our example we will be using "calomel.gotdns.org". Remember to note your username and password you registered with.

Once signed up you need to decide how your ip is going to get updated and pushed to Dyndns. Option 1: If you have Linksys or Netgear router then you can check in the documentation included with the device for "Dynamic DNS" update compatibilities. The dyndns server is really easy to setup in one of these devices and should take you less than an hour to read the docs and put in the information like username, password, and host name you registered to Dyndns with.

Option 2: If you have a Linux or BSD based firewall then you could use a package called "ddclient" and configure one file called ddclient.conf . Once the package is installed you need only fill out the ddclient.conf file and start the service. The ddclient daemon will read the IP of the interface you specified and send it to the dyndns.org servers.

HELPFUL HINT: If you want a simpiler solution then ddclient, take a look at our fast and secure Dynamic DNS Client Perl Script.

The config file called ddclient.conf

If you have decided to use ddclient then take a look at the following config file.

daemon=3600 will check to see if your ip has changed once every hour or 3600 seconds.

syslog=yes logs all messages to syslog

mail=root and mail-failure=root will mail all changes and errors to root.

proxy=proxy.server.com:8080 If you use a proxy server like Squid to get out of you network then uncomment the proxy line and set it to the IP and port of the proxy server.

ssl=yes SSL updates are available to you if you use ddclient version 3.7.0 or above. This means that your username, password and host information will no longer be in clear text when you send updates to the DynDNS server. (Recommended)

use=if, if=fxp0 Set the "if=" directive to the interface you want ddclient to look at when it pools the IP address. Our IP is on the the "fxp0" interface.

Enter the USERNAME and PASSWD you registered with DynDns.org.

wildcard=no The wildcard directive is there if you want to allow all hosts that point to *.calomel.gotdns.org to point to your machine. For example, you might want anyone who types in a random abc123.calomel.gotdns.org to goto your IP. For our example we do not want that type of traffic.

server=members.dyndns.org and protocol=dyndns2 The server and protocol are static and you do not have to update them. They are the defaults supplied and preferred by the DynDns servers.

mx=calomel.gotdns.org The "mx" line is there if you want mail that is destined for your new dynamic host name to goto your machine. if you are going to setup a mail server or a spamd daemon on port 25 or the SMTP port then you may want to enable the mx argument. If you leave it in, even if you do not have anything listening on the mail port 25 it will not hurt anything.

The few last lines are the host name you will be registering as:

Below in the scrollable text window is a fully working ddclient.conf file. You are welcome to copy/paste it.

############################################
#### moneyslow.com  ddclient.conf   BEGIN
############################################
 
 daemon=3600                 # check every x seconds
 syslog=yes                  # log update msgs to syslog
 mail=root                   # mail all msgs to root
 mail-failure=root           # mail failed update msgs to root
 pid=/var/run/ddclient.pid   # record PID in file.
#proxy=proxy.server.com:8080 # local proxy server (do not use with ssl)
#ssl=yes                     # ddclient 3.7.0 and above support ssl updates
 use=if, if=fxp0             # via interfaces

 login=USERNAME              # default login
 password=PASSWD             # default password
 wildcard=no                 # add wildcard CNAME? (anything_string_matches.your_host.org)

 ## Option 1: free dyndns.org dynamic addresses
 # server=members.dyndns.org, \
 # protocol=dyndns2           \
 # mx=calomel.gotdns.org      \
 # calomel.gotdns.org

 ## Option 2: Pay for CUSTOM dyndns.org dynamic addresses
 # server=members.dyndns.org,     \
 # protocol=dyndns2,              \
 # custom=yes, your_host.org, mail.your_host.org, www.your_host.org

 ## Option 3: Config for namecheap.com. Instead of dyndns,
 ## namecheap.com uses freedns which is completly free.
 # protocol=namecheap
 # server=dynamicdns.park-your-domain.com
 # login=your_host.org
 # password=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
 # @

############################################
#### moneyslow.com  ddclient.conf   END
############################################

Start the daemon

Once you have the ddclient.conf in place you can start the ddclient daemon. To start the daemon you can simply type "ddclient". You also want to make sure ddclient starts at boot up so you can use the following line and place it in /etc/rc.local .

  # ddclient
  if [ -x /usr/local/sbin/ddclient ]; then
     echo -n ' ddclient'; /usr/local/sbin/ddclient
  fi

Questions?

How often can I send updates to DynDNS.org?The general rule is to not send updates to the dyndns servers more than once per fifteen minutes to be safe. If you abuse their free service they will delete your account. Keep in mind that the "daemon" directive in the ddclient.conf file is the amount of time ddclient will check your local IP. Ddclient will only contact dyndns if the IP changes. If you set the "daemon" directive to one minute that will allow ddclient to look at your interface every minute. Only if the IP changes will ddclient make a connection to DynDns.org. You can of course force an update to dyndns with "ddclient -force" and this will send the IP even if it has not changed. Sending updates for an IP that has not changed is considered abusive.

I already have a registered host name and I want to use DynDns to point it to my machine?If you already have a free DynDns account you need to add an additional service. The service is Custom DNS service for one zone. It will cost $25 per year. Once you sign up for this through DynDns you need to log into your domain registrar who you registered your domain with. There you need to edit your account and replace the registrar's DNS servers with the two from dyndns called "ns1.mydyndns.org" and "ns2.mydyndns.org". For even more information about the "custom dns" service check out their FAQ at DynDns.org Custom Dns.