Thursday 23 October 2014

openwrt on Actiontec DSL modem

Sorting out some old hardware recently I found a number of old DSL modems and routers and I was curious to know which ones I could re-flash.

One of these was an Actiontec GT701-WG DSL modem, which I was surprised to find would actually take openwrt (after a small hiccup) rather easily and has also got me interested in this piece of hardware.

This particular modem uses AR7-SoC and has an ADAM2 bootloader which can be used to flash the device. This bootloader will listen for ftp connections on 192.168.0.1 for a short window immediately after boot, once connected we can use this FTP session to upload and reflash.

The basic steps I found on the following blog entry and consist of

1. power on DSL modem
2. ftp to 192.168.0.1
3. login using adam2/adam2 for username/password
4. set ftp client to use binary and passive
5. set environment variables for mac_port to 0 (to specificy first ethernet port, this modem only has one ethernet port) and creating a new partition which spans the location of the old kernel and filesystem (this detail is listed in openwrt wiki)
6. set MEDIA to FLSH
7. upload new firmware to new partition we created in step 5
8. Reboot modem

The above instructions looked fairly straightforward so I set off to do this, but I forgot one minor detail, I needed to make sure I was allowing connection through firewall on my machine. After spotting this minor detail, things seemed to be going well until upload to modem ground to a halt. I assumed there might be an issue with the firmware on this device so I tried to flash original firmware back onto it using openwrt instructions. This also failed.

At this point the modem failed to boot, however I was still able to get to ADAM2 FTP.
Doing some searching on related models I came across the following setting when connecting to ftp from linux (from openwrt gt704 page)
# echo 0 > /proc/sys/net/ipv4/tcp_frto

I did not recognise this option from the top of my head, this disables F-RTO, an enhanced recovery algorithm for TCP retrans‐mission timeouts.
Once I had disabled this, the steps above worked perfectly.

This modem now has openwrt installed on it :-)

Next steps (for a future blog once I have a few minutes)
1. update version of openwrt
2. run my own custom application/binary on the modem