Community discussions

MikroTik App
 
djmuk
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Jan 18, 2010 8:48 pm

'Boilerplate' configs

Tue Jul 06, 2010 2:58 pm

I want to set up a 'boilerplate' (template) config file that I can use as a base for configuring new units.

I have saved off the config from the first unit to my PC.

I edited the file to remove the mac addresses from the interface config lines.
I copied the template to the new unit
I 'imported' the config from / & got 'script loaded successfully'
BUT
the config is not right - The unit has NO ip address, winbox finds it on a MAC search but if the IP is 0.0.0.0 then it seems you can't connect to it even via mac winbox...

the units are running v4.9... but they are RB750 units so I don't have the option of a serial connection to find out what is wrong, the only way back is to default it & try again...

Shouldn't this work?

David
 
User avatar
sergejs
MikroTik Support
MikroTik Support
Posts: 6695
Joined: Thu Mar 31, 2005 3:33 pm
Location: Riga, Latvia
Contact:

Re: 'Boilerplate' configs

Tue Jul 06, 2010 3:31 pm

Just curious what is your config? Does it contain all output?
Perhaps it is better to make custom export, which will contain only specific configuration fields.

Config file is simple RouterOS console commands, which set configuration, so you need to make sure all variables are matching.
like /ip address add address=1.1.1.1/24 interface=ether3,
if there will be no ether3, configuration will not be imported further.
 
djmuk
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Jan 18, 2010 8:48 pm

Re: 'Boilerplate' configs

Tue Jul 06, 2010 4:29 pm

Well to make the config I went to the top level (/) on the terminal window & typed export <filename> so it should contain all config.

I assumed the order in the output would be the 'correct' order to enter the config commands but that may not be the case I suppose!
Interestingly when I pasted the config back in on the terminal it all went through OK - although I had duplicated config (Eg log targets were repeated) - so it may be a sequencing problem for the original export...

Anyway I went back to doing a 'backup' & restoring that onto the other devices and it seems to have worked OK and avoids the duplicates as it replaces the default config rather than adding to it.

Mac winbox does seem to work - don't know why it didn't earlier -maybe I didn't wait quite long enough for the ROS to startup!

I have done the 4 boxes now but if I do it again I think I will use the backup file & then write a short script to do the changes on each box - I would rather edit a script than remember which bits of the gui to go through!

David
 
fewi
Forum Guru
Forum Guru
Posts: 7717
Joined: Tue Aug 11, 2009 3:19 am

Re: 'Boilerplate' configs

Tue Jul 06, 2010 6:12 pm

http://wiki.mikrotik.com/wiki/Manual:Co ... escription
The restoration procedure assumes the cofiguration is restored on the same router, where the backup file was originally created, so it will create partially broken configuration if the hardware has been changed.
It's not recommended by the manual to restore a backup to different hardware.

I've not had any issues at all importing configuration files, but our template is not just taken from a '/export' run but was put together manually in the following order:
- static admin users
- interfaces
- IP addresses
- routing
- DHCP (pools, servers, then networks)
- DNS
- NTP
- firewall filters
- firewall mangle
- firewall NAT
- Hotspot
- RADIUS
- reconfigure Hotspot for RADIUS
- queues

Then all Hotspot directories are deleted and replaced with the default files we use, then SSL certificates are uploaded and imported. Then a last little script is run that reconfigures the Hotspots for SSL.

There's no specific reason for that order, it's just how the config grew - but it works just fine in that order for us.
 
djmuk
Frequent Visitor
Frequent Visitor
Topic Author
Posts: 54
Joined: Mon Jan 18, 2010 8:48 pm

Re: 'Boilerplate' configs

Tue Jul 06, 2010 7:02 pm

Well I would expect to at least be able to restore a backup onto the same model of router - otherwise the backup is not a lot of use.. "Oh my box has blown up oh & by the way the backup is useless as well...".

Especially as it is a binary file so you can't even 'read' it to get the config details out of it...

David
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26375
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: 'Boilerplate' configs

Wed Jul 07, 2010 11:07 am

You should always make three files - export, backup and supout.rif to be sure you have all config.

export should be only restored after editing out things you don't need. on this forum somebody posted an excellent tool to read and compare export files.
 
User avatar
Chupaka
Forum Guru
Forum Guru
Posts: 8709
Joined: Mon Jun 19, 2006 11:15 pm
Location: Minsk, Belarus
Contact:

Re: 'Boilerplate' configs

Wed Jul 07, 2010 6:49 pm

You should always make <...> supout.rif
?.. (O_o)
 
User avatar
normis
MikroTik Support
MikroTik Support
Posts: 26375
Joined: Fri May 28, 2004 11:04 am
Location: Riga, Latvia

Re: 'Boilerplate' configs

Thu Jul 08, 2010 7:58 am

Because it contains both backup and export, and if your own files are corrupted, support can help you extract it from supout.rif
 
rodolfo
Long time Member
Long time Member
Posts: 553
Joined: Sat Jul 05, 2008 11:50 am

Re: 'Boilerplate' configs

Thu Jul 08, 2010 11:27 pm

Who is online

Users browsing this forum: CrazyMonkey, GoogleOther [Bot], Jonty, linas and 90 guests