I wanted to be able to access my home network from outside the home. My internet connection has a dynamic IP. This means that my home’s IP address on the web can change at any time. So the question is how do you connect to something that is constantly changing location?

The answer is easy, use a Dynamic DNS service. There are a variety of these services: No-IP, DynDNS, zoneedit, FreeDNS, etc. Each of these sites that I’ve listed offers free Dynamic DNS service.

So what is Dynamic DNS? It would probably be best to first define what DNS is and then what makes Dynamic DNS different.

DNS means Domain Name System. It is a way of turning a domain, such as gaarai.com, into an IP address that can be found on the internet.

In other words, without DNS, the domain name gaarai.com is meaningless. However with DNS, gaarai.com actually means 74.53.81.82, the current IP address for the server that hosts this site. It is actually this IP and not the domain name that your browser will connect to in order to get the website content.

This sounds good, but what does all this have to do with Dynamic DNS? Dynamic DNS is essentially the same as regular DNS except that it has an added feature. These services allow a computer from inside a home or office network to send a message to their servers and update the IP when the IP changes.

How does this work? It’s really simple and brilliant really. A program runs on one of the computers inside the network. Every so often, such as every minute to hour depending on setup, the program checks to see what IP the internet connection has. If the IP has changed since the last check, it tells the Dynamic DNS service to update the DNS record to point to the new IP address. And voila! You can now access your network.

For the rest of this post, I will be talking about DynDNS. Not that they are any better than the others, but it is who I chose to work with, thus who I have experience with.

I set up an account at DynDNS.com, logged in, clicked “Add Host Services”, selected a hostname (for example: myhomenetwork.selfip.com), clicked the “Use auto detected IP” link, and then clicked “Create Host”. This took less than five minutes to do and resulted in my very own address that I can use to access my home network. However, I still need to install the software or else my new hostname won’t update when my IP changes.

There are many, many different software packages that can be used to set up the Dynamic DNS service callback on one of your systems. I tried a number of them and found that ddclient was the easiest one to set up and basically requires no maintenance as it automatically starts up each time the computer is started.

I installed ddclient on my home Ubuntu system (Lumière), and installation could not be more simple. I simply loaded up a terminal and ran the following two commands:

sudo apt-get install ssh libio-socket-ssl-perl
sudo apt-get install ddclient

After I pressed “y” to accept the new installation, I was promptly greeted by a wizard of sorts that helped me quickly configure the software. The developer did a terrific job of making this process extremely easy with one exception.

When I looked through the configuration file options, I found that a default configuration option will make this fail for most people. This option causes the software to look at the computer’s IP rather than the network’s internet IP. This means that the update process will not produce the desired result.

Furthermore, by default, the details are sent unencrypted. I’d rather use an SSL channel so that people don’t sniff my username and password details. There are also some other options that I’d like to configure, so let’s get started.

First, open the configuration file.

sudo vi /etc/ddclient.conf

Here is what my conf file contained after the install:

# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf
pid=/var/run/ddclient.pid
protocol=dyndns2
use=if, if=eth0
server=members.dyndns.org
login=USERNAME
password='PASSWORD'
HOSTNAME

My changed conf file looks like the following

# Configuration file for ddclient generated by debconf
#
# /etc/ddclient.conf
pid=/var/run/ddclient.pid
protocol=dyndns2
use=web, web=checkip.dyndns.com/, web-skip='IP Address'
ssl=yes
daemon=300
syslog=yes

server=members.dyndns.org
login=USERNAME
password='PASSWORD'
HOSTNAME

My changes are marked in bold.

  • The line starting with “use=web” tells ddclient to ask CheckIP by DynDNS what my network’s IP is.
  • ssl=yes” has ddclient use a secure connection to send updates to DynDNS.
  • daemon=300” tells ddclient how often to update in seconds. 300 seconds is 5 minutes. This is the default setting, but I put it here so you’d know how to easily change it.
  • syslog=yes” tells ddclient to log update results (note that it only logs when something has changed, not just each time it runs) to /var/log/syslog. Having this log not only helps keep track of how well the software is working, but can also be used to tell how often the IP changes, which I find interesting.

After making the change to the configuration file, ddclient needs to be restarted so that the changes take effect.

sudo service ddclient restart

After I ran this, I checked my /var/log/syslog file and found the following:

ddclient[18479]: SUCCESS: updating HOSTNAME: good: IP address set to IPADDRESS

Some of you may wonder what the value of this is. Some possible applications are:

  • Connecting to one or more machines via SSH. This allows you to have complete access to your machine via the command line. It also allows you to have full access to your files on that system and to shared network resources.
  • If you are running an email server out of your home/office, Dynamic DNS not only allows email to be properly routed to the mail server but also allows you to connect to it from outside.
  • You can also now run a web server on your network and be able to access the content while away.
  • There are many other reasons why people would want to take advantage of this service. It all depends on who you are and what you use your systems for.

I intend to create a tutorial or two talking about how to set all of this up since it requires changing router configuration, firewall setup on your system, and adding services to your system that you may not currently have. If there is a specific application that you’d like me to focus on first, please let me know in the comments.

Did I help you?