Reverting to previous configurations using Rollback on Juniper

Rollback is something that you may always use it when working with the Juniper router. What is rollback exactly?

Whenever you make a commit, Juniper will save the configuration on the active configuration and will make a rollback copy as well.

Let me show you this here:

root@R1# rollback ?

Possible completions:

<[Enter]>            Execute this command

0                    2024-02-04 12:30:11 UTC by root via cli

1                    2024-02-03 18:08:55 UTC by root via cli

2                    2024-02-03 13:31:55 UTC by root via cli

3                    2024-02-03 13:19:33 UTC by root via cli

4                    2015-05-01 10:11:50 UTC by root via other

|                    Pipe through a command

As you see, I have already 5 rollbacks (from 0 to 4) where rollback 0 is the latest one, meaning that it contains the configuration of the last commit that I have done on this Juniper router.

By default, the Juniper router can have up to 50 rollbacks (from 0 to 49).

But what is the whole idea about the rollback?

Say that you had a good configuration and working properly, then you have adjusted the configuration and saved it, but this has failed to work well. What you can do, you can recall one of the oldest rollback that was working well (in our case it is Rollback 1) then the whole old configuration will be loaded on the router again.

Now we understand about the role of the rollback, let’s play a bit with the configuration. I will change the hostname on the router from R1 to R2:

root@R1# set system host-name R2


root@R1# show

## Last changed: 2024-02-04 12:51:51 UTC

version 14.1R4.8;

system {

host-name R2;

This has been changed but only on the candidate configuration because I did not yet saved the configuration.

Let’s compare now the candidate configuration to the active configuration:

root@R1# show | compare

[edit system]

–  host-name R1;

+  host-name R2;



The output shows that the hostname R1 was taken out and hostname R2 was added. Fair enough!!!!

Let’s say that I decided that I don’t want to change the hostname to R2, and wanted to go back to R1 (of course I am giving a simple example here which is the hostname, but this can be any other configuration that you change and you wish to revert back to how it was before the changes have happened).

All I can do, I will recall Rollback 0 and I will have to commit the configuration. Let’s do that:

root@R1# rollback 0

load complete


root@R1# commit

commit complete



Let’s issue a show command now and see what is the hostname on the candidate configuration:

root@R1# show

## Last changed: 2024-02-04 12:58:57 UTC

version 14.1R4.8;

system {

host-name R1;

Indeed, it has been changed to R1 😊

As I have said, it is possible to have up to 50 rollbacks on the Juniper router (this can be decreased if you wish). Let’s say that you aren’t sure which rollback you should go to and you think that rollback 4 is the right configuration that you should use but you are not sure. You can go to the operational level and check what is the configuration that rollback 4 has as the following:

root@R1> show system rollback 4

## Last changed: 2024-02-03 13:19:28 UTC

version 14.1R4.8;

system {

root-authentication {

encrypted-password “$1$3hHX87WB$VlIPrcgAMz9TInBYol9.U/”; ## SECRET-DATA


login {

user Maher {

uid 2000;

class super-user;

authentication {

encrypted-password “$1$wW/SanCa$iUwSNEfjqKaY3TmmvhxGO.”; ## SECRET-DATA




syslog {

user * {

any emergency;


file messages {

any notice;

authorization info;


Doing so, you can know what rollback 4 contains as configuration then if it is the right one you can just recall it as I have done in the previous point.

This is all what I wanted to explain about rollback on Juniper Junos, hope you enjoyed it and see you in the upcoming lesson 😊

Course Content


Submit a Comment

Your email address will not be published. Required fields are marked *

The reCAPTCHA verification period has expired. Please reload the page.