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” >

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 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
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 🙂 )

3 comments on “How to completely copy the Tomato config of one RT-N16 router to another.
  1. johnstonf says:

    Worked great! Thanks so much. Maybe pass along that you don’t NEED to use ssh, just browser to tools> SystemCommands and run your ‘nvram export –set | grep -v hwaddr |grep -v macaddr |grep -v lan_ipaddr’ then copy/paste to new router (first paste to text file, then from text file, copy/paste/execute in sections). At one point the user/password changes to the source router, so enter that and continue on with the process. Then test, then commit with # nvram commit.

  2. johnstonf says:

    noob here… Can you briefly explain how you do the ssh? Were you on mac or pc, did you need to install ssh? Where you have ‘originalrouter’ is that the ipAddress of router? Thanks!

    # ssh root@originalrouter “nvram export –set | grep -v hwaddr |grep -v macaddr |grep -v lan_ipaddr” >

    • Jeremy says:

      Sorry for the delay on this response, but I’ll follow up now. I usually operate off an Ubuntu VM (Oracle Virtual Box) on my Windows native OS. But if you have putty or cygwin installed on windows that would work fine too. In the example I use the “originalrouter” placeholder to identify what could be the IP or DNS, or host name of your target device. To SSH to the router SSH has to be enabled, and the credentials are typically “root” for the user and then whatever your regular router password is.

Leave a Reply

Your email address will not be published. Required fields are marked *