Community discussions

MikroTik App
 
User avatar
bigcw
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Mon Sep 08, 2014 2:38 pm

Mass configuration

Wed Sep 17, 2014 11:57 pm

Hi everyone

Hope I'm not missing something obvious here, but I'm struggling with configuring a whole load of RB951 2HnD's.

My plan was that I would configure one router, backup the configuration, and then restore it on a whole load of others.

However, it seems like the backup has MAC addresses hard coded into it which causes problems when the backup is restored on a different router. Same model, just a different physical unit.

I tried exporting the configuration, but that is the same - MAC addresses hard coded in.

Is there some way that this can be done without having to manually edit the file?

Cheers, Chris
 
ditonet
Forum Veteran
Forum Veteran
Posts: 835
Joined: Mon Oct 19, 2009 12:52 am
Location: Europe/Poland/Konstancin-Jeziorna
Contact:

Re: Mass configuration

Thu Sep 18, 2014 12:32 am

I tried exporting the configuration, but that is the same - MAC addresses hard coded in.
Removing 'mac-address' and 'orig-mac-address' from exported .rsc file is not enough?
You have to do this only once.
Below is link to utility which simplify editing of .rsc files:
http://wiki.mikrotik.com/wiki/Milliscript

HTH,
 
User avatar
bigcw
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Mon Sep 08, 2014 2:38 pm

Re: Mass configuration

Thu Sep 18, 2014 1:12 am

I have tried to edit the 'backup' file, but it's mainly binary. The only cleartext bits are my scripts.

The issue seems to be that wlan1 doesn't get renamed, so then the bridge port doesn't come up. I had a problem with the script that auto-configures the wireless but I got around that by using [find default-name="wlan1"]

So i tried 'export file=test', downloaded that and I can edit it (it's in plain text). The only thing in there that looks router specific is the bridge setup...
/interface bridge
add admin-mac=4C:5E:0C:XX:XX:XX auto-mac=no l2mtu=1598 name=bridge-local
..the wireless looks to be fine. But clearly it isn't in the config generated by 'backup' which is what I really need to use as I don't fancy getting users to SSH into the routers.

So I guess my questions are:

1. Is there any way to edit a file generated by the backup command?

2. Does the 'export file=' command generate a different config to the (binary) backup?

Been pulling my hair out all evening trying to get to the bottom of this. What a nightmare!

Cheers, Chris
 
ditonet
Forum Veteran
Forum Veteran
Posts: 835
Joined: Mon Oct 19, 2009 12:52 am
Location: Europe/Poland/Konstancin-Jeziorna
Contact:

Re: Mass configuration

Thu Sep 18, 2014 1:56 am

I have tried to edit the 'backup' file, but it's mainly binary.
You are right, these files are binary and non-editable.
Only script files (.rsc) generated by 'export' command are editable.
Export your configuration, but use this command:
/export verbose file=test
Without 'verbose' switch only differences from default config are exported.
With 'verbose' switch full router configuration is exported.

HTH,
 
User avatar
stmx38
Long time Member
Long time Member
Posts: 618
Joined: Thu Feb 14, 2008 4:03 pm
Location: Moldova, Chisinau

Re: Mass configuration

Thu Sep 18, 2014 10:21 pm

 
User avatar
bigcw
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Mon Sep 08, 2014 2:38 pm

Re: Mass configuration

Mon Sep 22, 2014 1:19 pm

Thanks for the tips on this. I'm going to have another try at it today. Will report back with the results!

Chris
 
User avatar
bigcw
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Mon Sep 08, 2014 2:38 pm

Re: Mass configuration

Wed Sep 24, 2014 6:56 pm

Ok, I'm getting completely fed up with this now. I have 100 of these 951-2n routers sat in a box waiting to go out to clients. Any minute now they're going out of the window instead.

Try as I might, I just cannot get this to work.

Here's what I'm doing:

First, I created a simple script:
/ip firewall filter
remove 0
remove 1
remove 2
remove 3
remove 4
remove 5
remove 6
I save this as 'first.rsc'.

If I run this using the 'import' command on a clean router it works fine and removes the firewall rules.

So then I do:
/system reset-configuration skip-backup=yes run-after-reset=first.rsc
Router reboots but no IP addresses on either WAN or LAN side so I can't even log in to find out what is happening I have to factory reset using the reset switch.

I popped the router open and spotted 'tx' and 'rx' on the main board so I thought I'd be clever and solder on a serial header so I could see what was going on. However it looks like the serial port isn't enabled so that idea was out.

What am I doing wrong here? I can't believe something like this is so difficult - all I want to do is deploy the same config on multiple routers!
 
User avatar
bigcw
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Mon Sep 08, 2014 2:38 pm

Re: Mass configuration

Wed Sep 24, 2014 7:07 pm

Ok, so even this doesn't work...
export verbose file=second.rsc
/system reset-configuration skip-backup=yes no-defaults=yes run-after-reset=second.rsc
Again, no IP addresses after reboot. Only option is to factory reset.

If this doesn't work what chance is there that any modified file will. This is completely stupid.
 
ditonet
Forum Veteran
Forum Veteran
Posts: 835
Joined: Mon Oct 19, 2009 12:52 am
Location: Europe/Poland/Konstancin-Jeziorna
Contact:

Re: Mass configuration

Wed Sep 24, 2014 11:44 pm

Maybe this article will help you solve problem:
http://wiki.mikrotik.com/wiki/Flashfig

HTH,
 
User avatar
bigcw
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Mon Sep 08, 2014 2:38 pm

Re: Mass configuration

Thu Sep 25, 2014 2:17 pm

Maybe this article will help you solve problem:
http://wiki.mikrotik.com/wiki/Flashfig

HTH,
I think that is about 3 steps down the line. I need to get a working configuration first!
 
ditonet
Forum Veteran
Forum Veteran
Posts: 835
Joined: Mon Oct 19, 2009 12:52 am
Location: Europe/Poland/Konstancin-Jeziorna
Contact:

Re: Mass configuration

Thu Sep 25, 2014 8:21 pm

Ok, so even this doesn't work...

Code:
export verbose file=second.rsc
/system reset-configuration skip-backup=yes no-defaults=yes run-after-reset=second.rsc


Again, no IP addresses after reboot. Only option is to factory reset.
My advice is to divide this into two steps:
1. Reset RB configuration (with 'no-defaults=yes')
2. After reboot invoke 'import' command from terminal
This will show you which line of script file contains error(s).
Don't forget to reset config before you start import again.

HTH,
 
BobcatGuy
Member Candidate
Member Candidate
Posts: 240
Joined: Thu Apr 19, 2007 7:41 am

Re: Mass configuration

Fri Sep 26, 2014 6:23 am

Just an idea...

I too configured one device, as an AP, then backed up the config, and then restored it on another, yes the MAC addresses were the same, but you can click on reset mac address under the interface settings. Is some work, but probably quicker then the stress you have now? All I ddid was change the other one to STATION WDS and click reset MAC ADDRESS on the Ethernet interface ( thankfully it only had 1 and a SFP) the wireless had a bit of config on it too that needed to be changed to point to the new wireless card, but was quick. for one unit, 100 will be 100x 1 min :-) so in 2 hours you can have them all done.

Im sure there is an easier way, TFTP? Netistall..... sledge... beeer, whiskey?
 
User avatar
bigcw
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Mon Sep 08, 2014 2:38 pm

Re: Mass configuration

Mon Sep 29, 2014 1:18 pm

My advice is to divide this into two steps:
1. Reset RB configuration (with 'no-defaults=yes')
2. After reboot invoke 'import' command from terminal
This will show you which line of script file contains error(s).
Don't forget to reset config before you start import again.

HTH,
This is exactly what we are doing now to configure. The 'import' works perfectly, but if you try to do it automatically during a 'reset configuration' it does not.

I read somewhere about adding a 10s delay to the beginning of the script. Have also tried this but still no luck. The router doesn't get an IP address so there is no way of diagnosing the issue.

Chris
 
andyanthoine
newbie
Posts: 43
Joined: Wed Jun 12, 2013 3:41 am

Re: Mass configuration

Wed Oct 01, 2014 1:51 am

Ok man, i'll explain you what's wrong, pretty sure it will work. Sorry but i didn't try it, but i think i work with enough mikrotik to be sure of my answer ;)

What you should do is first, do a reset factory of your mkt, it will give you the default configuration.

/export the configuration

Then, in this file, remove the firewall part you don't want, save the file, put it in the mkt (and your 99 other mkt)

then, reset configuration with NO DEFAUT CONFIGURATION, and LAUNCH SCRIPT on startup.

It will load the "default" configuration you want, but without the firewall rules you don't want

Simple and easy.

PS : read a bit more how the scripts works, you can do some pretty cool thing with variables, etc

PS 2 : before anything if i can give an advice, update all your mikrotik to the last 6.19 version :)
 
ditonet
Forum Veteran
Forum Veteran
Posts: 835
Joined: Mon Oct 19, 2009 12:52 am
Location: Europe/Poland/Konstancin-Jeziorna
Contact:

Re: Mass configuration

Thu Oct 02, 2014 1:44 am

@bigcw
Probably problem occurs because you invoke command:

ros code

/system reset-configuration skip-backup=yes no-defaults=yes run-after-reset=second.rsc
with option no-defaults=yes.
In this case router is not set to factory default configuration, but everything is cleared.
http://wiki.mikrotik.com/wiki/Manual:Co ... tion_Reset
Just make test, run this

ros code

/system reset-configuration skip-backup=yes no-defaults=yes
and check router after restart.
You'll find interfaces with different names comparing to default configuration, hence problems with import.

HTH,
 
User avatar
43north
Member Candidate
Member Candidate
Posts: 208
Joined: Fri Nov 14, 2014 7:06 am

Re: Mass configuration

Sun Nov 30, 2014 8:59 pm

So did you ever get this working to mass configure all your routers?
 
gotsprings
Forum Guru
Forum Guru
Posts: 2118
Joined: Mon May 14, 2012 9:30 pm

Re: Mass configuration

Sun Nov 30, 2014 10:28 pm

You needed to look over your script file.

Adding remove "default" in any sections you script is making changes.

If you get it right...
Log into router.
Drag you script into files
Open new terminal
enter
/import file=whateveryoucalledit.rsc

If you got it right...
whole thing is done in seconds.

Or look at netinstall
 
User avatar
bigcw
Member Candidate
Member Candidate
Topic Author
Posts: 112
Joined: Mon Sep 08, 2014 2:38 pm

Re: Mass configuration

Fri Jan 02, 2015 6:10 pm

So did you ever get this working to mass configure all your routers?
No, I never got it working. In the end we SSH'd into every router and ran /import <file>.rsc. This worked, whereas 'run after reboot' didn't.

I never found out why it works that way but not the other We have deployed over 200x 951-2n routers using the SSH method but are currently out of stock!
 
User avatar
merlinthemagic7
Frequent Visitor
Frequent Visitor
Posts: 52
Joined: Fri Sep 16, 2016 8:49 pm

Re: Mass configuration

Wed Jul 11, 2018 12:18 am

bigcw, do you still need to automate the netinstall + custom script process?

I am thinking about turning our automated tool into a service, but maybe no one cares.

MM

Who is online

Users browsing this forum: Amazon [Bot], stef70 and 140 guests