OpenWrt Forum Archive

Topic: Best method of clone configuration

The content of this topic has been archived on 26 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,
I have a bunch of 30 Linksys wrt54gl all of them with its original firmware, apart of them I have a wrt54gl already configured with openwrt whiterussian (wpa2-radius, xrelayd, some iptables rules, etc.) I want to clone configuration and packages on the rest of wireless routers. What method of cloning do you recommend me?

For example I've read this post:

http://forum.openwrt.org/viewtopic.php?pid=52592

Can I use it on wrt54gl? Is not risk of bricking the routers. In http://wiki.openwrt.org/BackupAndRestor … 8backup%29 I can read:
"WARNING: Restore the NVRAM partition only on the same Wrt router where you did the backup! Restoring the NVRAM partition can brick your router."

what does mean  "same wrt router", same model?, or exactly the same device?

Thanks in advance!!

(Last edited by sebelk on 26 Feb 2008, 12:02)

What I would do is this:

Get a list of packages installed on the router you want to clone:

ipkg list_installed

Get a list of the directories in / on the router.  Ignore rom, tmp, proc (and on a 2.6 kernel you would ignore sys too).  Then copy them to a PC:

From the PC:
mkdir source
cd source
ssh routerIP 'cd / && tar cf - /etc /bin /sbin /usr ...' | tar xvf -
cd ..

Then do flash White Russian onto a new router, including any packages that are installed on the source router.  Then dump the files from the new router too:
mkdir base
cd base
ssh routerIP 'cd / && tar cf - ...' | tar xvf -
cd ..

Then you can compare the two to see what files have changed.

Then you will need to see what nvram settings to change, so dump the nvram on both routers too and compare them.  Also, dump the nvram on a few other routers because I have found that the nvram on two out-of-the-box routers can be very different.  From the nvram dumps, try to figure out what settings are actually necessary for your purposes.

Then make the necessary filesystem and nvram changes on the new router that you installed White Russian onto and make sure everything works as expected.  If something doesn't work, figure out what needs to change and update your list of nvram settings or whatever accordingly.

If changes to files are necessary, you can just create a tarball of the necessary files and call it fs-changes.tar.  Note, the files in the tarball should be owned by root or some things may not work (e.g. crontabs AFAIK).

When everything is OK on the second router, write a script which does something like this:

#!/bin/sh

ipkg update
ipkg install package1 package2 package3

nvram set something
nvram set something_else
nvram commit

cd /tmp
wget http://PC/fs-changes.tar
cd /
tar xvf /tmp/fs-changes.tar

Then the flashing of new routers will not be a single step, but will still be quite simple:

Flash White Russian
$ telnet routerIP
OpenWrt# cd /tmp
OpenWrt# wget http://PC/configure.sh
OpenWrt# sh configure.sh
OpenWrt# reboot

The discussion might have continued from here.