Junos Commit Confirmed and Rollback: Safe Configuration - 夜莺博客

Junos Commit Confirmed and Rollback: Safe Configuration

Junos separates candidate configuration from active configuration, and that model gives network engineers something Cisco IOS cannot: every committed configuration is kept as a rollback file, and a change that breaks remote access can undo itself automatically. The two tools that make this safe — commit confirmed for automatic rollback and the 49-slot rollback system — belong in every Junos engineer's change procedure. This guide explains both with real examples.

Why Junos Configuration Management Is Different

Editing Junos happens in a candidate configuration: changes are staged with set or edit commands and only take effect when you run commit. On commit, Junos stores the previous configuration as a rollback file — juniper.conf.1.gz becomes juniper.conf.2.gz and so on, up to a maximum of 49 rollback configurations. That archive is the safety net for every change below.

Commit Check Before You Commit

Validate syntax and semantics without applying anything:

user@router# commit check
configuration check succeeds

If the check fails, Junos reports the exact statement and line, and nothing changes. This catches typos, missing statements and semantic errors before they touch the live network.

Commit Confirmed: Automatic Rollback

For risky remote changes — a firewall filter on a management interface, a routing policy on the uplink — use commit confirmed. If you do not issue a confirming commit before the timer expires, Junos automatically rolls back to the previous configuration:

user@router# set interfaces ge-0/0/3 unit 0 family inet address 10.0.0.1/24
user@router# commit confirmed 5
commit confirmed will be rolled back in 5 minutes
user@router# commit

The default confirmation window is 10 minutes; the example above uses 5. As long as you still have access after the change takes effect, run a plain commit to confirm it permanently. If the change locks you out, the router rolls itself back when the timer expires — your management session returns and the change is gone. A worked walkthrough of letting the timer expire is published by the Network Curiosity blog on Junos commit confirmed.

Manual Rollback and Comparison

When a change survives but should not have, roll back manually. Find what changed first, then revert:

user@router> show configuration | compare rollback 1
user@router# rollback 1
user@router# commit
user@router> show system rollback ?

compare rollback 1 shows the diff between the candidate and the previous configuration; rollback 1 loads that configuration as the new candidate; a final commit applies it. The rollback file numbering means rollback 0 refers to the current committed configuration — useful for discarding uncommitted edits. Cisco IOS XR has a parallel commit/rollback model; see our IOS XR commit and rollback guide for the comparison. Junos configuration groups can shrink these changes further — our apply-groups guide shows how.

Operational Checklist

  • Always commit check before a confirming commit on production.
  • Use commit confirmed for any change that could cut your management path.
  • Document which rollback number corresponds to which change window.
  • Keep the 49-file archive in mind: heavy commit traffic eventually pushes old rollbacks out.

原文链接:https://www.juniper.net/documentation/us/en/software/junos/cli/topics/topic-map/junos-configuration-commit.html