Mass configuration

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

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,

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

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,

Difference between backup and export-how to monitor changes

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

Chris

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!

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.

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!

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,

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 :slight_smile: so in 2 hours you can have them all done.

Im sure there is an easier way, TFTP? Netistall… sledge… beeer, whiskey?

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

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 :wink:

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 :slight_smile:

@bigcw
Probably problem occurs because you invoke command:
/system reset-configuration skip-backup=yes no-defaults=yes run-after-reset=second.rscwith 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:Configuration_Management#Configuration_Reset
Just make test, run this
/system reset-configuration skip-backup=yes no-defaults=yesand check router after restart.
You’ll find interfaces with different names comparing to default configuration, hence problems with import.

HTH,

So did you ever get this working to mass configure all your routers?

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

No, I never got it working. In the end we SSH’d into every router and ran /import .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!

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