Trying to import a configuration but get errors. Not understanding what to delete in the configuration file.

I have two RB2011 units both running the same OS version v6.39. On one unit I used Quick set to configure the router (so nothing fancy).
I then went to terminal and did a export file=testconfig ( I also tried a export compact file=testconfig2 but still had import issues)

On my other unit I then upload the file to the device and then did a
import file=testconfig verbose=yes
and get errors on the import
I can start deleting lines but am unsure if I delete all of the lines it complains about then how does anything get loaded?
For example on this line
“add name=dhcp ranges=192.168.20.10-192.168.20.99”
I get and error of “failure: pool with such name exists”

If I run "system reset-configuration no-defaults=yes " as suggested in another post
and then do the import then that works but it forces you to use Winbox to talk to the device after the reset.

So is there some simpler method to do this export/import stuff and not have to totally reset the unit?
I read the Manual:Configuration Management page on the wiki and the section "Configuration parts to watch out for in exported .rsc files " but that does not seem to cover all of the sections I am having problems importing.

Can I put something in the start of the script that clears it all out and then have it do a load from there on so I do not have to use Winbox?

So I need some guidance on how to know what to change in the .rsc file so I can load it in or is there some other save/load process I should be using.

Just for reference here is what is in my .rsc file with no deletes
"# may/02/2017 14:04:27 by RouterOS 6.39

software id = APBM-IF7K

/interface bridge
add admin-mac=6C:3B:6B:73:4C:EF auto-mac=no comment=defconf fast-forward=no
name=bridge
/interface ethernet
set [ find default-name=ether2 ] name=ether2-master
set [ find default-name=ether3 ] master-port=ether2-master
set [ find default-name=ether4 ] master-port=ether2-master
set [ find default-name=ether5 ] master-port=ether2-master
set [ find default-name=ether6 ] name=ether6-master
set [ find default-name=ether7 ] master-port=ether6-master
set [ find default-name=ether8 ] master-port=ether6-master
set [ find default-name=ether9 ] master-port=ether6-master
set [ find default-name=ether10 ] master-port=ether6-master
/ip neighbor discovery
set ether1 discover=no
/ip pool
add name=dhcp ranges=192.168.20.10-192.168.20.99
/ip dhcp-server
add address-pool=dhcp authoritative=after-2sec-delay disabled=no interface=
bridge name=defconf
/interface bridge port
add bridge=bridge comment=defconf interface=ether2-master
add bridge=bridge comment=defconf interface=ether6-master
add bridge=bridge comment=defconf interface=sfp1
/interface l2tp-server server
set caller-id-type=ip-address
/ip address
add address=192.168.1.1/19 comment=defconf interface=ether2-master network=
192.168.0.0
/ip dhcp-client
add comment=defconf dhcp-options=hostname,clientid disabled=no interface=
ether1
/ip dhcp-server network
add address=192.168.0.0/19 comment=defconf gateway=192.168.1.1 netmask=19
/ip dns
set allow-remote-requests=yes
/ip dns static
add address=192.168.1.1 name=router
/ip firewall filter
add action=accept chain=input comment=“defconf: accept ICMP” protocol=icmp
add action=accept chain=input comment=“defconf: accept established,related”
connection-state=established,related
add action=drop chain=input comment=“defconf: drop all from WAN”
in-interface=ether1
add action=fasttrack-connection chain=forward comment=“defconf: fasttrack”
connection-state=established,related
add action=accept chain=forward comment=“defconf: accept established,related”
connection-state=established,related
add action=drop chain=forward comment=“defconf: drop invalid”
connection-state=invalid
add action=drop chain=forward comment=
“defconf: drop all from WAN not DSTNATed” connection-nat-state=!dstnat
connection-state=new in-interface=ether1
/ip firewall nat
add action=masquerade chain=srcnat comment=“defconf: masquerade”
out-interface=ether1
/lcd
set time-interval=hour
/system clock
set time-zone-name=America/New_York
/tool mac-server
set [ find default=yes ] disabled=yes
add interface=bridge
/tool mac-server mac-winbox
set [ find default=yes ] disabled=yes
add interface=bridge "

Thanks
Tom

Just think what happens if you are adding anything where already something is… Therefore you have to clear the config before whole import otherwise you are creating a mess.

Ok then is there a way to put the clear command in the import file so I can just have the import process do the clear then import all of the settings?

IE is it ok to just put the :
"system reset-configuration no-defaults=yes "
as the first line in the file??

I have also seen on some other forum threads about making sure you take out the lines that would change the Mac address.
So are these the lines I have to remove?
“/interface bridge
add admin-mac=6C:3B:6B:73:4C:EF auto-mac=no comment=defconf fast-forward=no
name=bridge”

But if I remove them will I be then missing the "auto-mac=no comment=defconf fast-forward=no " changes??

Thanks
Tom

I suggest to reset router with no-dafault configuration and then all the stuff from these lines:

/interface bridge
add admin-mac=6C:3B:6B:73:4C:EF auto-mac=no comment=defconf fast-forward=no name=bridge
/interface ethernet
set [ find default-name=ether2 ] name=ether2-master
set [ find default-name=ether3 ] master-port=ether2-master
set [ find default-name=ether4 ] master-port=ether2-master
set [ find default-name=ether5 ] master-port=ether2-master
set [ find default-name=ether6 ] name=ether6-master
set [ find default-name=ether7 ] master-port=ether6-master
set [ find default-name=ether8 ] master-port=ether6-master
set [ find default-name=ether9 ] master-port=ether6-master
set [ find default-name=ether10 ] master-port=ether6-master
/interface bridge port
add bridge=bridge comment=defconf interface=ether2-master
add bridge=bridge comment=defconf interface=ether6-master
add bridge=bridge comment=defconf interface=sfp1

do manually.

Import process does not like (it is my experience):

  • changing interface names and there should be no mac addresses as they are probably invalid in the new device.
  • changes to port names with "set [ find default-name=ether4 ] … " command.

Winbox disconnects if you change master interface of the port you are connected to.

I always rename and configure my ports manually and then import all other commands/settings.

I am confused by your answer…
You say "- changing interface names and there should be no mac addresses as they are probably invalid in the new device. "

Yet you also say I should manually do this:
"/interface bridge
add admin-mac=6C:3B:6B:73:4C:EF auto-mac=no comment=defconf fast-forward=no name=bridge "

This command seems to set a static Mac address for the bridge and turn auto off.
If I am trying to setup up multiple routers all with similar setup would it not just be better to do auto-mac=yes ??

Thanks
Tom

Tom,
I am very interested in doing the same thing. Did you find the solution? I don’t quite understand the instructions exactly as you do not.
Kenny

Sorry for long delay.

I mean that if you have rules which depends on MAC addresses of interfaces then you need to tailor such rules before import as ROS will refuse to import them because of MAC mismatches as new device’s interfaces have them different.

Easy importable:

set [ find default-name=ether1 ] l2mtu=4032 mtu=4000 name=ETH1

Not so easy importable:

set [ find default-name=ether1 ] mac-address=E4:8D:8C:XX:YY:ZZ l2mtu=4032 mtu=4000 name=ETH1

My experience shows that if you execute import script from Winbox and this script changes names of interfaces during import then you undoubtedly will be disconnected if you are connected to one of them. It should not be a case if you execute script as reboot script but I am not sure if it true assumption.