Dynamic IP Workaround
#If you rely on remote access to your home computer but cannot be bothered with having to record your external IP each time then you can use DynDNS or No-IP, but they rely on installing their own tools to update their systems, and in some cases, want you to pay for the service. I have found a (somewhat convoluted) way of an alternative means, which should work under most Linux environments.
- Install the packages "at" and "grive" (at allows you to schedule tasks from command line with simple timing syntax. Grive is a console-based Google Drive syncing tool) -- note, however, that grive may not be present in all repositories.
- Setup Grive.
- Add this script to the grive directory and name it externalIP.sh:
IP=
wget -q -O - checkip.dyndns.org|sed -e ’s/.Current IP Address: //' -e ’s/<.$//'
HOST=host $IP | cut -d ' ' -f5
echo $IP $HOST | tee externalIP.txt
grive
echo ‘cd {path-to-your-grive-folder};./externalIP.sh’ | at now + 2 hours
- Make the script executable
chmod +x externalIP.sh
- Run the script ONCE
$ ./externalIP.sh XX.X.XXX.XXX your-hostname. Reading local directories Synchronizing folders Reading remote server file list Detecting changes from last sync Synchronizing files sync "./externalIP.txt" doesn't exist in server, uploading Finished! warning: commands will be executed using /bin/sh job 278 at Tue May 6 22:48:00 2014
What the script does is determine the external IP address of your machine, do a reverse lookup on it, write the results to a text file, then sync it with Google Drive. What you can do is read the text file (externalIP.txt) off your Google Drive storage via the web interface at http://drive.google.com, and you can then access it remotely, using either the IP or the hostname. The last line schedules the script to be run again in two hours from now (in case your IP address changes), this is the “job 278” line.
It should also be noted that the scheduling carries on between reboots.
Related articles
