How to completely copy the Tomato config of one RT-N16 router to another.
This may or may not work for other routers. I don’t know. Lots of folks have bricked their routers trying to do this the wrong way, so be careful. This saves a ton of time and is reasonably safe if you do it right.
The tomato standard web gui backup and restore feature does not support moving to a new physical device even of the same make, so after not arriving at a reasonable solution after search around I created my own.
I didn’t want to cherry pick config lines, but I also didn’t want to ruin my router so after a quick scan of everything in nvram I came up with only the following few exclusions that made me feel safe enough to commit. This process works flawlessly for me, your mileage may vary. You should export your current config and the config of a stock tomato install of the same version and diff them against one another to make sure you also have the same level of comfort. I’m not responsible if you break your router.
Also compare os_version from your nvram exports between the routers first and only proceed if they are exactly the same. I have no idea what might be different between versions.
Again, I have a reasonably complex configuration, more so than most anyone who might read this article, and the following works for me.
# ssh root@originalrouter “nvram export –set | grep -v hwaddr |grep -v macaddr |grep -v lan_ipaddr” > backupconfig.sh
We want to exclude the hardware addresses (and I even exclude the virtual MACs because I don’t know of a reason not to unless you had upstream devices doing mac filtering and you needed one or more of the virtual macs to retain their previous hardware address) I also exclude the lan_ipaddr because I’m not entirely sure it wouldn’t foul your session in the middle of the script, plus it’s an easy one-off change you can make later on in the gui once everything is good. It reduces confusion plain and simple.
Now copy backupconfig.sh to your new router via scp. (you’ll need to have installed the same version of tomato and enabled ssh administration to continue.)
I also do an nvram reset (and waiting 5 minutes) in the web gui prior to running the script. Then just run the script you copied over:
# sh backupconfig.sh
make sure you didn’t get any hideous errors, and hit the web gui to see if some of the items in nvram are already showing up as you expecct (not all of them will until after a commit but you get the idea). If everything looks good commit the changes.
# nvram commit
Now you can reboot your router and you should have a shiny new clone (except for the hardware addresses of course 🙂 )