Last friday I noticed my modem/router (an actiontec GT704-WG) was acting strange. It's port-forwarding wasn't working as it should anymore, all in all, it seemed it's NAT was completely broken.
The next morning I walk up to the computer, and notice the Internet isn't working at all anymore. - I look at the modem, and it has it's status light solid red. (Not good,- the manual sais that when the red status light remains solid, there is a hardware or firmware problem.) I tried rebooting it, unplugging it, plugging it back in, anything I could think of, It wouldn't boot up, and the web interface wasn't accessible anymore.
At that point anyone else would have trashed the thing and bought a new one, but since I don't have a tree growing $100 bills, and also, since I didn't have anything better to do with my internet being down, I was a bit more persistent.
After lots of fiddling and trying, I noticed that my computer would get an IP about 2 seconds after I power on the router, and lose it again about 5 seconds later. This ip was 192.168.0.127.
I thought that was kind of strange, and interesting, so I set a static IP and disabled dhcp on my network settings, and i tried probing some ports during that 5 second window, and found out there was an FTP server accessible!
The ftp server announced itself as 'adam2'. My router's name isn't Adam, and I don't know anyone named Adam, so I went to a friends house to borrow their internet and do some googling. It turns out this is the routers bootloader, which gives you a 5 second window after startup to upload firmware.
$ ftp 192.168.0.1
Connected to 192.168.0.1.
220 ADAM2 FTP Server ready.
That was great news! It ment two things:
1) My router wasn't fubar.
2) I was able to try something that might fix it: replace/repair the firmware
Of course, It wasn't that easy. The Adam2 boot loader defines a set of environment variables to define the memory range of several partitions. (A kernel, file system, boot loader, boot loader settings, and some unknown partition labeled from mtd0 through mtd4) And the original firmware image of the manifacturer (Actiontec) is just one image file, not 2 or 5 image files. I tried splitting the image in several parts using the partition layout memory address numbers in the boot loader, but that didn't seem to work. I could upload the firmware but it wouldn't boot.
With no easy way to upload the firmware image of the manifacturer through the adam2 ftp interface, I was almost back at square one, but it just required some more persistense.
The OpenWRT project has a page on the Actiontec 701, which is appearantly a modem/router similar to mine (but without wireless).
On that
same page it has some information about the router, and it mentions the router uses the AR7 architecture.
It turns out D-Link has a router running on that very same architecture (the DSL-G604T) and unlike Actiontec, D-link provides a recovery utility to replace the firmware through the ftp interface, using ONE image file.
I ran the utility and it uploaded D-Link firmware to my actiontec modem, I figured, maybe the web-interface will work, if I'm lucky, and I can use that to upload the original Actiontec firmware, or just replace the d-link image with the actiontec one in the recovery utility.
It turned out I didn't even have to, because, appearantly, the D-Link software is running with no problems on my Actiontec router, eventhough it has completely different hardware. I can now get back on-line, use NAT and port forwarding, even wireless works. All features in the web-interface work etc,...
This D-Link software seems to have more features(see screenshot) in it's web-interface than I've ever seen in a modem/router; so why would I replace the original buggy and featureless actiontec firmware if the D-link firmware works just as well?
It turns out I was rather lucky the D-Link firmware even boots, since the device it was written for has at least twice as much memory as my Actiontec piece of junk.
The memory constraint had me worried, so I did a small stress test by calling on my VoIP while downloading stuff (probably not the best test one could do, it's not like p2p) and it worked fine. But at least now if I ever encounter problems I can revert back to the original firmware. (Though I'd like to avoid it if possible)
The original Actiontec firmware hasn't been maintained or updated since 2005 and it is full of bugs. One of the most annoying bugs is that it wants to log every dns-request without ever deleting/cycling the cache. When the memory is full, the firmware craches. Using any p2p app for 5 mins will do that. There is a temporary fix (by telnetting to the modem and disabling the caching), but it gets lost after reboot. So that's why I'd rather keep the D-Link firmware if I don't have any problems with it (so far so good)