Get a Free Domain for your Home Network with “ddclient and dyndns” on Linux March 10, 2011Posted by Tournas Dimitrios in Uncategorized.
If you have services running inside your home network, like a web server or file server, probably you want to be able to access your home network from your office (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 to get , for free , your own domain name, and keep it active even if you have a dynamically allocated IP address. This article assumes that you are already familiar with concepts like port-forwarding , NAT , LAN and of course how to set-up basic network services like web , SSH and FTP .
- Enabling port-forwaring on your router (gateway) :
Check your router’s documentation and see what you need to do to forward ports to the machine you want to appear on the internet. Most likely you want to run a web server or ssh server. In our example we’ll assume you want to be able to ssh in to your network to access files you have at home with sftp. You’ll need to find out how to make your router accept connections on port 22 and forward those connections to the private address on your LAN for the target machine. Visit this good on-line reference for port-forwarding (probably your router is in the list).
- Verify that your router is correctly forwarding the services you are interested :
Visit this website and check that your services are accessible from the Internet . Specify your services by it’s port number : web –> 80 , SSH –>22 etc… Caution some ISP ‘s (Internet Service Providers ) are blocking basic ports like 80 , 22 , 21 , so you have to configure the service on an alternative port . For example the web-server on port 8080 .
- Get a DynDNS account.
The first thing you 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.
Write on a paper the login name – login password and Domain name you have created on Dyndns.org . Later on you will need these information to configure your DDNS client .
- Configuring DDNS (dynamic DNS):
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) . These days many routers have this functionality embedded , and with a few click it can be enabled . For example my Baudtec TW263 has DDNS .
Of course , Linux has for everything an alternative solution 🙂 . A small and very easy to configure solution for DDNS is ddclient .
If EPEL is on the repository list of CentOs 5.x , yum will automate the installation process :yum install ddclient
The configuration file for ddclient is in /etc/ddclient.conf . Although this file contains 162 lines , many of these lines are just comments to guide you how to configure the ddclient daemon . In my case , I made the configurations according to my Bautec router . But the concepts remain the same for all routers .
First make a back-up of the original configuration file , in case we mess things .
cp /etc/ddclient.conf /etc/ddclient.conf.original
Now enable line numbering on your favorite editor . My editor is Vim , so enabling line numbering can made with [[ echo “set number ” > .vimrc ]] , and restarting the editor . If you need to compare your configurations with the configurations I made , then download this file , or visit Dyndns.com and generate your custom ddclient config file .
Un-comment the following lines :
- 35 –> In my case Linksys is the most closed related to Bautec
- 47 –> What is the login name/password of your router
- 53 –> From where will ddclient obtain your current WAN – IP address .
- 59 –> What protocol is used during communications with DDNS provider
- 61 –> What is the Domain name of your DDNS server
- 64 –> What is your login name on the DDNS server (see previous step )
- 65 –> What is your login password on the DDNS server
- 75 –> What is your DDNS server
- 76 –> What is the protocol used
- 77 –> What Domain name had you created on previous step .
That’s is … Just enable ddclient to start on each reboot and start the daemon :
- chkconfig –levels 35 ddclient on
- service ddclient start
- Verify that your Domain name is working :
- Call your best friend and ask him : ” Hey Jim , open your browser and navigate to my web-server , my domain is ” http://mynewdomain.dyndns.org “
- Or use one of the many free available proxy servers on the Internet . My favorite is this one .
Let’s pretend the following scenario : Your ISP has blocked port 80 , so you configured your web-server to listen on port 8080 and of course the port-forwarding on your router is also configured on port 8080 . If you want to access a web-page (on the root folder) with the name “myresume.html” , then the navigation will be as follows :