Monday, 21 April 2014

Lock, block and unravel

Some tricks in Junos


Are you using these advanced features in Junos?  Or at least they're advanced in that not everyone seems to know about them.

Protect


This is a very useful feature that was quietly added to Junos a couple of years ago.

Almost all routers have critical sections in the configuration file.  If someone changes one of these sections (well at least without using commit confirmed), the day will take a turn for the worse.

With Junos 12, the protect keyword was added to the CLI interface.  Once a section of the configuration file has been protected, it can't be changed, unless it is first unprotect'ed.

In the configuration file, look for the protect: marker in the text to show this.  In Routlets that section appears with a darker background in the editor and a padlock icon in the outline view.  A warning will be shown if you try to edit it.  There's also a shortcut key to easily turn on protection for one or more lines of configuration, once they are stable.

Deactivate


This has been in Junos since year dot, and is well worth knowing about if you've not already seen it.

To take a section of configuration out of action for a while (e.g. to turn off some traceoptions until the next investigation), use the deactivate command from the CLI.  The section is still there to be seen in the configuration file, but will be ignored by the routing engine.  When it is needed again, use the activate command.

In the configuration file, look for the inactive: marker in the text to show this.  It is possible to have both inactive: and protect: on the same section, though this isn't too useful.

In Routlets, an inactive section appears with the configuration text greyed out in both the editor and outline tree.  Sections can be toggled between active and inactive with Ctrl+Shift+I.

Annotate


If you need to remember why a section of the router configuration has been done the way it is, or leave an explanation of those OSPF timers for the next person to work with the router, Junos has the annotate command.  This adds a comment to that section of the configuration file.

There are a couple of tips to working with annotate in the Junos CLI.  Firstly, you need to use "quotes" if the annotation contains more than one word (exactly the same as adding a description to an interface for example):

        annotate routing-options static route 10.0.1.1 "Through to the lab"
       
Also, to remove an annotation, annotate the section with nothing (in quotes):

        annotate routing-options static route 10.0.1.1 ""

Routlets tries to encourage the use of annotations.  They are very easy to use - just press Ctrl+Shift+A anywhere in the configuration section and start typing.  Once the annotation is there, Routlets will include that text in the outline view of the configuration tree, as a signpost to you or the next visitor.

Summary


These tricks in Junos add a lot of structure to the task of looking after router configurations.  They also make it easier for another engineer to make sense of a router configuration - to see which bits to edit at his or her peril, and to see why the configuration is the way it is.

This section in the tour of Routlets says more about how to take advantage of these features.  The visual indicators in the editor make them easier to see and review, and the hotkeys make them quick and easy to use.

No comments:

Post a comment