Sunday 30 September 2012

How to hide configuration?


JUNOS TIP: An often forgotten or unnoticed Junos tip is that you can hide common pieces of configuration in everyday use by setting apply-flags omit in the hierarchy you want to omit, like so:

[edit]
user@device# set system apply-flags omit

[edit]
user@device# show
## Last changed: 2011-05-02 17:24:51 UTC
version 10.3R1.9;
system { /* OMITTED */ };
logical-systems {
[...]

After committing, a show system in configuration mode will still show the whole stanza and editing works just as it usually does:

[edit]
user@device# show system
apply-flags omit;
host-name device;
root-authentication {
encrypted-password "$1$KI99zGk6$MbYFuBbpLffu9tn2.sI7l1"; ## SECRET-DATA
[...]

Use show | display omit in the top of configuration to show the entire configuration without omitting sections:

[edit]
user@device# show | display omit
## Last changed: 2011-05-02 17:24:51 UTC
version 10.3R1.9;
system {
apply-flags omit;
host-name device;
root-authentication {
encrypted-password "$1$KI99zGk6$MbYFuBbpLffu9tn2.sI7l1"; ## SECRET-DATA
[...]

This tip is useful for hiding long, uninteresting, static pieces of various configurations.