info_i_25x25.png Due to unforeseen weather conditions we are experiencing higher chat wait times. Remember you can also submit a ticket and one of our support representatives will get back to you as soon as possible. We apologize for the inconvenience.

EdgeRouter - Archiving and Managing the Configuration Files


Overview


Readers will learn different ways to manage the EdgeOS configuration files using the Command Line Interface (CLI).

NOTES & REQUIREMENTS: Applicable to the latest EdgeOS firmware on all EdgeRouter models. Knowledge of the Command Line Interface (CLI) and basic networking knowledge is required. Please see the Related Articles below for more information.
 
Devices used in this article:

Table of Contents


  1. Saving and Loading Backup Configurations
  2. Commit Revisions and Archival
  3. Related Articles

Saving and Loading Backup Configurations


Back to Top

The EdgeRouter uses three configuration sets:

  • Boot/Startup Config: When the EdgeRouter reboots, it loads the boot/startup configuration (config.boot)
  • Active Config: Currently active configuration with changes that have not been saved to the boot/startup configuration yet.
  • Working Config: Non-active configuration with changes that have not been applied (committed) yet.

Use the following commands (in CLI) to make changes to the configuration:

  • set Adds a configuration statement from the device
  • delete Removes a configuration statement from the device
  • commit Applies any changes that were added with the set or delete commands
  • save Saves the active configuration to the boot/startup configuration

Typically, you use the save command to save the active configuration to the boot/startup configuration (config.boot). However, you can also save the active configuration to a different file or remote server.

NOTE: EdgeRouters boot from the default startup configuration file (config.boot).

If you wish to save the active configuration to a different file on the local device, follow the steps below:

1. Enter configuration mode.

[email protected]:~$ configure

2. Save the configuration to a different local file.

[edit] 
[email protected]# save ?
Possible completions:   <Enter>                               Save to system config file
  <file>                                Save to file on local machine

[edit]
[email protected]# save backupconfig.boot

Warning: saving configuration to non-default location '/config/backupconfig.boot

3. Verify that the backup file is saved to the config directory and optionally verify its contents.

[edit]
[email protected]# ls -l /config/
-rw-rw----    1 root     vyattacf      2874 Apr  1 22:24 config.boot
-rw-rw-r--    1 root     vyattacf      2757 Apr  2 13:43 backupconfig.boot

[edit]
[email protected]# cat /config/backupconfig.boot
firewall {
    all-ping enable
    broadcast-ping disable
<...output shortened...>

If you wish to save the active configuration to a remote device, follow the steps below:

1. Enter configuration mode.

[email protected]:~$ configure

2. Save the configuration to a remote machine using either TFTP, SCP, FTP or SFTP.

[edit] 
[email protected]# save ?
Possible completions:   scp://<user>:<passwd>@<host>/<file>   Save to file on remote machine
  sftp://<user>:<passwd>@<host>/<file>  Save to file on remote machine
ftp://<user>:<passwd>@<host>/<file> Save to file on remote machine
  tftp://<host>/<file>                  Save to file on remote machine

[edit]
[email protected]# save tftp://192.168.1.10/config.boot

Warning: saving configuration to non-default location 'tftp://192.168.1.10/config.boot'...
######################################################################## 100.0%
Done

 

If you wish to load a backup configuration from a remote device, follow the steps below:

1. Enter configuration mode.

[email protected]:~$ configure

2. Load the backup configuration from a local or a remote file.

[edit] 
[email protected]# load ?

Possible completions:
  <Enter>                               Load from system config file
  <file>                                Load from file on local machine
  scp://<user>:<passwd>@<host>/<file>   Load from file on remote machine
  sftp://<user>:<passwd>@<host>/<file>  Load from file on remote machine
ftp://<user>:<passwd>@<host>/<file> Load from file on remote machine
http://<host>/<file> Load from file on remote machine
tftp://<host>/<file> Load from file on remote machine

[edit]
[email protected]# load backupconfig.boot

Loading configuration from '/config/backupconfig.boot'...

Load complete. Use 'commit' to make changes active.

3. Compare the differences between the backup/working configuration and the active configuration.

[edit]
[email protected]# compare

4. Commit the changes

[edit]
[email protected]# commit

5. Save the active configuration to the startup/boot configuration.

[edit]
[email protected]# save

Saving configuration to '/config/config.boot'...

Commit Revisions and Archival


Back to Top

Instead of manually backing up and maintaining backup files, EdgeOS also supports an automatic remote backup feature. The commit-archive command allows you to automatically backup the configuration after each commit.

1. Enter configuration mode.

[email protected]:~$ configure

2. Automatically send committed configurations to a TFTP, SCP or FTP server:

[edit]
[email protected]# set system config-management commit-archive location ?
Possible completions:
  <uri>         Uniform Resource Identifier Detailed information:
    "scp://<user>:<passwd>@<host>/<dir>"
    "ftp://<user>:<passwd>@<host>/<dir>"
    "tftp://<host>/<dir>"

[edit]
[email protected]# set system config-management commit-archive location tftp://192.168.1.1/archive

3. Commit the changes.

[edit] 
[email protected]# commit

Archiving config... tftp://192.168.1.1/archive OK

You can also keep a specified number of commit revisions (configuration files) on the local device by using the commit‑revisions statement.

1. Enter configuration mode.

[email protected]:~$ configure

2. Specify the amount of revisions to keep.

[edit]
[email protected]# set system config-management commit-revisions 10

3. Commit the changes.

[edit] 
[email protected]# commit

4. Test the feature by enabling a random service.

[edit]
[email protected]# set service telnet port 23

[email protected]# compare
[edit service]
+telnet {
+ port 23
+}

[edit]
[email protected]# commit

[ service telnet ]
Starting the telnet service. Check /var/log/messages.

5. Verify the commit revision list.

[email protected]:~$ show system commit 
0 2018-04-02 22:07:58 by ubnt via cli
commit
1 2018-04-02 22:07:50 by ubnt via cli
commit
2 2018-04-02 22:07:50 by root via init
commit
NOTE: The currently active configuration is commit revision 0.

The following commands allow you to compare the different commit files.

  • show system commit List all the current commit revisions
  • show system commit diff <nr> Compare the difference between this commit and the previous commit.
  • show system commit file <nr> Display the contents of this commit configuration file.

It is possible to add comments to commits to easily see which revision added which feature:

[edit]
[email protected]# delete service telnet

[edit]
[email protected]# commit comment removed-telnet

[edit]
[email protected]# run show system commit
0 2018-04-02 22:18:07 by ubnt via cli
removed-telnet
1 2018-04-02 22:17:17 by ubnt via cli
commit
2 2018-04-02 22:17:08 by ubnt via cli
commit

Lastly, you can restore a previous configuration revision by using the rollback command.

[edit]
[email protected]# rollback ?

Possible completions:
<N> Rollback to revision N (currently requires reboot)

Revisions:
0 2018-04-02 22:18:07 ubnt by cli
1 2018-04-02 22:17:17 ubnt by cli
2 2018-04-02 22:17:08 ubnt by cli
3 2018-04-02 22:07:58 ubnt by cli
4 2018-04-02 22:07:50 ubnt by cli
5 2018-04-02 22:07:50 root by init

[edit]
[email protected]# rollback 2

Proceed with reboot? [confirm][y]

The system is going down for reboot NOW
NOTE: The rollback feature current requires the device to be rebooted.

Related Articles


Back to Top