How to copy settings from one MikroTik to another?

I was wondering if it is possible to backup all of my settings on one MikroTik and then restore then to a different MikroTik so that I don’t have to reprogram everything?

Can you do this with an identical MikroTik? Can you do this with different models of MikroTiks?

You can export compat file a thne import on another device. If you want to use that settings on other model you will have to edit that file and put some changes or delete some lines

Yes.

From terminal, execute the “/export” command with a “file” argument, copy the file to the other router, and use the “/import” command to apply the settings from the file on it.

Follow up question… does the export and import functions have to be the same model of router to work?

I created an export file from my RB2011 and then tried to import the file into my RB750 this is what I got from the terminal…
expected end of command (line 21 column 26)

They don’t have to be the same model, but the RouterOS version should be more or less the same.

MikroTik tend to add/remove/rename commands/arguments/menus between different versions, and if you use such a thing, it will cause errors like the one you have. They don’t always do that though, so you MIGHT be able to import to a different versions, but equally likely, you MIGHT get the sort of errors that you do.

Upgrade both routers to the same version, and copy the settings afterwards.

Alternatively, you’ll need to actually inspect the file that “/export” generates, and correct all incompatibilities “manually” before doing the “/import”. The error message tells you the command that caused an error.

You guys left out the step of removing default entries where you are importing. That is why that failed.

I saw your response to removing the default config… Is there an easy way to do that without going line by line through the script?

In more recent RouterOS versions, “export” has two flavors - compact and non-compact.

“compact” should in theory remove all defaults, leaving only modifications after them.

If even that doesn’t work… Yeah, you need to “manually” go over the script. Or you could call “export” on menus individually, forming several files that you then import one by one.

Ran the compact export from my RB2011 and tried to import it into my RB750, still get the same error. I don’t know how to read the script as far as figuring out what (line 21 column 26) is referring to. Do I literally just count down the rows from where the script starts to row 21 and then over 26 characters? Ugh LOL

Yes. Exactly. “Row” means “line” and “column” means “character”.

The error you’re getting is not from defaults. It’s due to version incompatibility. If it was due to defaults being present, the error would’ve been something along the lines of “failure: already exists”.

Errors like “expecting ()” mean what I said above about menus, command and arguments. RouterOS fails as soon as it hits an unknown thing (usually, an argument or an argument value), and it points you to the place where that unknown thing is.

If the two versions are the same, you won’t see errors of this kind.

I am at a loss then… both Tiks are running V6.22

Odd… What’s on line 21?
(all of it)

Here is the first chunk of the export script… What is line 21?

nov/29/2014 15:01:17 by RouterOS 6.22

software id = N17S-NLH4

/interface ethernet
set [ find default-name=ether1 ] name=“ether1- WAN gateway”
set [ find default-name=ether2 ] name=“ether2 LAN”
set [ find default-name=ether6 ] name=ether6-master-local
set [ find default-name=ether7 ] master-port=ether6-master-local name=
ether7-slave-local
set [ find default-name=ether8 ] master-port=ether6-master-local name=
ether8-slave-local
set [ find default-name=ether9 ] master-port=ether6-master-local name=
ether9-slave-local
set [ find default-name=ether10 ] master-port=ether6-master-local name=
ether10-slave-local
/ip neighbor discovery
set “ether1- WAN gateway” discover=no
/interface vlan
add interface=“ether2 LAN” l2mtu=1594 name=vlan2 vlan-id=2
/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik
/ip ipsec proposal
set [ find default=yes ] pfs-group=modp1536
/ip pool
add name=“MAIN dhcp” ranges=10.169.169.100-10.169.169.200
add name=“L2TP Pool” ranges=10.10.10.10-10.10.10.50
add name=“vlan2 guest wifi” ranges=10.1.2.100-10.1.2.200
/ip dhcp-server
add address-pool=“MAIN dhcp” disabled=no interface=“ether2 LAN” lease-time=1d
name=“MAIN dhcp”
add address-pool=“vlan2 guest wifi” disabled=no interface=vlan2 lease-time=3d
name=“vlan2 dhcp”
/port
set 0 name=serial0

Line 20 and 21 are

/interface wireless security-profiles
set [ find default=yes ] supplicant-identity=MikroTik

Apparently, your target router does not have a default wireless security profile specified, and thus you can’t modify said profile.

Does the target router not have a Wi-Fi? That’s probably the cause here - your source router has Wi-Fi, but your target one doesn’t. Or maybe you don’t have the “wireless” module… Check the “/system package” menu of both routers.

You are correct, that was that error. Once I fixed that it went to another error and I fixed that as well. I would need to spend some time tweaking the RSC file as it is errors because of the hardware differences between the two different routers I am experimenting with… For example one is a 5 port router and the source file is coming from an 10 port.

So I think if I had identical hardware it would work great…

Why does it not work when I select to restore to factory default and then check the box that says “no default configuration” and then to run the script file does it not work? It seems like this would remove all those pesky default settings that are getting in the way and then drop my script over it…

Buddy,
If you have things configured on port 6-10 on ur RB 2011 how do you expect to find them on RB 750. Also RB 750 has no wireless.
Change those setting and your export import will work good.

I did that with the wireless and got past that error no problem. I also deleted all the ports after port 5 and got rid of that error. Still another new error. No big deal, my main concern is I want to purchase an identical equipment router for a backup at work. I did not have an identical one for testing the export function, only mismatched MikroTiks. I am confident now that it will work just fine if I get identical equipment…

Use the tools in notepad.

Failure at line 18
Open RSC file and use the goto command and look at what that line does.

I have a rsc file I use on 750GLs so a tech can walk out the door and plug them in on site.

First try importing the script in terminal. You will see EXACTLY WHAT THE ERRORS ARE.
Then go back into the rsc file and make adjustments.

I started to get errors to the effect of “device already has name” or something to that effect… Errors that would not point me in the script file where it needed corrected…