Community discussions

MikroTik App
 
oguruma
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 83
Joined: Sat Jun 04, 2022 8:55 pm

Best way to copy a config to another device?

Thu Jul 21, 2022 7:58 pm

I have 2 Hex's. One of them is already configured how I want it, the other has the default config.

Is there an effective means of copying the config from one to the other? I have a backup of the config, is it enough to simply import that backup file to the other device?
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 13221
Joined: Thu Mar 03, 2016 10:23 pm

Re: Best way to copy a config to another device?

Thu Jul 21, 2022 8:43 pm

You could do it, but you'd have to fix certain things afterwards (e.g. interfaces' MAC addresses).

You could create verbose export (creates text file), reset the other unit to blank config (not even default), copy over exported file and import it there. And manually configure users (set passwords etc.).
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12658
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Best way to copy a config to another device?

Fri Jul 22, 2022 2:09 am

(but before do that, check your skill and software to see if you are able to use winbox with MAC address instead of the IP, or you are cut off after a full reset)
 
holvoetn
Forum Guru
Forum Guru
Posts: 6940
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: Best way to copy a config to another device?

Fri Jul 22, 2022 8:51 am

(but before do that, check your skill and software to see if you are able to use winbox with MAC address instead of the IP, or you are cut off after a full reset)
Wouldn't copying over config with same MAC addresses potentially result in the same lockout ? Just wondering.

What I do for config copy:
- export config as recommended before and put it on your PC
- check the export so you're sure everything is in !
- open config in a text editor
- strip out all MAC addresses (using CTRL-F in most editors will help immensely) - they will get configured again with "default" values when setting things up.
- get in new device using Winbox - MAC
- set new user and passwd
- log out Winbox
- log in again with new user
- DELETE admin user
- on the new device: open terminal
- open exported config in text editor (if it isn't already open from before)
- play the copy-pasta game :lol: (no, that wasn't a typo) in terminal, block by block (caveat: sometimes the sequence of the export is not 100% correct for setting up, so you may have to do some parts before pasting others. Error messages will tell you where it went wrong).

Advantage of this approach: you will SEE what gets configured and where it goes wrong.
Just running the script might make you miss some things.

It sounds complicated but it shouldn't take more then 10 minutes.
 
User avatar
mkx
Forum Guru
Forum Guru
Posts: 13221
Joined: Thu Mar 03, 2016 10:23 pm

Re: Best way to copy a config to another device?

Fri Jul 22, 2022 9:07 am

(but before do that, check your skill and software to see if you are able to use winbox with MAC address instead of the IP, or you are cut off after a full reset)
Wouldn't copying over config with same MAC addresses potentially result in the same lockout ? Just wondering.
It would if the "config donor" device was connected to same network during the operation. The reason for using winbox with MAC connectivity is that after configuration reset (as preparatory step for importing text config) device looses all IP access and only remaining way in is MAC connectivity.
 
holvoetn
Forum Guru
Forum Guru
Posts: 6940
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: Best way to copy a config to another device?

Fri Jul 22, 2022 9:36 am



Wouldn't copying over config with same MAC addresses potentially result in the same lockout ? Just wondering.
It would if the "config donor" device was connected to same network during the operation.
That's what I was referring to, yes.

The reason for using winbox with MAC connectivity is that after configuration reset (as preparatory step for importing text config) device looses all IP access and only remaining way in is MAC connectivity.
That I am well aware of. It's part of the sequence I use.
 
User avatar
BartoszP
Forum Guru
Forum Guru
Posts: 3097
Joined: Mon Jun 16, 2014 1:13 pm
Location: Poland

Re: Best way to copy a config to another device?

Fri Jul 22, 2022 9:48 am

In the first step as a "warm-up" before importing more "advanced" parts of configuration I do change interface names in the new router to the names from the old ones. Same should be done for interface lists and bridges. If you import block by block exported rules then they could refer to the names not defined yet in export file.
 
holvoetn
Forum Guru
Forum Guru
Posts: 6940
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: Best way to copy a config to another device?

Fri Jul 22, 2022 9:58 am

If you import block by block exported rules then they could refer to the names not defined yet in export file.
Which is why I said the sequence of the export is not always correct.
They really should fix that export-sequence ...
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12658
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Best way to copy a config to another device?

Fri Jul 22, 2022 2:02 pm

But... really on export also the interface renaming is always exported and commands are ordered on logical way,
like first create wireless profile, then set the wlan settings...
 
holvoetn
Forum Guru
Forum Guru
Posts: 6940
Joined: Tue Apr 13, 2021 2:14 am
Location: Belgium

Re: Best way to copy a config to another device?

Fri Jul 22, 2022 2:52 pm

But... really on export also the interface renaming is always exported and commands are ordered on logical way,
like first create wireless profile, then set the wlan settings...
Not 100% correct, in my experience.
I've never been able to use an export and just upload it and run the script.
There was always something in the wrong sequence.

Unless that has been changed recently ?
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12658
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Best way to copy a config to another device?

Fri Jul 22, 2022 3:09 pm

I do not know, but I everytime use netinstall or a full reset without keep anything,
and I reimport the script manually for check errors and change MAC (for not have duplicates, not for prevent importing errors)
and I never have problems recently on v6.4x+
On v6.3x- often something is missing or misplaced, for example a pppoe on interface that is not renamed, and the renaming part is present, but later...