Dynamic DNS—an Object Lesson in Problem Solving
The other day in the Linux Journal IRC room (#linuxjournal on Freenode), I was whining to the channel about no-ip.com deleting my account without warning. My home IP address hadn't changed in a couple months, and because there was no update, it appeared abandoned. The problem was, although the IP address hadn't changed, I was using the Dynamic DNS domain name to connect to my house. When the account was deleted, the domain name wouldn't resolve, and I couldn't connect to my house anymore.
The folks in the IRC channel were very helpful in recommending alternate
Dynamic DNS hosting services, and although there are still a few free
options out there, I was frustrated by relying on someone else to manage
my DNS services. So, like any nerd, I tried to figure out a way to host
a Dynamic DNS service on my own. I thought it would be a simple
install on my colocated server, but it turns out there's not a simple
Dynamic DNS server package out there—at least, not one I could find. So,
again like any particularly nerdy nerd, I decided to roll my own. It's
not elegant, it's not pretty, and it's really just a bunch of cheap hacks.
But, it's a great example of solving a problem using existing tools,
so in this article, I explain the process.
First, it's important to point out a few things. The purpose of this article is not really to explain the best way to make a self-hosted Dynamic DNS system. In fact, there probably are a dozen better ways to do the same thing. That's sort of the point. The more familiar you are with Linux tools, the more resourceful you can be when it comes to problem solving. I go through the steps I took, and hopefully most readers can take my method and improve on it several times over. That type of collaboration is what makes the Open Source community so great! Let's get started.
My Particular Toolbox
We all have a slightly different bag of tricks. I'm in the "extremely lucky" category, thanks to Kyle Rankin tipping me off about the free Raspberry Pi colocation service. A full-blown Linux box with a static IP on the Internet is truly the sonic screwdriver when it comes to these sorts of things, but perhaps someone else's solution won't require a complete server.
Along with the Raspberry Pi server, I have a Linux server at home, a home router and a handful of domains I own. I also have accounts on several Web hosting servers, and accounts with cloud-based storage like Dropbox, Google Drive and a handful of others.
First Problem—What's My IP?
The beauty of Dynamic DNS hosting is that regardless of what your home IP address is, the same domain name will resolve even if it changes. Granted, my home IP address hadn't changed for months, but I still used the DNS name to access it. Therefore, when my account at no-ip.com was deleted, I had no way to tell what my home IP was.
There are plenty of sites on the Internet that will return your IP address. Because I just had my Dynamic DNS account deleted, I really didn't want to depend on a free on-line service for detecting my IP address. Thankfully, this piece of the puzzle was simple. A few lines of PHP hosted on any Web host that supports PHP is all it takes. For example, my IP detection script is hosted at http://snar.co/ip (my personal domain—feel free to use it). See it in action in Figure 1. It contains nothing more than this:
<?php // Save the IP to a variable $ip_address = $_SERVER['REMOTE_ADDR']; // To display the IP: echo $ip_address; ?>
Figure 1. Unlike many "what is my IP" services, my script returns nothing but an IP address.
The frustrating part is that although I had a way to detect my IP address at home, I wasn't actually at home, so I had a catch-22 situation. Thankfully, my wife was home. I texted her and asked her to visit my snar.co address and let me know the IP address she got back. Once I had that IP address, I could connect to my home server and set up some automation.
Practical Task Scheduling Deployment
July 20, 2016 12:00 pm CDT
One of the best things about the UNIX environment (aside from being stable and efficient) is the vast array of software tools available to help you do your job. Traditionally, a UNIX tool does only one thing, but does that one thing very well. For example, grep is very easy to use and can search vast amounts of data quickly. The find tool can find a particular file or files based on all kinds of criteria. It's pretty easy to string these tools together to build even more powerful tools, such as a tool that finds all of the .log files in the /home directory and searches each one for a particular entry. This erector-set mentality allows UNIX system administrators to seem to always have the right tool for the job.
Cron traditionally has been considered another such a tool for job scheduling, but is it enough? This webinar considers that very question. The first part builds on a previous Geek Guide, Beyond Cron, and briefly describes how to know when it might be time to consider upgrading your job scheduling infrastructure. The second part presents an actual planning and implementation framework.
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.Register Now!
- Stunnel Security for Oracle
- SourceClear Open
- SUSE LLC's SUSE Manager
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- My +1 Sword of Productivity
- Managing Linux Using Puppet
- Non-Linux FOSS: Caffeine!
- Tech Tip: Really Simple HTTP Server with Python
- Google's SwiftShader Released
- Doing for User Space What We Did for Kernel Space
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide