If you have services running inside your home network, like a web server or file server, or you want to be able to access your home network while away (for example, over SSH), it’s useful to have a domain name so you don’t have to remember your home IP address. This guide will show you how, for free, to get your own domain name, and keep it active even if you have a dynamically allocated IP address.
Step 1. Get a DynDNS account.
The first thing you’re going to have to do is get an account at DynDNS. I’ve been using DynDNS for years because they’re incredibly reliable, the service is fast, and most importantly, it’s free. They have a huge list of domain names to choose from, so you can pick something easy for you to remember.
Setting up an account is easy; there’s the standard stuff, like picking your user name and password, and then you select your domain name, and it will automatically associate it with your IP address.
Step 2. Installing ddclient
This step is critical, because it will keep your DynDNS account active, and it will keep your domain name associated with your IP address even when your ISP changes your IP (assuming you aren’t lucky enough to have a static IP address). In debian-based distributions, such as Ubuntu, install ddclient with the command:
This will install ddclient, and now all that there’s left to do is configure it…
Step 3. How to Configure ddclient
Now that ddclient is installed, you need to set it up to work with your DynDNS account and your router (so it can find your outside IP address). The configuration file is located at /etc/ddclient.conf, and you’ll need to be root to modify it (or even read it, since it contains a plain-text password). Run the command:
And your text editor will open the configuration file, which will contain these lines:
pid=/var/run/ddclient.pid protocol=dyndns2 use=if, if=eth0 server=members.dyndns.org login=[your login] password='[your password]' [your domain name]
We’re interested in the use line, which you should set to your router type. To find the correct configuration, run:
For example, I run:
and find that the appropriate “use” line for my router model is netgear-rp614. So, in my /etc/ddclient.conf, I change the use line to:
Finally, we need to add a line to let ddclient know where our router is located. On my network, the router’s address is 192.168.0.1, so I add the line:
Where “fw” stands for “firewall.” That’s it! Save your ddclient.conf file, and run:
which will restart ddclient with the new configuration.
That’s it! Now your home network will be accessable through whatever domain name you chose, and you can access your file server, web server, or any other services from anywhere, over the internet; all without having to remember your IP address!