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.
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”.
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.
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.
- Linux Terminal: An lsof Primer
- How to check if you are vulnerable to shellshock
- Ripping DVD with Handbrake on Linux
- Linux: Timeouting commands in shell scripts
- Switching to Linux, Checklist
Find me on Google+