Updating Dynamic-DNS Entries with OpenWRT
I have a Linksys WRT54GS wireless access point at the center of my home network. I've installed the OpenWRT firmware on the access point to take advantage of some capabilities not present in the off-the-shelf firmware (see my post "OpenWRT on our Linksys WRT54GS"). Since the access point is powered "on" all the time and it has direct access to the WAN (Internet) interface of the network, it seems like an ideal place to run a program capable of maintaining my dynamic DNS entry.
There is a program called 'inadyn' that can publish an IP address to the Dynamic DNS Service. I needed to install 'inadyn' on my OpenWRT access point. This was done by editing the /etc/ipkg.conf file on the OpenWRT system to contain an entry for the URL of the package list that includes inadyn (http://www.syslinx.org/wrt54g/openwrt). Here's some output from my secure shell session:
root@OpenWrt:/etc# more ipkg.conf src whiterussian http://downloads.openwrt.org/whiterussian/packages src non-free http://downloads.openwrt.org/whiterussian/packages/non-free src phil http://www.syslinx.org/wrt54g/openwrt dest root / dest ram /tmp
Then, I installed the inadyn program using the web interface provided with OpenWRT. Next, I created a configuration file that is used by inadyn to determine how it should connect to the Dynamic DNS Service and update your entry. Again, here's some shell output indicating the contents of my configuration file (located in /etc/inadyn.conf):
root@OpenWrt:~# more /etc/inadyn.conf --username foo --password bar --update_period 60000 --alias foo.dyn-o-saur.com
Lastly, I created an initialization script that will be run when the router restarts. Since the inadyn program will run continuously, this initialization script should keep us in business indefinitely. I named my script S50inadyn, which indicates the order (once the network facilities are active) in which the script should be run during start-up. Here's some shell output indicating the contents of the file:
root@OpenWrt:/etc# cd /etc/init.d/ root@OpenWrt:/etc/init.d# ls S05nvram S41wpa S50dropbear S50telnet rcS S10boot S45firewall S50httpd S60cron S40network S50dnsmasq S50inadyn S99done root@OpenWrt:/etc/init.d# more S50inadyn #!/bin/sh /usr/bin/inadyn --input_file /etc/inadyn.conf &
You should be able to restart the router and see that the inadyn program is running. Simply login to the router and get a list of processes:
root@OpenWrt:/etc/init.d# ps -ea | grep inadyn 513 root 332 S /usr/bin/inadyn --input_file /etc/inadyn.conf
Now you can access the WAN port of your access point using a convenient DNS name. You'll probably want to configure some port-forwarding rules in order to access computers within your network. However, I recommend using port-mapping in order to lessen the obviousness of your open ports.