Dynamic DNS server

This software provides a cheap dynamic DNS solution for anyone with a Linux VPS (or a friend who is willing to share one).

I occasionally want to access my home PC while I’m away from home, but my ISP doesn’t offer static IP addressing.  Thanks to a resurgence in the popularity of virtualisation, servers are extremely cheap to rent nowadays (as little as £3/month).  In addition to the server hosting this website (and others), I run a DNS nameserver (using PowerDNS) on one of my other virtual servers.  With this simple BASH script and a web interface, my server gained dynamic DNS capabilities and allows me to access my home PC despite the varying IP address.

The packaged script and web interface run on the nameserver, and a separate script is run on the target machine (in my case, the home PC), which curl’s the web interface periodically to update the necessary A-record.  It is important for the A-record to have a small TTL value (e.g. 60 seconds), in order to allow updates to propagate through DNS caches at a reasonable speed.  Look at the code for the PHP web interface to understand the syntax for the CURL request.

Rather than leave the home PC on 24/7 and waste electricity, I also created a remote interface to dispatch wake-on-lan packets.

Download: Dynamic DNS scripts
Latest version (github): battlesnake/ddns

2 thoughts on “Dynamic DNS server

  1. Pingback: Wake-on-lan remote interface | Hackology

  2. Pingback: Reverse tunnel to SSH a machine through NAT/firewalls

Leave a Reply

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