Monday, March 12, 2012

Export and Import Description

The export command prints a script that can be used to restore configuration. The command can be invoked at any menu level, and it acts for that menu level and all menu levels below it. If the argument "from" is used, then it is possible to export only specified items. The "export" does not descend recursively through the command hierarchy. "export" also has the argument "file", which allows you to save the script in a file on the router to retrieve it later via ftp.

The root level command /import file_name restores the exported information from the specified file. This is used to restore configuration or part of it after a 'system reset' event or anything that causes configuration data loss.

Export and Import Examples

[MikroTik] ip address> print
Flags: X - disabled, I - invalid, D - dynamic
  #   ADDRESS            NETWORK         BROADCAST       INTERFACE
  0   10.5.5.244/24      10.5.5.244      10.5.5.255      ether1
  1   10.5.5.245/32      10.5.5.245      10.5.5.245      ether1
  2   10.5.5.246/32      10.5.5.246      10.5.5.246      ether1
[MikroTik] ip address>

To make an export file use the following command:

[MikroTik] ip address> export file=address
[MikroTik] ip address>

To make an export file from only one item use the following command:

[MikroTik] ip address> export file=address1 from=1
[MikroTik] ip address>

To see the files stored on the router use the following command:

[MikroTik] file> print
  # NAME                           TYPE    SIZE       CREATION-TIME               
  0 address1.script                unknown 128        mar/26/2002 16:00:13
  1 address.script                 unknown 354        mar/26/2002 15:48:57
[MikroTik] file>

To export the setting on the display use the same command but without the 'file' argument:

[MikroTik] ip address> export from=0,2
/ ip address
add address=10.5.5.244/24 network=10.5.5.244 broadcast=10.5.5.255 interface=ether1
comment="" disabled=no
add address=10.5.5.246/32 network=10.5.5.246 broadcast=10.5.5.246 interface=ether1
comment="" disabled=no
[MikroTik] ip address>

To load the saved export file use the following command:

[MikroTik] > import
file-name: address1.script
[MikroTik] >

No comments:

Post a Comment