Saturday, January 22, 2011

Tomato firmware configuration

I have the Tomato firmware loaded into my Linksys router (WRT54GL 1.1). I acquired a second router of the same type and thought it'd be nice to duplicate the configuration. (if it breaks down or for whatever reason)
When I tried restoring the configuration, I got the error: "You cannot restore settings to a different router".
So I first needed to check what I had to change in the cfg file...

Source device:
gunzip -c tomato_v128_mDA3159.cfg | tr "\0" "\n" | grep "addr=00:1"

Target device (to be overwritten):
gunzip -c tomato_v128_m4AF795.cfg | tr "\0" "\n" | grep "addr=00:1"

Ah! It might check the MAC address! Let's try changing that...
gunzip -c tomato_v128_mDA3159.cfg | perl -pi -e \
| gzip -9 > tomato_v128_copy.cfg
(NB: OS X didn't have a sed command that worked nicely with binary files.)

It restored the modified configuration file!
After resetting the modem and other connections that have the old MAC address in memory, I could connect to the internet again.


When upgrading to a different model router, the configuration files will not match. (it checks
boardtype, boardnum, boardflags and other settings).
In that case, you could also SSH to old router and export the configuration in an easier format:
nvram export --dump > 1.txt
scp 1.txt darkfader@

On the new router, you can them import the edited file.

1 comment:

Unknown said...

How would you do this on a Windows7 PC?