Transfer test setup to production router via usb?

I have two identical routers, both running from file systems on an evternal USB stick. One router is on my test network and the other is on my production network.

Now, is it reasonable (when I have the test setup ready for production), to take the two USB sticks and put them into one computer and 'dd' copy test to production?
Should I be woried about things like security keys, mac addresses, uuid's etc?

If this is discussed elsewhere I apologise for not having found it and would appreciate a link, else I would appreciate your comments.

If there are mac addresses mentioned in the configuration files, then they should be adapted. Also disk-id will most likely be different.
But why do you want to follow this procedure with copying the usb, rather than taking a backup, making the necessary changes and then restoring?

3 Likes

You should use uci export or uci -X show and edit properly your desired changes, some people like to edit manually files on /etc/config (in that way Eg. you can put comments on your files) but if you use luci or uci you will lost them, other people use uci commands, other people use sysupgrade tar.gz files(but just work on same router with same firmware and same packages) exported from luci.
Personally What I found the best approach is to write down notes on specific uci commands to modify the necessary (not rewriting the defaults) but documenting (commented lines) the defaults.
in that way you can, reconfigure step by step manually new routers and can use same notes for newer firmware versions and detecting changes on new configurations etc.

something like this:

# This snippet is not specific config just a sample of random notes:

uci set system.@system[0].hostname='MainRouter'
# uci set network.lan.ipaddr='192.168.1.1' # Default
# uci set network.lan.dns='192.168.1.1' # Default
# uci set network.lan.gateway='192.168.1.1' # Default
uci set network.lan.hostname="`uci get system.@system[0].hostname`" # Default not set
uci set dhcp.lan.limit='40'
uci set dhcp.lan.start='180' # Default '160'
# (...)
uci set wireless.radio0.htmode='HT40' # Default 'HT20'
uci set wireless.radio0.noscan='1' # Default <absent>
uci set wireless.radio0.channel='auto' # Default '11'
uci del wireless.radio0.disabled # Default uci set wireless.radio0.disabled='0'

you don't need to be worried about uuid of the drive, you can also point fstab to specific partition as '/dev/sda2' on device, or using label.
security keys, well if you need to have your same public key for ssh dropear you need to add it, yes.

I recommend that you put your network/wifi configuration on a script and build an image with that, so you can even somehow reset your router main config safely, then have the fancy stuff configured on extroot, so if you get in problems, you can instruct someone to remove the flashdrive and boot the router without it and plug in while its running to mount the partition and edit and fix properly the needed files. if you somehow break the configuration on the router it self you can instruct someone to press reset a few seconds (don't know but you may need to add a script to run when reset button it is pressed for a few seconds to reset to image defaults.

There are changes & additions which I have made to my test router which are not captured in uci export, or at least, I don't know how to use uci to capture these changes.

Yes, I take your point. I think I should build an appropriately commented 'post firmware flash' script file and some .tar file(s) to apply all of my desired changes ...
I don't think I am ever likely to want more than one USB disk on the router itself so using /dev/sd.. names to mount file systems should not be a problem.

Thanks for your thoughts.

uci export is not connected to what I am saying.