Community discussions

MikroTik App
 
GiovanniG
Member
Member
Topic Author
Posts: 350
Joined: Sun Nov 15, 2015 4:12 pm

A faster way to import configuration?

Thu Mar 21, 2024 11:21 pm

Hi, I need to clone a RB951G-2HnD into a RB750r2, backup file and restore doesn't seem to work with different routers, the only way is to export and import text but when I import I have "failure: already have interface with such name", I can't believe I have to manually delete lines which can be duplicated on a fresh router, should I really?
There isn't a faster way to import the file? Like reset, reboot and use that rsc file instead of default one?
Thank you for answers
 
holvoetn
Forum Guru
Forum Guru
Posts: 5500
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: A faster way to import configuration?

Fri Mar 22, 2024 12:40 am

Problem is you're moving to another device and most likely also to another ROS version ?
Copy-paste is the advised approach, carefully inspecting what's already there and what not.

You can try to start with clean config on the new device and copy-paste the contents of rsc file in terminal but still then it is possible you may run into some things which are different between ros versions.
 
User avatar
Amm0
Forum Guru
Forum Guru
Posts: 3505
Joined: Sun May 01, 2016 7:12 pm
Location: California

Re: A faster way to import configuration?  [SOLVED]

Fri Mar 22, 2024 1:05 am

I think it's important to note the ":export" is more a script to create a config, than the actual config. And, in scripting, you cannot "add" something if it already exists. So if you have some default config, then do an :import config-from-other-router.rsc, it will conflict with the default.

Assuming you have some users setup, and an export from another router. You can run the import using:
 /system/reset-configuration no-default=yes file=config-from-other-router.rsc keep-users=yes

Or if you want to cut-and-paste. Use winbox with the MAC address to connect, then use this (i.e. above without a file):
/system/reset-configuration no-default=yes keep-users=yes,
it will reboot, and reconnect, then you can cut-and-paste.

But if you have an empty config, likely better copy your config to the root of Files, and run the import instead of cut-and-paste:
:import verbose=yes config-from-other-router.rsc
The "verbose=yes" option will show you where it's failed if it didn't work (or just show you what it's doing if working).

Main thing is the config needs to start empty, which is what the "no-default=yes" does, an :import should work.

FWIW...Since the config is actually a script. You can modify it to use variables. Basically if you add some:
:global myvar "WAN name"
then you can use a "$myvar" in the export (and now modified) config.

Variables gets more complicated, so more an FYI. But variables allow you to "tweak" the config before using /system/reset-configuration run it if this going to be a recurring thing. And the :import verbose=yes is useful for troubleshooting scripting problems when using variables (or other control structures allowed in the "config")

Who is online

Users browsing this forum: 4l4R1, ggwp, jaclaz and 34 guests