proper way to restore configs in routeros

Discussion in 'Networking & Security' started by goodcooper, Oct 6, 2014.

  1. goodcooper

    goodcooper [H]ardForum Junkie

    Messages:
    10,286
    Joined:
    Nov 4, 2005
    So i've been working on this project, got a config i've been editing for different routers, and it seems like 75% of the time the restore fails... (reboots to no activity on all ports, have to reset and access via layer 2)

    i allow the default config to go through, then i upload my script and issue the command:

    /system reset-config keep-users=no no-defaults=yes skip-backup=yes run-after-reset=config.rsc


    i was thinking the failures i was experiencing were relating to the OS versions on the different devices (all RB2011il, but bought at different times)

    is that the case? i noticed if i restored from a binary backup it would work.... but then i had to go manually change all the configuration, super tedious...


    so i'm just assuming i'm going about this process all wrong...

    tips?
     
  2. goodcooper

    goodcooper [H]ardForum Junkie

    Messages:
    10,286
    Joined:
    Nov 4, 2005
    come on now, i know we got several RouterOS aficionados on this forum
     
  3. NickOlsen8390

    NickOlsen8390 [H]Lite

    Messages:
    126
    Joined:
    Sep 24, 2009
    Sounds like something is wrong with the config, If it's rebooting to no connectivity. I'd remove any reference to MAC addresses you might have. So that it doesn't try to replace the MAC on the interface or bridge (You could run in to duplicates if it doesn't regenerate them correctly).

    When I restore a router (I do many of them.. WISP), I just copy paste parts of it by hand into terminal. Obviously skipping the parts that are going to disconnect me. Like bridge configurations..etc. And never seem to have any issues. But I've never tried restoring via file like you are. I'd be willing to test it for you tomorrow if you wanted to give me some more specifics.

    Such as, Just export the config of a working router in place. Then try to restore it. With no changes.

    I'd stay away from the binary "Backup button" backup. It doesn't work well if you start jumping hardware type (RB2011 to RB951 for instance).
     
  4. /usr/home

    /usr/home [H]ardness Supreme

    Messages:
    6,190
    Joined:
    Mar 18, 2008
    I've had this issue. You need to remove any MAC address reference in the configuration. I do exports then it doesn't save MAC addresses. They are also plaintext and can be manually edited if there are problems. ONLY restore the rsc file to the exact router it came from.
     
  5. goodcooper

    goodcooper [H]ardForum Junkie

    Messages:
    10,286
    Joined:
    Nov 4, 2005
    i'll have to give this a try...


    so that's my question.... so if you're only supposed to restore the rsc file to the exact router it came from, how am i supposed to easily configure like.... 10 different routers that (all the same model) bought at different times... that generally have identical configs save for IP addresses, hostnames, small stuff like that...

    is there another mikrotik tool i should be using?
     
  6. /usr/home

    /usr/home [H]ardness Supreme

    Messages:
    6,190
    Joined:
    Mar 18, 2008
    The export command from command line.
     
  7. NickOlsen8390

    NickOlsen8390 [H]Lite

    Messages:
    126
    Joined:
    Sep 24, 2009
    Exporting the backup to file creates a .rsc file. That can be opened with a text editor.

    /export file=backup

    Will create a file local on the router called backup.rsc

    Now. Not to be confused with the binary backup. That can be done with /system backup name=backup. Creates a file called "backup.backup" Or by clicking the "Backup" button in the files window.

    The .rsc CAN be restored to other hardware. But I always copy paste section by section.

    the .backup binary file CAN also be restored to other devices. But it breaks 9-10 times. So I highly discourage it.

    Further more, You surly can have a template that can be applied to "like" routers. We have such templates for routers of our own. That we deploy thousands of. You just have to sanitize the config first, Removing everything but the meat of the config. Remove MAC's...etc.
     
  8. goodcooper

    goodcooper [H]ardForum Junkie

    Messages:
    10,286
    Joined:
    Nov 4, 2005
    ok, i guess i've got it right then...


    what about software versions, does it matter what version the software on the router is at when i'm restoring configs from older or newer versions?
     
  9. /usr/home

    /usr/home [H]ardness Supreme

    Messages:
    6,190
    Joined:
    Mar 18, 2008
    Not really, unless you are using a feature that was put into a later version and you are using it but the older version doesn't have it. I'm guessing it would just error on that command though.
     
  10. NickOlsen8390

    NickOlsen8390 [H]Lite

    Messages:
    126
    Joined:
    Sep 24, 2009

    Correct, If your using a feature the current router doesn't support for any reason, Package not enabled. Feature only available in later builds..etc. It'll just throw an error and continue with the import.

    Now, If you open the .rsc files. In recent builds (>5.xish) they started only exporting changes. Where previous builds would export everything. So starting from a default config before import is encouraged.
     
  11. goodcooper

    goodcooper [H]ardForum Junkie

    Messages:
    10,286
    Joined:
    Nov 4, 2005
    yea, i'm noticing that, which is sort of a problem...

    if i restore from no config, it will not work at all... i must restore from the default config, which is fine, besides the fact that i'm changing some IPs in some places and so it errors out unless i delete some things first

    it's crazy that there isn't a more elegant way of doing this....

    i love how with the edgerouter, the vyatta method, i can just dump a config that's in a certain nested format, has the entire thing in it, and i can just use a text editor to edit the things to my liking, and then just upload it and it will work... this copying and pasting and watching out for overwriting errors and etc, is just such a pain...
     
  12. NickOlsen8390

    NickOlsen8390 [H]Lite

    Messages:
    126
    Joined:
    Sep 24, 2009

    I'm surprised your having such a problem with it. Maybe I've just learned the ways over the years but I don't ever seem to have any issues. Maybe you can provide me a copy of the config you are trying to restore (Sensitive info redacted of course). I reload some pretty lengthy configs regularly..