Jul 282013
 

Article By Oussama Krifa

Accessing your home computer (I’ll call it server on this article) from a remote location (that I’ll call client) outside the local network, can be very interesting, for example, listening to streaming music played by MPD, managing downloads in the bittorrent client Transmission through its web interface, controlling the machine via SSH … However, before accessing your server remotely, you must know the “address” or IP (Internet Protocol address), but generally at home they are provided dynamically, through the Internet Service Provider, so it’s not so easy to know the IP of your home server.
We will see how to automatically update the DNS name on a domain name server (DynDNS) with the current IP address of the server thanks to ddclient.

Domain Name

We’ll start by creating a “domain name” with one of the services supported by ddclient, namely DynDNS that allows you to create two free “hostnames”.

dyndns

First, you can enter the name of the subdomain you want and select the desired main domain. So you get an address such as hometest.dyndns.org

Regarding the desired service, it is a Host with IP address. In the IP Address field, just logically click on the link below, which shows your address, provided that you do this operation from the station you want to make accessible from outside. You can proceed to the next step by clicking on the Add To Cart button that sends you to a registration form. Once you have registered and validation of your domain, you should be able to connect to your server from a client machine (via your browser) to the address you have chosen in our example hometest.dyndns.org.

However, the IP address of your server changes on a regular basis and it is therefore necessary to update, at each change, our DynDNS profile. This is where the role of ddclient comes.

Installing and configuring ddclient:

We’ll install ddclient on the server. On Ubuntu, the installation is done by running the following command:

sudo apt-get install ddclient

During installation, you have to configure the ddclient through multiple “screens” where you can just confirm by pressing the Enter key and use the Space key to select an option from a list of choices.

In the first screen, choose www.dyndns.com, then set the identifier and the password. After that it will ask whether to search the IP with checkup.dyndns.com, say No. Then choose your active network interface (if you are not sure, type ifconfig in a terminal to figure it out). Then Choose “From a list” and your “hostname” will appear, select it and proceed to the next screen. Say No for Launching ddclient during PPP connection, then choose yes to start ddclient as daemon. This is the option that allows you to automate the updating of the IP address in your DynDNS profile: the ddclient service is launched at server startup and runs at regular intervals, which we are going to configure in the last screen. Choose an interval like 3m (three minutes), 2h (two hours) or 1d (one day).

If you need to return later to configure ddclient and want to benefit from this “assistant”, simply run the command:

sudo dpkg-reconfigure ddclient

You can also change the configuration of ddclient directly by editing the /etc/ddclient.conf and add options, for more details refer to the documentation (http://sourceforge.net/apps/trac/ddclient/wiki/Usage)

Please note that to access the services running on your server, you need to forward ports in the configuration space of your box/router though.

Conclusion:

Now that you have configured you server, you can use it in several purposes such as SSH access or bittorrent web-client “Transmission” remote control.


Popular Posts:

flattr this!

  6 Responses to “DynDNS and ddclient: access your Linux from anywhere”

  1. Question: will this technique let me have remote access to my desktop (gui)? If so, that would be sooo handy!

    Thanks for the article.

    Dave,

    • Hello Dave,
      You must configure your desktop to allow remote conenctions, after that yes you should be able to conenct to it.

      Best regards

  2. I prefer no-ip.org as a straightforward FREE service for entry level users. dyndns.org used to be similar but now simple free hosting seems unavailable or buried.
    (I have no affiliation to either).

  3. Cool tutorial. Thanks for using our dynamic DNS service.

  4. When I check about a free account on DynDNS I find articles dating back to 2011 saying they have discontinued new free accounts. Makes me wonder when this article was written.

    john

  5. We used to use DynDNS but dropped it after it became a PITA to maintain a free account. We now use the dynamic DNS service at http://freedns.afraid.org/ which is still truly free. Have had no problems with it so far, except that when trying to set up the auto-update in a DD-WRT based router, it tried to grab the key but missed the last few characters, so I had to enter those manually (you’ll understand what I am talking about and why this is not an obvious issue if you try to set it up in the DDNS section of DD-WRT). Once I got the complete key entered it worked perfectly and has done so ever since. This is a minor bug in DD-WRT, and not a problem with the DNS service.

 Leave a Reply

(required)

(required)


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>