Junos: How to show uncommitted changes and cancel them
Unlike other vendors CLI, Junos offers the possibility to enter multiple changes / commands and commit at the end, assuming all command are valid.
To check what has been changed, but uncommited in Junos configuration, go to cli top to be sure you inspect the whole hierarchy and do "show | compare". This will show the candidate configuration (I will discuss this later) and compare it to current commited configuration.
Example:
Code:
[edit security screen ids-option internet]
User@Host# top
[edit]
User@Host# show | compare
[edit security screen ids-option internet tcp syn-flood]
+ white-list asdf {
+ source-address 1.1.1.1/32;
+ destination-address 2.2.2.2/32;
+ }
[edit]
User@Host# rollback 0
load complete
[edit]
User@Host# show | compare
[edit]
User@Host#
The output is similar to the output from Unix "diff" command. + lines were added and new configuration was not commited.
Obviously, - lines mark linkes of configuration that have been removed from candidate and not yet commited.
Code:
[edit]
User@Host# delete interfaces ge-0/0/0
[edit]
User@Host# show | compare
[edit interfaces]
- ge-0/0/0 {
- gigether-options {
- 802.3ad ae0;
- }
- }
The "rollback 0" will delete the candidate configuration, canceling any changes done to it.