setting up a dyndns service with route53
I’ve been using dyndns for years to be able to get back to my home IP for years. I recently discovered that they have discontinued the free version of the service. To be exact, if you have a free account, it will keep working as long as it doesn’t expire, and that’s probably why it took me so long to find out about it.
I took this as an opportunity to see how I could implement a similar service in a more DIY way. I searched around and I noticed that many people have been using amazon route53 to do what I wanted.
I started from this post (make sure you read it, it’s more detailed than my post in some points) and after some modifications, I have a working solution I’m pretty happy with. It’s not free, route53 is a payed service, but it will probably cost me only some cents per month.
The following assumes you have an amazon AWS account and you have a domain setup to use route53 for DNS (I will use example.com as an example).
Here are the steps I followed to set up my debian server.
First, install boto.
sudo pip install boto
Make sure you edit ~/.boto and add your AWS credentials.
Then install my modified Area53 module. It’s a fork of the original module with TXT records support (more on this later).
sudo pip install git+https://github.com/vrypan/Area53.git
sudo pip install requests
Download this script and edit it. All you have to edit is the domain and subdomain variables. Let’s say that domain=‘example.com’ and subdomain=‘homeip’.
Run the script,
and check your domain.
dig any homeip.example.com
You should get something like this
homeip.example.com. 900 IN TXT "Last update 2012-12-20 13:48." homeip.example.com. 900 IN A 192.168.2.3
The reason we are using my version of Area53 is the TXT record. I wanted to have an indication of the last time the IP changed, and I fugured that a TXT record would be perfect, so I had to add support for TXT records to Area53.
Now, if this works for you, make sure you add an entry to crontab, something like this (it’s one line)
0,15,30,45 * * * * unixusername python /path/to/script/dyndns.py
I run the script every 15 minutes, as this seemed a reasonable amount of time. Depending on how often your ISP assigned IP changes, you may decide to run it more or less often. (In this case, you may also change the A and TXT records TTL that is set to 900 seconds in the script).
That’s it. Now, you can always reach your home router at homeip.example.com.