I purchased a pair of Netgear WGT634U wireless routers a couple years ago with the intent of installing a custom operating system and seeing what they could do. Recently I attempted to configure one of them to monitor bandwidth usage for our house. I ran into several issues, which I will outline along with their solutions in hopes that it will save others some time in the future.
(For a summary of how to install OpenWRT with bandwidthd for bandwidth monitoring on a WGT634U, see the Summary section at the bottom of the post.)
I started by attempting to install OpenWGT rather than OpenWRT because I liked the advertised abilities of OpenWGT to install simply via the firmware upgrade option and to revert back to the manufacturer’s firmware without using a serial cable (both of which OpenWRT lacked for the WGT634U). I went through the installation instructions using version 0.06 of the firmware, but ran into trouble after the firmware upgrade, which appeared to complete successfully. Upon rebooting the router, it was completely unresponsive to telnet and SSH at 192.168.1.1 on both the WAN and LAN ports. Running nmap showed only filtered ports and tcpdump reported no traffic on the network as the router booted up, suggesting that something was preventing the firmware from booting at all.
So I could see what was going on, I created a USB serial cable based on information on the OpenWRT wiki. I chose to use an existing USB serial cable I had and soldered an old floppy drive power connector to the appropriate pins (the floppy connector is shown here). I then booted up the WGT634U with the serial cable connected and waited for some messages. There was nothing. After a few minutes on #openwrt, I learned that a standard serial cable provided the wrong voltages to the WGT634U’s serial port so I would need to use a different serial adapter, such as one created from the Nokia CA-42 or DKU-5 cell phones data cables. I found a DKU-5 cable on eBay for $5 including shipping and ordered it.
While waiting for the cable, I did some further research on #openwrt to figure out my options for bandwidth monitoring. The research I conducted before starting work on the WGT634U suggested that a good option would be to make a set of iptables rules and use the built-in byte counters for bandwidth monitoring as outlined on Linux.com. The benefit of this method was that it did not require any additional software to be installed (most software is not available in the ipkg repositories so it would have to be compiled and configured manually). However, this would have required making a rule for every IP address on the local network and I’d have to find some way of producing nice graphs. I learned from #openwrt that bandwidthd was available in the X-Wrt ipkg repository for the daily snapshot builds. Though I was apprehensive about using a development build, the promise of an easy-to-use bandwidth-monitoring tool and a web-based configuration tool (X-Wrt) was too much to resist.
Since I wanted to start monitoring bandwidth as soon as possible, I ended up installing a daily snapshot of X-Wrt on a Linksys WRT54G v3 that I had lying around. Though I would not be able to save the bandwidth monitoring results to an external USB hard drive (the WRT54G lacks a USB port), I decided that it would not be too inconvenient to periodically copy the results to another computer on the network. On the WRT54G, it was as easy as grabbing the daily snapshot and uploading use the web interface. The steps to activate bandwidthd will be described later.
Two weeks later my DKU-5 cable arrived. I wired it according to these instructions for an ARM9 Linkstation. Though the instructions are not for a WGT634U, they provide the information needed to connect the appropriate wires with the additional information from the WGT634U serial console section. The DKU-5 cable I got happened to have just 3 wires so I connected it in the same manner as the CA-42 cable described on the Linkstation page. Using a multimeter, I found that the red wire was RXD (receive), the white was TXD (transmit), and the black was GND (ground). This is just for reference; I suggest that you verify which wires are connected to which pins on the DKU-5 before soldering them to the floppy power connector. In the following image you can see the white wire soldered to a black wire on the floppy drive power connector. The others are hidden by electrical tape to prevent shorts. The red cable on the power connector is unused. This modified DKU-5 cable pictured below can be plugged into the WGT634U as demonstrated here.
I configured minicom (using minicom -s
) with serial device /dev/ttyUSB0, bps/par/bits of 115200 8N1, hardware flow control off, and software flow control on. Then I plugged in the modified DKU-5 cable to my WGT634U and my computer, crossed my fingers, and plugged in the WGT634U. Thankfully, this time I got scrolling text, showing the WGT634U booting. After a few seconds, it stopped with the following message (full boot text):
[...] Starting program at 0x80500000 Uncompressing Linux............................................................. crc error -- System halted
This suggested that the OpenWGT 0.06 image I had loaded was in some way defective. It could be that it was corrupted during the firmware update or perhaps the images on the OpenWGT site don’t quite work right. In any case, there was not much point in staying with OpenWGT because I already had a serial cable so I could revert to the manufacturer firmware and installing OpenWRT would be just as easy as installing OpenWGT at this point. I decided to revert to the manufacturer firmware to verify that OpenWRT could in fact be installed without a serial cable on the WGT634U. I accomplished this using these instructions (the mtd -r erase linux
step is unnecessary). In order to get to the CFE prompt, you must hold Ctrl-C in the serial console (in my case, minicom) while powering on the WGT634U. You will be greeted with the following (full boot text):
[...] configure vlans...done Automatic startup canceled via Ctrl-C CFE> ^C [...] CFE> ^C CFE>
You need to setup a TFTP server to host the firmware images. I used atftpd, following a method loosely based on these instructions. Note that for some strange reason, the WGT634U uses the WAN port to grab a TFTP image so you must plug your computer (running a TFTP server) into the WAN port in order to do the firmware transfer. You will need to statically configure your IP; I used 192.168.1.2 on the TFTP server.
With version 1.4.1.10 of the manufacturer’s firmware installed, you can then install OpenWRT using the web interface as described here. For starters, I suggest using the stable WGT634U Kamikaze image. Once the firmware update is done, you can telnet into 192.168.1.1 and start browsing around the OpenWRT installation.
Since I wanted to have bandwidthd, I upgraded from the stable WGT634U Kamikaze image to the 3-Jun-2008 X-Wrt snapshot from within OpenWRT using these instructions. Unfortunately, the 31-Jul-2008 snapshot I tried doesn’t seem to be working (it does not bring up the network interfaces) so I recommend the 3-Jun-2008 version linked above. The latest snapshots are available here. SHA1 and MD5 checksums for the 3-Jun-2008 version are available here.
With the 3-Jun-2008 snapshot of X-Wrt running, I installed bandwidthd through System -> Packages. Then I set it to load on startup:
# ln -s /etc/init.d/bandwidthd /etc/rc.d/S99bandwidthd
After you reboot, the stats for bandwidthd will be available at http://192.168.1.1/bandwidthd/. For my purposes, I found that saving statistics across reboots was not necessary. Instead, I just copied the HTML files from /tmp/bandwidthd periodically to my computer. If you want to configure bandwidthd to save stats across reboots, check bandwidthd’s README file.
You probably noticed that my instructions assume upgrading to OpenWRT stable and then to the X-Wrt snapshot rather than just upgrading straight to the X-Wrt snapshot. I chose the former method because I don’t have a WGT634U version of the 3-Jun-2008 X-Wrt snapshot. I only had a WRT54G version, which I was able to convert to a TRX file by stripping off the first 32 bytes of the file (the WRT54G header). Unfortunately, the manufacturer’s firmware for the WGT634U requires an extra header on an uploaded firmware which is difficult to construct without the files used to build that firmware. With OpenWRT, this extra header is unneeded; the TRX file can be flashed directly. If it turns out that newer X-Wrt snapshots work correctly, then the OpenWRT stable step can be skipped and the WGT634U version of the X-Wrt snapshot can be used instead.
Summary
To install OpenWRT with bandwidthd on a Netgear WGT634U, follow these instructions:
- Install the stable WGT634U Kamikaze image using these instructions.
- Install the 3-Jun-2008 X-Wrt snapshot from within OpenWRT using these instructions
- Install bandwidthd through System -> Packages in the X-Wrt web interface
- Configure bandwidthd to load at startup:
# ln -s /etc/init.d/bandwidthd /etc/rc.d/S99bandwidthd
- Reboot the router and watch the stats at http://192.168.1.1/bandwidthd/.
This was extremely helpful. I did what you wrote above tonight, and having a guide in plain English was wonderful. The instructions on the OpenWRT website were a bit terse – your explanation got me through a few tricky parts.
I’m thrilled with the new capabilities of my newly-minted WGT634U running OpenWRT with X-Wrt. Thank you very (very!) much for writing it up.
Just FYI: The link to the latest snapshots http://downloads.x-wrt.org/xwrt/kamikaze/snapshots/brcm47xx-2.6/ doesn’t exist (anymore).
Thanks for letting me know. I have updated the link to point to the new location, which is the same as the old one except without “-2.6”.