Juniper Backing Up the Router’s Configuration
You want to back up the router’s configuration to a remote server.
You can use the following command to copy the active configuration file to a server:
source@router1> file copy /config/juniper.conf.gz server1:/homes/aviva/tmp
aviva@server1’s password:
juniper.conf.gz 100% 2127 2.1KB/s 00:00
From configuration mode, use the save command to copy the candidate configuration to your home directory on a server:
[edit]
source@router1# save server1:configuration-march02
source@server1’s password:
tempfile 100% 11KB 11.2KB/s 00:00
Wrote 433 lines of configuration to ‘server1:configuration-march02’
You can also save it to a file in your home directory on the router:
[edit]
source@router1# save configuration-march02
Wrote 433 lines of configuration to ‘configuration-march02’
aviva@router1# run file list
/var/home/aviva:
.ssh/
configuration-march02
Use the file show command to verify the contents:
[edit protocols bgp]
source@router1# run file show configuration-bgp-march02
protocols {
replace:
bgp {
export send-statics;
group internal {
type internal;
local-address 10.0.0.1;
neighbor 10.0.0.2;
neighbor 10.0.0.3;
neighbor 10.0.0.5;
neighbor 10.0.0.4;
neighbor 10.0.0.6;
}
}
}
source@router1> file list /config
/config:
juniper.conf.1.gz
juniper.conf.2.gz
juniper.conf.3.gz
juniper.conf.gz
license/
rescue.conf.gz
The remaining configurationsnamed juniper.conf.4.gz through juniper.conf.49.gz are in the /var/db/config directory on the router’s hard disk.
These files are also compressed.
source@router1> file list /var/db/config
/var/db/config:
juniper.conf++
juniper.conf.10.gz
juniper.conf.11.gz
juniper.conf.12.gz
juniper.conf.13.gz
juniper.conf.14.gz
juniper.conf.15.gz
…
juniper.conf.49.gz
juniper.conf.5.gz
juniper.conf.6.gz
juniper.conf.7.gz
juniper.conf.8.gz
juniper.conf.9.gz
Each time you commit a configuration, that configuration is named juniper.conf.gz, the existing juniper.conf.gz file is renamed juniper.conf.1.gz, and all the remaining numbered configurations from before are renumbered. This means that the JUNOS backup configuration files are continually renamed. This behavior points out one advantage of using the save command: it allows you to store the configuration in a file with a fixed name.