AlexJ's Computer Science Journal

alexandru.juncu.ro

Hurricane Electric and Dynamic DNS

I have been using several (free) DNS providers including the ones where I bought domains from and specialized providers like XName.org.  Lately I have been using Hurricane Electric as my free DNS provider and I found to be the nicest so far.
HE is know for its Tunnel broker services that provide users with IPv6 connectivity via IPv6 over IPv4 tunnels to their servers. The fact that they were IPv6 friendly made me test their DNS hosting services. As I found out, they are (were) one of the few that have IPv6 enabled serves and offer DNS hosting for free.

They have a very friendly user interface and reliable services. Yesterday I tried the dynamic DNS feature, since other dyndns sites I used either closes, became non-free or weren’t as reliable. Dynamic DNS is used on hosts that don’t have a static IP (for example, when using DHCP) but need a (sub)domain pointing to it. Configuration is easy and it usually requires a client that periodicity tells the DNS server the new value of the host IP. A simple guide can be found here.

Since I wasn’t satisfied with the dyndns client, I wanted to do it with my own client. All I needed was the HE API, which is a simple web page that takes parameters from the URL and some basic bash knowledge.

My particular issue was that the server that needed the dynamic host is behind a router with NAT. It has both IPv4 and IPv6. The IPv4 address is a private address (behind NAT) so the address for the A entry is the public IP of the router.  The IPv6 address on the server is publicly routed so the AAAA entry needs the address on the server interface. Best way is to get the address that the Internet sees. For example, using sites like http://v4.ipv6-test.com/api/myip.php.

So the simple script for a dyndns client became:

#!/bin/bash

IPv4=$(wget -qO- http://v4.ipv6-test.com/api/myip.php)
IPv6=$(wget -qO- http://v6.ipv6-test.com/api/myip.php)
wget –no-check-certificate -qO- “https://dyn.dns.he.net/nic/update?hostname=host.domain.tld&password=ENTRYKEY&myip=$IPv4”
wget –no-check-certificate -qO- “https://dyn.dns.he.net/nic/update?hostname=host.domain.tld&password=ENTRYKEY&myip=$IPv4”

Just add the script into a cron job and you’re set.

Comment

AlphaOmega Captcha Classica  –  Enter Security Code
     
 

*