Junos Help: On the Router?

Did you know you can get all the help you need right on a Juniper router? It’s true! This shouldn’t be especially surprising, when you consider the FreeBSD roots. Let’s take a quick look at the options available.Obviously the first thing we do is log into the router. If you are logging in as root, enter the Junos cli using the “cli” command. From there, we can check out the options under “help ?”:

cjones@R2> help ?
Possible completions:
  <[Enter]>            Execute this command
  apropos              Find help information about a topic
  reference            Reference material
  syslog               System log error messages
  tip                  Tip for the day
  topic                Help for high level topics
  |                    Pipe through a command

Let’s start with tip, because it’s simple and fun. With this command you simply type “help tip cli” and you’re given a randon Junos tip:

cjones@R2> help tip cli
JUNOS tip:
Use the 'apply-path' statement to define a prefix list containing
prefixes extracted from any configuration path.

Woo!

Okay, so now that we’re done playing around, we’ll get into the meat of the subject. First we’ll look at the “apropos” option. With this, we will see a list of commands that include the subject you enter. For example:

cjones@R2> help apropos ?
Possible completions:
                Help topic, regular expression, or command
cjones@R2> help apropos neighbor | match ospf
clear ospf neighbor
    Clear OSPF neighbors
clear ospf neighbor 
clear ospf3 neighbor
    Clear OSPFv3 neighbors
clear ospf3 neighbor 
    Name of OSPFv3 neighbor
show ospf neighbor
    Show OSPF neighbor status information
show ospf neighbor 
show ospf backup neighbor
    Show OSPF backup neighbors
show ospf3 neighbor
    Show OSPFv3 neighbor status
show ospf3 neighbor 
show ospf3 backup neighbor
    Show OSPFv3 backup neighbors
help topic ospf neighbor
help topic ospf dead-interval
help topic ospf3 dead-interval
help reference ospf neighbor
help reference ospf no-neighbor-down-notification
    Don't signal RSVP about down OSPF neighbors
help reference ospf dead-interval
help reference ospf3 neighbor
help reference ospf3 dead-interval

Notice that we used the pipe with the “match” function to only include the lines that match “ospf”. Very helpful indeed if you need to remember command syntax or a show command!

Next on our list is “reference“. This command allows us to read the Juniper documentation on a topic. In our example, we’ll look up information in the Juniper documentation about the OSPF metric command:

cjones@R2> help reference ospf metric
metric

  Syntax

     metric metric;

  Hierarchy Level

     [edit logical-systems logical-system-name protocols (ospf | ospf3) area
     area-id interface interface-name],
     [edit logical-systems logical-system-name protocols ospf area area-id
     interface interface-name topology (ipv4-multicast | name)],
     [edit logical-systems logical-system-name protocols ospf3 realm
     (ipv4-unicast | ipv4-multicast | ipv6-multicast) area area-id interface
     interface-name],
     [edit logical-systems logical-system-name routing-instances
     routing-instance-name protocols (ospf | ospf3) area area-id interface
     interface-name],
     [edit logical-systems logical-system-name routing-instances
     routing-instance-name protocols ospf area area-id sham-link-remote],
     [edit logical-systems logical-system-name routing-instances
     routing-instance-name protocols ospf area area-id interface
     interface-name topology (ipv4-multicast | name)],
     [edit logical-systems logical-system-name routing-instances
     routing-instance-name protocols ospf3 realm (ipv4-unicast |
     ipv4-multicast | ipv6-multicast) area area-id interface interface-name],
     [edit protocols (ospf | ospf3) area area-id interface interface-name],
     [edit protocols ospf area area-id interface interface-name topology
     (ipv4-multicast | name)],
     [edit protocols ospf3 realm (ipv4-unicast | ipv4-multicast |
     ipv6-multicast) area area-id interface interface-name],
     [edit routing-instances routing-instance-name protocols (ospf | ospf3)
     area area-id interface interface-name],
     [edit routing-instances routing-instance-name protocols ospf area
     area-id sham-link-remote],
     [edit routing-instances routing-instance-name protocols ospf area
     area-id interface interface-name topology (ipv4-multicast | name)],
     [edit routing-instances routing-instance-name protocols ospf3 realm
     (ipv4-unicast | ipv4-multicast | ipv6-multicast) area area-id interface
     interface-name]

  Release Information                   

     Statement introduced before Junos OS Release 7.4.
     Statement introduced in Junos OS Release 9.0 for EX Series switches.
     Support for Multitopology Routing introduced in Junos OS Release 9.0.
     Support for Multitopology Routing introduced in Junos OS Release 9.0 for
     EX Series switches.
     Support for the realm statement introduced in Junos OS Release 9.2.
     Support for the realm statement introduced in Junos OS Release 9.2 for
     EX Series switches.

  Description

     Specify the cost of an OSPF interface. The cost is a routing metric that
     is used in the link-state calculation.
     To set the cost of routes exported into OSPF, configure the appropriate
     routing policy.

  Options

     metric-Cost of the route.
         Range: 1 through 65,535
         Default: By default, the cost of an OSPF route is calculated by
     dividing the reference-bandwidth value by the bandwidth of the physical
     interface. Any specific value you configure for the metric overrides the
     default behavior of using the reference-bandwidth value to calculate the
     cost of route for that interface.

  Required Privilege Level

     routing-To view this statement in the configuration.
     routing-control-To add this statement to the configuration.

  Related-Topics

        * bandwidth-based-metrics
        * reference-bandwidth
        * Configuring the Metric Value for OSPF Interfaces
        * Configuring OSPF Sham Links
        * Configuring Multitopology Routing in OSPF

You can see how useful this could potentially be! Next up is “syslog“. This option gives an explanation of every single syslog event type:

cjones@R2> help syslog ?
Possible completions:
  <[Enter]>            Execute this command
           System log tag or regular expression
  ACCT_ACCOUNTING_FERROR  LOG_PFE,Error occurred during file processing
  ACCT_ACCOUNTING_FOPEN_ERROR  LOG_PFE,Open operation failed on file
  ACCT_ACCOUNTING_SMALL_FILE_SIZE  LOG_PFE,Maximum file size is smaller than record size
  ACCT_BAD_RECORD_FORMAT  LOG_PFE,Record format does not match accounting profile
  ACCT_CU_RTSLIB_ERROR  LOG_PFE,Error occurred obtaining current class usage statistics
  ACCT_FORK_ERR        LOG_PFE,Could not create child process
  ACCT_FORK_LIMIT_EXCEEDED  LOG_PFE,Could not create child process because of limit
  ACCT_GETHOSTNAME_ERROR  LOG_PFE,gethostname function failed
  ACCT_MALLOC_FAILURE  LOG_PFE,Memory allocation failed
  ACCT_UNDEFINED_COUNTER_NAME  ANY,Filter profile used undefined counter name
  ACCT_XFER_FAILED     LOG_PFE,Attempt to transfer file failed
  ACCT_XFER_POPEN_FAIL  LOG_PFE,File transfer failed
  ALARMD_CONFIG_ACCESS_ERROR  LOG_DAEMON,Alarmd could not parse configuration database
  ALARMD_CONFIG_CLOSE_ERROR  LOG_DAEMON,Closing of configuration database failed
  ALARMD_CONFIG_PARSE_ERROR  LOG_DAEMON,Parsing of configuration failed
  ALARMD_CONFIG_RECONFIG_ERROR  LOG_DAEMON,Reconfiguration failed
  ALARMD_CONNECTION_FAILURE  LOG_DAEMON,Alarmd connection to another process failed
  ALARMD_DECODE_ALARM_OBJECT_ERROR  LOG_DAEMON,Decoding of the alarm object failed
  ALARMD_EXISTS        LOG_DAEMON,Another alarmd was already running
  ALARMD_EXISTS_TERM_OTHER  LOG_DAEMON,Alarmd terminated an existing alarmd and exited
  ALARMD_IFDALARM_TYPE_ERROR  LOG_DAEMON,Alarmd could not recongnize IFD alarm type
...
  WEB_PIDFILE_LOCK     LOG_DAEMON,httpd-gk could not lock PID file
  WEB_PIDFILE_UPDATE   LOG_DAEMON,httpd-gk could not update PID file
  WEB_UNAME_FAILED     LOG_DAEMON,httpd-gk could not retrieve hostname
  WEB_WEBAUTH_AUTH_FAIL  LOG_DAEMON,web-authentication authentication failed
  WEB_WEBAUTH_AUTH_OK  LOG_DAEMON,web-authentication authentication success
  WEB_WEBAUTH_CONNECT_FAIL  LOG_DAEMON,web-authentication socket connect failed
  facility             System facility messages
  |                    Pipe through a command

Here’s some example output:

cjones@R2> help syslog ALARMD_EXISTS
Name:          ALARMD_EXISTS
Message:       alarmd already running; exiting
Help:          Another alarmd was already running
Description:   The alarm process (alarmd) exited because it discovered that another alarmd
               process was already running.
Type:          Event: This message reports an event, not an error
Severity:      error
Facility:      LOG_DAEMON

Nice to not have to Google this stuff, huh?

Finally, we’ll wrap up with the “topic” help option. This command will give you a full text description of the topic you select. Again, we’ll stick to OSPF metrics:

cjones@R2> help topic ospf metric
                Configuring the Metric Value for OSPF Interfaces

   All OSPF interfaces have a cost, which is a routing metric that is used in
   the link-state calculation. Routes with lower total path metrics are
   preferred over those with higher path metrics.
   When several equal-cost routes to a destination exist, traffic is
   distributed equally among them.
   The cost of a route is described by a single dimensionless metric that is
   determined using the following formula:
     cost = reference-bandwidth / bandwidth
   You can modify the reference-bandwidth value. The bandwidth value refers
   to the actual bandwidth of the physical interface.
   You can override the default behavior of using the reference bandwidth to
   calculate the metric cost of a route by configuring a specific metric
   value for any OSPF interface.
   To modify the reference bandwidth, include the reference-bandwidth
   statement:
     reference-bandwidth reference-bandwidth;
   For a list of hierarchy levels at which you can include these statements,
   see the statement summary sections for these statements.
   The default value of the reference bandwidth is 100 Mbps (which you
   specify as 100,000,000), which gives a metric of 1 for any interface with
   a physical bandwidth that is 100 Mbps or greater. For reference-bandwidth,
   you can configure a value from 9600 through 1,000,000,000,000 bits.
   For example, if you set the reference bandwidth to 1 Gbps (that is,
   reference-bandwidth is set to 1,000,000,000), a 100-Mbps interface has a
   default metric of 10.
   By default, the loopback interface (lo0) metric is 0. No bandwidth is
   associated with the loopback interface.
   When you specify a metric for a specific OSPF interface, that value is
   used to determine the cost of routes advertised from that interface. To
   specify a metric for routes advertised from an interface, include the
   metric statement:
     area area-id {
         interface interface-name {
             metric metric;
         }
     }
   For metric, you can specify a value from 1 through 65,535.

  Related-Topics

As you can see, the help system in Junos is fantastic and exceptionally well detailed. It’s also current, as it comes as part of the Junos install package for each release. It can also come in very handy during a JNCIE lab exam, where you’re starved for time!

Oh, I can’t help but include this here too, even though it’s not actually part of the help system. Junos has a hidden command that spits out bad poetry. No, really.

cjones@R2> show version and haiku
Hostname: R2
Model: srx210h
JUNOS Software Release [10.4R3.4]

        TTL down one
        the end nearer with each hop
        little packet, poof.

Yeah… you can have some fun with that one :)

One Response to “Junos Help: On the Router?”

  1. Excellent post – this was something I was just checking out the other day. Keep em’ coming!

Leave a Reply