Last night I realised some of the DNS servers I use for my domains weren't responding to requests. I initially thought it was my webserver, but Google Chrome kept saying "resolving host" and a quick nslookup revealed that the nameservers weren't replying.
My DNS is hosted with ZoneEdit, who hand out different nameservers per account. DNS should be the most reliable service in your chain - but for me it was failing. So I decided to switch providers for the domains that were affected to EveryDNS.
They're a free service, allowing you to setup your DNS for up to 20 domains per account. This is 4 times as many as ZoneEdit allow! The site itself is also a lot more responsive and fairly easy to use. The only thing which put me off is that you have to use their client to update your Dynamic DNS entries. They do provide the full source code for the Windows client though, which I downloaded and promptly started trawling through.
Their client is efficient, small and worked on my Server 2008 webserver - so I didn't have a reason to rewrite it. However, it requires use of command-line parameters to update. This is fine for those who have their webserver connected directly to the internet - i.e. the webserver has the external dynamic IP address, as assigned by the ISP. But in most cases, the webserver is behind a firewall and uses an internal IP (such as 192.168.1.x).
So, I needed a way of retrieving the current external IP, as it changes periodically - hence being known as Dynamic. An ipconfig results in the internal IP, but visiting WhatIsMyIP.com yields the external IP. Screen-scraping the page would allow you to get your IP - or you can use the specific page which just displays your IP.
Then once the external IP is retrieved, you can call the official EveryDNS client - passing in the IP as a parameter. Lastly, this whole process needs automating and executing at regular intervals, to ensure your DNS records are updated to reflect your Dynamic IP address.
I decided to write a small application in VB.NET to accomplish this:
- Retrieve the External IP address from What Is My IP
- Build up the parameters for the official client
- Call the official client passing in the parameters
- Log a success/failure
You can download the full source code or the compiled executable. You'll need to amend the .config file:
- URL - the URL to WhatIsMyIP to retrieve the IP Address
- LogFile - the path to the log file
- LogToFile - true/false depending on if you want a log file to be produced
- username - your EveryDNS account username
- password - your EveryDNS account password
- domains - a comma-separated list of each domain you want to update
- Executable - the path to the Official EveryDNS client
example.com,example.co.ukThen it would call the client for example.com, wait for a response and then call it again for example.co.uk - allowing you to update all of your DNS records at EveryDNS in one go.
This application can then be scheduled to run at regular intervals. I chose once an hour, every hour to ensure I'm not hitting the sites too hard - but that IP changes would be dealt with fairly quickly.
Hopefully there are others in the same situation as me, that want to use the EveryDNS client with their external IP address. Let me know if you end up using the client and what you think - perhaps you have improvements you'd make?