User Interfaces · Topic 3 of 4

Candidate Configuration, Commit and Rollback

Learn the Junos active and candidate configurations, commit check, commit confirmed, commit at, and rollback 0 to 49 for the JNCIA-Junos JN0-106.

  • 5 min
  • Includes a diagram
In a nutshell
  • The device runs the active configuration; you edit the candidate.
  • A commit validates syntax and semantics; if it fails, the active configuration is unchanged.
  • Rollback 0 is the active configuration; Junos keeps rollback 0 to 49, 50 versions in all.

What it is

Junos never changes the running device the moment you type a command. You edit a candidate configuration, a working copy, and the device keeps running on the active configuration until you commit.

Every commit saves the previous version. Rollback loads one of those saved versions back into the candidate, so you can undo a bad change with one command and a commit.

Active configurationconfigureCandidateworking copyset and deleteCandidatechangedcommitNew activerollback 0

How it works

Active and candidate

Active configurationCandidate configuration
What it isThe configuration the device is runningA copy you edit in configuration mode
Rollback numberAlways rollback 0No number until committed
Viewed withshow configuration in operational modeshow in configuration mode
Changed byA successful commit onlyset, delete, load, rollback and other edits

When you enter configuration mode, Junos gives you a candidate that starts as a copy of the active configuration. In shared configure mode, uncommitted changes stay in the candidate after you exit, so the next user sees them.

show | compare in configuration mode lists what you changed. Lines starting with + are added and lines starting with - are removed.

[edit]
user@R1# show | compare
[edit system]
-  host-name R1;
+  host-name R1-EDGE;

What a commit does

The candidate configuration is edited with set, delete and load. A commit that passes the checks makes it the active configuration, rollback 0; at the next commit it becomes rollback 1, then rollback 2, up to rollback 49. A commit first checks the candidate for syntax and for semantic errors, such as a reference to a policy that does not exist. If the check fails, Junos shows the error and the active configuration does not change.

If the check passes, the candidate becomes the new active configuration (rollback 0). The old active becomes rollback 1, the one before becomes rollback 2, and so on.

Commitcheck passesCandidate becomesrollback 0older versions shiftOld activebecomes rollback 1

Commit options

CommandEffect
commitChecks and activates the candidate
commit checkChecks the candidate only; nothing is activated
commit confirmedActivates, then rolls back automatically after 10 minutes unless you confirm
commit confirmed <minutes>Same, with your own timer
commit comment "<text>"Stores a comment with this commit in the history
commit and-quitCommits and leaves configuration mode
commit at "<time>"Schedules the commit for a later time
commit synchronizeOn a device with two Routing Engines, commits on both

To confirm a commit confirmed, issue another commit before the timer runs out. If you do not, Junos restores and commits the previous configuration by itself. That is your safety net when a change might cut off your own remote session.

A scheduled commit at can be cancelled with clear system commit in operational mode. show system commit lists the commit history with the time, the user and any comment.

Exam tip

Use commit confirmed whenever you change anything that carries your own SSH session, such as the management address, a firewall filter or a routing policy. If you lock yourself out, the device rolls back in 10 minutes by default.

Rollback

Junos keeps up to 50 configurations: the active one (rollback 0) and up to 49 earlier ones (rollback 1 to 49).

CommandEffect
rollbackSame as rollback 0; discards all uncommitted changes
rollback 0Reloads the active configuration into the candidate
rollback <n>Loads version n into the candidate
rollback ?Lists the saved versions with date, time, user and method

To see how the candidate differs from a saved version before you load it, use show | compare rollback <n>. Rollback only changes the candidate. You must commit to make the older version active, and that commit itself creates a new rollback 0.

[edit]
user@R1# rollback 1
load complete

[edit]
user@R1# show | compare
[edit interfaces ge-0/0/1 unit 0 family inet]
-  address 10.1.1.2/24;
+  address 10.1.1.1/24;

[edit]
user@R1# commit
commit complete

The rollback numbers shift after every commit. The version that was rollback 1 before this commit is now rollback 2.

Rescue configuration in one line

There is also a rescue configuration, a known good version you save on purpose with request system configuration rescue save. You load it with rollback rescue and then commit. The Configuration Basics chapter covers it in more detail.

Common mistakes

Thinking rollback activates the old version. rollback n only loads it into the candidate. Nothing changes on the device until you commit.

Forgetting to confirm commit confirmed. If you do not issue a second commit in time, Junos rolls back your change even though it was working.

Thinking commit check activates anything. It only validates. The active configuration stays the same.

Counting rollback numbers wrong. Rollback 0 is the active configuration, not the previous one. The previous active configuration is rollback 1.

Watch out

In shared configure mode, rollback (rollback 0) discards every uncommitted change in the candidate, including changes other users made.

What to remember for the exam

  • The device runs the active configuration; you edit the candidate.
  • A commit validates syntax and semantics; if it fails, the active configuration is unchanged.
  • Rollback 0 is the active configuration; Junos keeps rollback 0 to 49, 50 versions in all.
  • rollback with no number equals rollback 0 and discards uncommitted changes.
  • rollback n changes only the candidate; you still need commit.
  • commit confirmed rolls back after 10 minutes by default unless you issue another commit.
  • commit check validates without activating; commit and-quit commits and leaves configuration mode.

Check yourself

  • Which rollback number is the configuration the device is running now?

    Rollback 0. The previous active configuration is rollback 1.

  • You ran commit confirmed 5 and lost your session. What happens?

    After 5 minutes without a confirming commit, Junos restores and commits the previous configuration.

  • Does rollback 2 change how the device is running?

    Not by itself. It loads version 2 into the candidate, and you must commit to activate it.

Topic 3 of 4 in User Interfaces

Test yourself on User Interfaces

The full Juniper JNCIA-Junos JN0-106 question bank has 1,155 questions, with timed practice exams and an explanation for every answer.

This study guide is independent and is not affiliated with, endorsed by, or sponsored by Juniper. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.