Community discussions

MikroTik App
 
Charg
newbie
Topic Author
Posts: 30
Joined: Wed Apr 07, 2021 11:49 am

Can't import config on some routers

Thu Oct 07, 2021 5:06 pm

TLDR: Importing config disconnects me in the middle of executing, resulting second half of the config to never get executed at all

So recently my company bought a bunch of mikrotiks (D53G-5HacD2HnD).
Out of the box, some of them are on firmware 7.0.2, some on 7.0.3. And those that comes with 7.0.2. seem to fail importing config.

What I did is I configured everything I wanted, exported config into file, uploaded this file to other mikrotiks and tried to reset to default and then import config. What seem to happen is when it comes to the point of adding one of the ethernet interfaces I am connected through into bridge - I get disconnected from winbox session, and the rest of this config file does not get proceeded with import process, as none of the commands after did any change (like creating firewall rules and such)

What I've tried:
1. upgrading firmware (the only available option is to 7.1rc4 - didnt help
2. two ways of importing config:
first:
system > reset configuration > no default configuration checkbox > reset
terminal > import file=config.rsc (with and without / before import)
second:
/system reset-configuration run-after-reset=config.rsc

None of that seemed to help.

Any ideas? Or maybe its possible to somehow export routeros 7.0.3 package from working boxes and import it into non-working?
Last edited by Charg on Fri Oct 08, 2021 2:00 pm, edited 3 times in total.
 
WeWiNet
Long time Member
Long time Member
Posts: 597
Joined: Thu Sep 27, 2018 4:11 pm

Re: Can't import config on some routers

Thu Oct 07, 2021 5:17 pm

Latest V7 release is V7.1RC4 which is I believe recommended to be used in all used cases.
Would update all your boxes to that release before doing anything more...
(go to system/packages/update).

If you import same setting to all boxes, you might overwrite ETH MAC settings! Then it is normal that MAC level connection
via Winbox will fail.
Make sure in your export that you remove things that will conflict on other devices (like using same IP addresses, MAC addresses etc.)
 
pe1chl
Forum Guru
Forum Guru
Posts: 10223
Joined: Mon Jun 08, 2015 12:09 pm

Re: Can't import config on some routers

Thu Oct 07, 2021 5:43 pm

When you import the config using /import file from terminal, what error message does it print?
Try adding verbose=yes to make it print the file while importing and see where it fails.

With the "reset configuration and run-after-reset, there is a known problem (for years, I think it was never fixed) that the import starts too early, before the system is "up" and all interfaces have been detected, and the import fails when it tries to configure a device that is not ready yet.
A dirty workaround is to manually add a line "/delay 30" at the top of the config file before you upload it.
 
Charg
newbie
Topic Author
Posts: 30
Joined: Wed Apr 07, 2021 11:49 am

Re: Can't import config on some routers

Fri Oct 08, 2021 8:41 am

Latest V7 release is V7.1RC4 which is I believe recommended to be used in all used cases.
Would update all your boxes to that release before doing anything more...
(go to system/packages/update).
As I said I've tried that
What I've tried:
1. upgrading firmware (the only available option is to 7.1rc4 - didnt help
It did not help :)
If you import same setting to all boxes, you might overwrite ETH MAC settings! Then it is normal that MAC level connection
via Winbox will fail.
Ehm, since when exporting settings exports mac address settings? Its never been a case, nor does it the case here (double checked config file).
Also I said I get disconnected when ethernet interface gets added to bridge, not created.

When you import the config using /import file from terminal, what error message does it print?
None, as I get disconnected after ether5 gets added to bridge1 (ether5 is the interface I'm connected through when I set up mikrotik via winbox)
Try adding verbose=yes to make it print the file while importing and see where it fails.
I'm aware of that option and tried to use it, however I still get disconnected and config.rsc file still does not get proceeded all the way to the end (as I mentioned previously, firewall rules are not there after reconnect), so I don't know if there's any output.
With the "reset configuration and run-after-reset, there is a known problem (for years, I think it was never fixed) that the import starts too early, before the system is "up" and all interfaces have been detected, and the import fails when it tries to configure a device that is not ready yet.
A dirty workaround is to manually add a line "/delay 30" at the top of the config file before you upload it.
Good to know, thanks. If there's no other fix to import process (with or without reset configuration I might use delay option.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10223
Joined: Mon Jun 08, 2015 12:09 pm

Re: Can't import config on some routers

Fri Oct 08, 2021 12:10 pm

Just yesterday I migrated the config from a RB2011 router to a RB4011.
These are similar in port structure, yet still there are some differences.
I exported the 2011 config and edited it to overcome that:
- removed references to lcd and leds
- the SFP port has a different name, edited that
- the 2G wifi is wlan1 in the 2011, wlan2 in the 4011
- of course I wanted to change the MAC address of bridge and wifi interfaces, edited

Now I connected to the new router with a laptop connected to ether2 in MAC address mode, reset the config (no defaults), connected again after the reboot, uploaded the export.rsc file (quite complicated, 50K) and did:
/import verbose=yes export.rsc

This proceeded without any error, and the config was perfectly OK.
So it can be done. But not in 1 try, and probably also not by someone without detailed knowledge about the issues.

In my opinion MikroTik should add a feature or tool to facilitate migration of config "from an old to a new router", given the fact that you should never use backup for this purpose, and export/import is so finicky.
This could likely also be useful for mass deployment of similar configs to routers.
 
Charg
newbie
Topic Author
Posts: 30
Joined: Wed Apr 07, 2021 11:49 am

Re: Can't import config on some routers

Fri Oct 08, 2021 1:37 pm

I export config from same model (Chateau LTE12, D53G-5HacD2HnD) same firmware (7.0.3 now) device.

My current steps:
  • connect to mikrotik device with latest version of winbox (with cord attached to ether5 interface)
  • system-reset it with no default config checkbox, it gets me disconnected (expectedly)
  • reconnect via neighbour tab
  • upload 123.rsc to files menu
  • run /import file=123.rsc
  • here i expect routeros to execute this script entirely, and either with or without disconnecting me - full set of commands had to be executed - this does not happen
Content of 123.rsc is very basic:
/interface bridge
add comment=defconf name=bridge1
/interface ethernet
set [ find default-name=ether1 ] comment=uplink
/interface lte
set [ find ] allow-roaming=no name=lte1
/interface wireless
set [ find default-name=wlan1 ] country=ukraine disabled=no mode=ap-bridge ssid=wifi wireless-protocol=802.11
set [ find default-name=wlan2 ] country=ukraine disabled=no mode=ap-bridge ssid=wifi wireless-protocol=802.11
/interface list
add comment=defconf name=WAN
add comment=defconf name=LAN
/interface bridge port
add bridge=bridge1 comment=defconf disabled=yes interface=ether1
add bridge=bridge1 comment=defconf interface=ether2
add bridge=bridge1 comment=defconf interface=ether3
add bridge=bridge1 comment=defconf interface=ether4
add bridge=bridge1 comment=defconf interface=ether5

# whatever other commands are in config after this moment - do not get executed
# i get disconnected from winbox here, because I'm connected to router through ether5 interface
# commenting that part with adding ether5 to bridge does 'solve' importing issue, but I need that interface to be in bridge

/whatever executed=no because=who_knows_why
#this never gets executed
 
pe1chl
Forum Guru
Forum Guru
Posts: 10223
Joined: Mon Jun 08, 2015 12:09 pm

Re: Can't import config on some routers

Fri Oct 08, 2021 2:13 pm

Ok this is like what I did on the 4011 and it worked for me.
I presume you connected via MAC address. It may be advisable to use port 2 instead of 5 and also to include an admin-mac in the bridge that is the same as the ether2 MAC address, because if you do not the MAC of the bridge will change during port changes which may confuse winbox.
 
User avatar
rextended
Forum Guru
Forum Guru
Posts: 12001
Joined: Tue Feb 25, 2014 12:49 pm
Location: Italy
Contact:

Re: Can't import config on some routers

Fri Oct 08, 2021 2:31 pm

@Charg
/interface bridge
# REPLACE
add comment=defconf name=bridge1
# WITH
add comment=defconf name=bridge1 protocol-mode=none admin-mac=[/int ethernet get ether2 mac-address] auto-mac=no

/interface bridge port
# REMOVE THIS LINE --->>> add bridge=bridge1 comment=defconf disabled=yes interface=ether1
add bridge=bridge1 comment=defconf interface=ether2
add bridge=bridge1 comment=defconf interface=ether3
add bridge=bridge1 comment=defconf interface=ether4
# REMOVE THIS LINE --->>> add bridge=bridge1 comment=defconf interface=ether5

# add this as last lines to the end of the script
/interface bridge port
add bridge=bridge1 comment=defconf interface=ether5
 
Charg
newbie
Topic Author
Posts: 30
Joined: Wed Apr 07, 2021 11:49 am

Re: Can't import config on some routers

Fri Oct 08, 2021 4:10 pm

I presume you connected via MAC address. It may be advisable to use port 2 instead of 5 and also to include an admin-mac in the bridge that is the same as the ether2 MAC address, because if you do not the MAC of the bridge will change during port changes which may confuse winbox.
Yes I am connected via MAC (Neighbour tab in winbox when connecting).
Why connect through ether2? Ether 2/3/4/5 ports configuration is the same, to my knowledge.
I've just tried it and behaviour is the same. Out of curiosity though, what was the logic behind that recommendation?
@Charg
/interface bridge
# REPLACE
add comment=defconf name=bridge1
# WITH
add comment=defconf name=bridge1 protocol-mode=none admin-mac=[/int ethernet get ether2 mac-address] auto-mac=no
Can you elaborate on why? From my understanding it'll copy whatever ether2 interface mac as bridge mac (and also some mode that I'm not aware of), but what is achieved by doing this?

I'm not trying to just fix the issue here but also understand what and why works :)
Last edited by Charg on Fri Oct 08, 2021 4:17 pm, edited 1 time in total.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10223
Joined: Mon Jun 08, 2015 12:09 pm

Re: Can't import config on some routers

Fri Oct 08, 2021 4:12 pm

I presume you connected via MAC address. It may be advisable to use port 2 instead of 5 and also to include an admin-mac in the bridge that is the same as the ether2 MAC address, because if you do not the MAC of the bridge will change during port changes which may confuse winbox.
Yes I am connected via MAC (Neighbour tab in winbox when connecting).
Why connect through ether2? Ether 2/3/4/5 ports configuration is the same, to my knowledge.
Because the bridge derives the MAC from the first available ethernet port so when you use ether2 it does not change under you when you work on the config.
But setting the admin-mac (either directly or using a clever trick like shown) you avoid this problem and it will probably work with ether5 as well.
 
Charg
newbie
Topic Author
Posts: 30
Joined: Wed Apr 07, 2021 11:49 am

Re: Can't import config on some routers

Fri Oct 08, 2021 4:20 pm



Yes I am connected via MAC (Neighbour tab in winbox when connecting).
Why connect through ether2? Ether 2/3/4/5 ports configuration is the same, to my knowledge.
Because the bridge derives the MAC from the first available ethernet port so when you use ether2 it does not change under you when you work on the config.
But setting the admin-mac (either directly or using a clever trick like shown) you avoid this problem and it will probably work with ether5 as well.
Oh, you replied before I've edited my message :)
Anyways I've tried reproducing my steps but this time plugging through ether2 - behaviour is still the same (with no modification to previously linked config).

I've also tried recommended method where adding ether5 (or whatever) interface to bridge1 as very last step - it does indeed work but thats more of a workaround rather than solution. Because now after every change in config I'd have to export config and then keep in my memory that I have to manually edit stuff like that in resultant script. That's pretty messy and I'd prefer to avoid doing that.
 
pe1chl
Forum Guru
Forum Guru
Posts: 10223
Joined: Mon Jun 08, 2015 12:09 pm

Re: Can't import config on some routers

Fri Oct 08, 2021 4:50 pm

As I explained in reply #7 I did the same thing yesterday and it worked fine for me.
Things I have different:
- I use protocol-mode=none on the bridge (so no spanning tree waiting time issues)
- I use an admin MAC address
- I connect to port ether2 which has the same MAC on the port as that admin MAC on the bridge.

Who is online

Users browsing this forum: No registered users and 13 guests