A number of people use dynamic DNS clients (notably DNSUpdate) to point their domains to their computers at home or any where the the host computer is connected via a dynamic IP. This allows some limited web site hosting, email, or some external network troubleshooting. However, it does involve keeping host computer on at all times, which for some, may not be an option.
Enter the Linksys NSLU2. It was originally sold by Linksys to put USB disks on the network. It apparently didn't do too well (there were a number of design decisions that made it very a bit unintuitive), but thanks to the hacker community, it has since become an excellent little server for all things from web services and email to DNS and DHCP. And in this case, this will allow you to use it as nice lightweight Dynamic DNS client with Apple AirPort Extreme.
First all, this assumes that you understand that this may cause some issues with you and your ISP. If you are willing to deal with the consequences, then continue on.
Next, this hint assumes that you have the following:
ipkg install snmp
ipkg install wget
ipkg install cron
Reasons:
snmpwalk -Os -c public -v 1 172.16.1.1
If you get all sorts of output, then it works. Now let's narrow it down a bit by typing:
snmpwalk -Os -c public -v 1 172.16.1.1 ipAdEntAddr IpAddress
This will get your localhost address, a loopback network address, your router address -- and your WAN address, i.e. the address assigned to your router by your ISP. Now we are ready.
Putting it all together:
#!/bin/sh
exec_cmd="/opt/bin/wget"
IP=`snmpwalk -Os -c public -v 1 172.16.1.1 ipAdEntAddr IpAddress |
grep -E -v '(127.0.0|169.254.233|172.16.1.1)' |
cut -d : -f 2 |
sed 's/ //g'`
$exec_cmd --http-user=username --http-password=password -q -O -
http://members.easydns.com/dyn/dyndns.php?hostname=domain.com&myip=$IP
Explanation:
NOERROR
That means you were able to successfully update your DNS zone. Otherwise, if you have already updated earlier and the zone has not yet expired, you may get:
TOOSOON - back off update frequency
Try again in a few minutes. At this point, if you were successfully, verify by typing this in Terminal:
dig domain.com
(Replace domain.com with your domain, of course.) This will pull up the DNS zone. If your script worked, you can use the Port Mapping feature (Manual Setup » Advanced » Port Mapping) to point specific ports to your NSLU2 device, whether it is ssh, httpd, ftp or any other port. At this point, add the following into crontab (in this case, /etc/opt/crontab):
0,15,30,45 * * * * /root/scripts/update_dns.sh
This updates DNS every 15 minutes, but you can make update at shorter or longer intervals. Now if you use dyndns.org, ovh.net, no-ip.org, ods.org, and hn.org, you can install updatedd:
ipkg install updatedd
and then update your DNS that way instead. However, if you are like me and updatedd doesn't work for you, your provider may have an API you can use to work with instead -- as long as you have your WAN IP, your username and password. This concludes this hint. Have fun!
Mac OS X Hints
http://hints.macworld.com/article.php?story=2007122222045999