Well, the D-Link wireless router didn’t last long. After about two days it suddenly started losing its ability to control the DSL modem, and internet connectivity was dropping out for two and three minutes at a time. Back to the store it went, and I got a Netgear WNDR3700.
The Netgear has been in use for about a week and seems to be stable, but it has the same firmware restriction on DDNS hostname as the Linksys E2000 did – it refuses to allow a comma-delimited string of multiple hosts in the DDNS hostname field, even though this is a perfectly acceptable string to send to a DNS provider. Apparently someone has the idea that if a character is not legal as part of a domain name, there’s no reason to send it in an update string. So they added that restriction to the UI and in the process broke a perfectly functional option. Bastards. But I’m done buying and returning routers looking for one that hasn’t added this dumb restriction, so I reluctantly have gone to using a software client for DDNS updates. I installed and configured ddclient.
The problem with software clients is that generally they want to poll the web for an IP address. Not only does this seem like a complete waste of bandwidth when the router always knows the WAN IP, it also limits you to checking in five minute intervals. Five minutes is too long to be down. But, as it happens, there is an option in ddclient to scrape the WAN IP from the router’s status page. Not all routers are supported, but sometimes you get lucky and your “unsupported” router will work with the profile of one that is. In this case, I examined the Perl code of ddclient and found that the Netgear WPN824 router had the same status page name as the WNDR3700. I went to Netgear’s site and took a look at the UI screenshots for the WPN824; they looked similar, so I tried that config and was able to successfully scrape the IP from the router. I set ddclient to run at one minute intervals – which took some doing, because setting daemon=60 in /etc/ddclient.conf had no effect. It was still polling at five minute intervals. A little checking around revealed that you have to change /etc/init.d/ddclient and /etc/default/ddclient too. (This is for an install from the Ubuntu repos, by the way; it seems they did something unique and weird with those. Probably not an issue if you install ddclient some other way.)
In addition to running ddclient, this machine also runs a script that logs dynamic IP changes. So that one needed to be changed too, and to do that I needed to figure out a commandline option to scrape the page. Here it is:
wget -q -O - http://[your_username]:[your_password]@192.168.1.1/RST_status.htm | sed -n '/wanip/ {n;p;}' | sed -e 's/<TD nowrap>//; s/<\/TD>//' | cut -c2-26
This works on the WNDR3700 and it should work on the WPN824 as well. Obviously you should replace username and password with your own values.
It seems rather wasteful to have two processes polling the router for the same information, and I’m considering how to consolidate them into one poll that feeds both processes. But for now this works and it’s been pretty stable.
One downside to this approach is that this keeps the machine running these processes constantly logged in to the router. This was never a problem with any other device, but the Netgear, being an “enterprise class” device (whatever that means), prevents a second user from logging on to the admin UI if there’s someone else logged in from another IP. This breaks the polling if I actually force my way in from another address. For right now I’m just logging on from the same machine that does the polling, but I hope I can solve that problem with an explicit logout when I consolidate the polling. I can’t make ddclient do it, but I can make my own polling script do it.
Next time: UPS follies.






[...] This post was Twitted by crankyashley [...]