LowEndBox - Cheap VPS, Hosting and Dedicated Server Deals

How Do You Self-Host From Home When Your ISP Gives You a Dynamic IP?

Dynamic DNSWe mostly cover DIY projects involving VPS systems or dedicated servers.  But there are people who want to host services at home.  They may have spare capacity at home, a service that is plugged into other systems at home, or just don’t see the need to buy a VM when they have a perfectly good internet connection sitting 99% unused.

Most ISPs, however, provide you with a dynamic IP.  For example, my Xfinity broadband IP rarely changes, but there’s no guarantee it couldn’t change its IP address five seconds from now.  In fact, just yesterday we had an Internet outage that lasted about 10 mins or so (just long enough for a teenager to bemoan the lack of Internet access).  When it came back, my IP was different than it had been.

If you’re running a service that needs to connect to your home, you’ll need a way to setup a DNS entry that changes as your home IP changes.

Option #1: ddns-updater

One option is to use a “Lightweight universal DDNS Updater program” called ddns-updater.  I think their idea of “lightweight” is vastly different than mine, given that this program comes with a desktop and mobile web UI, support for dozens of DNS services, and 27 environment variables.

But it seems popular, so I’m mentioning it.

Option #2: A One-Liner in Cron

Personally, I use afraid.org’s dynamic DNS service because you can update your DNS record in a single one-line cron job.  afraid.org’s DNS is free, though you can support them with a paid account.

Register for an account, login, and head over to Subdomains.  Setup a record using one of afraid.org’s whimsical choices, such as chickenkiller.com, crabdance.com, strangled.net, etc…or one of 44,000 other domains you can subdomain off.

Yes, you can be lowendbox-is-my-life.jumpingcrab.com if you want.  I mean, I haven’t checked that that specific subdomain is available, but it probably is.  Create your A record.

Next, click on Dynamic DNS on the left-hand menu.

You’ll see a lot of explanatory language and notes to clients and scripts.  You’ll see there are an astonishing number of ways to update your afraid.org dynamic DNS.  You can login and do it through the web, use a username:password URL, use wget, or use curl.  We’re going to use wget, and we’re going to use it in the laziest way possible.

At the very bottom of the page, click on “quick cron example”:

afraid.org detail

You’ll be taken to a text file which includes many lines of comments and commented-out examples.  But the two uncommented lines are what you want to look at:

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin

This line is important because cron notoriously has a very bare-bones environment and various needed binaries won’t be found.

2,7,12,17,22,27,32,37,42,47,52,57 * * * * sleep 8 ; \
wget --no-check-certificate -O - https://freedns.afraid.org/dynamic/update.php?XXX >> /tmp/example.log 2>&1 &

(The “\” denotes a line break to make it read easier on our web site).

The XXX above is a placeholder for a long auth string that is unique to you.

This line needs some parsing, and a bit of improvement.

The time specification may look funky – and yours will probably be different, with a different sleep.  I believe these are randomly generated to spread out the load from millions of clients around the world.  It’s interesting that updating every 5 minutes 24x7x365 is the expected norm.

Rather than this:

wget --no-check-certificate -O - https://freedns.afraid.org/dynamic/update.php?XXX >> /tmp/example.log 2>&1 &

I prefer this:

MAILTO=me@example.com
2,7,12,17,22,27,32,37,42,47,52,57 * * * * sleep 8 ; \
wget --no-check-certificate -O - https://freedns.afraid.org/dynamic/update.php?XXX >> /tmp/example.log

There are two reasons for this:

  1. Having an ampersand on this command doesn’t make any sense.  There’s no need to put a cron command “in the background” because it’s already in the background by definition.
  2. Setting the MAILTO various will put ALL output by jobs to that email address.  In this case, we’re redirecting ho-hum standard-routine messages to a log file (which could also be /dev/null), but any error messages will still be printed, and hence come to my email.  I don’t care if everything’s working fine, but I do want to know if it is failing.

And that’s it.  This job will run every 5 minutes (or whatever you specify) and keep your Dynamic DNS updated.  Enjoy!

1 Comment

  1. Raul:

    I’ve been using noip.com for DDNS, and it’s been working great.

    June 18, 2025 @ 2:40 pm | Reply

Leave a Reply

Some notes on commenting on LowEndBox:

  • Do not use LowEndBox for support issues. Go to your hosting provider and issue a ticket there. Coming here saying "my VPS is down, what do I do?!" will only have your comments removed.
  • Akismet is used for spam detection. Some comments may be held temporarily for manual approval.
  • Use <pre>...</pre> to quote the output from your terminal/console, or consider using a pastebin service.

Your email address will not be published. Required fields are marked *