JUNOS: Useful Show Commands to Capture Data for Verification and Troubleshooting – Part 1

I saw couple of JUNOS related post on Packet Pushers, so I thought of writing about useful show commands that can be captured during verification or troubleshooting.

In the Juniper world, things are more focused on distributed infrastructure to achieve robust performance, so it’s better to mention it to gain a clear understanding of the system. Juniper routers are divided into two different parts, known as the control plane and the forwarding plane. The control plane is where your routing-related processes are running, and the forwarding plane is where actual forwarding of data takes place based on the information learned from the control plane. The control plane in a Juniper router is handled by the Routing Engine, while the forwarding plane is handled by forwarding cards known as Flexible PIC Concentrator (FPC) or Modular Port Concentrator (MPC) depending on which router you are using. PIC is a module which has physical ports to connect, and it can be built-in or modular, depending on the type of card you are using.

In this series, we will mostly focus on control plane data collection commands for various protocols or technologies. I might not be able to cover all the protocols or technologies, but I will try to cover basic things which can help you with day to day operations and verification. In this specific post, I will cover all the basic commands that you need to verify health check related information and basic routing information.

Always use “set cli timestamp” while you are provisioning, troubleshooting or capturing information from the router to log the time stamp of all commands that you are executing.

 

lab@R1> set cli timestamp

Jul 10 15:52:36

 CLI timestamp set to: %b %d %T

lab@R1> show version 

Jul 10 15:52:41

 Hostname: R1
 Model: m7i
 JUNOS Base OS boot [10.4R6.5]
 JUNOS Base OS Software Suite [10.4R6.5]
{master}
 

Output of show version without “set cli timestamp”:

slab@R1> show version

 Hostname: R1
 Model: m7i
 JUNOS Base OS boot [10.4R6.5]
 JUNOS Base OS Software Suite [10.4R6.5]

Show commands can be executed from any level of router mode. While you are in operation mode “>”, you can use show commands directly. If you are in operation mode “#”, you will have to use the keyword “run” before show commands, as shown in following example.

 

lab@R1-MX960-re0> show version

Hostname: R1-MX960-re0
 Model: mx960
 JUNOS Base OS boot [11.2S6]
 JUNOS Base OS Software Suite [11.2S6]
{master}
 lab@R1-MX960-re0> edit
 Entering configuration mode
{master}[edit]

lab@R1-MX960-re0# run show version <<< using “run” key word before show version.

 Hostname: R1-MX960-re0
 Model: mx960
 JUNOS Base OS boot [11.2S6]
 JUNOS Base OS Software Suite [11.2S6]
{master}[edit]
 lab@R1-MX960-re0#
 

You can use “match” keyword with pipe (|) to find any specific field or pattern in output:

 {master}

lab@R1-MX960-re0> show version | match IDP

 JUNOS IDP Services [11.2S6]
{master}

lab@R1-MX960-re0> show interfaces ge-7/0/0 | match error

 Link-level type: Ethernet, MTU: 1514, Speed: 1000mbps, BPDU Error: None,
 MAC-REWRITE Error: None, Loopback: Disabled, Source filtering: Disabled,
{master}

lab@R1-MX960-re0> show interfaces ge-7/0/0 | match MTU

 Link-level type: Ethernet, MTU: 1514, Speed: 1000mbps, BPDU Error: None,
 MAC-REWRITE Error: None, Loopback: Disabled, Source filtering: Disabled,
{master}

lab@R1-MX960-re0> show interfaces ge-7/0/0 | match rate

 Input rate : 0 bps (0 pps)
 Output rate : 0 bps (0 pps)
 

To execute multiple field searches you can use following command or format:

{master}

lab@R1-MX960-re0> show interfaces ge-7/0/0 | match “MTU|Rate”

 Link-level type: Ethernet, MTU: 1514, Speed: 1000mbps, BPDU Error: None,
 MAC-REWRITE Error: None, Loopback: Disabled, Source filtering: Disabled,
 Input rate : 0 bps (0 pps)
 Output rate : 0 bps (0 pps)
{master}
 lab@R1-MX960-re0>
 

You can write or save the output of show commands to specific file for offline analysis using save command as follows:

 

This example is storing output command with specific match to file name “interface_ge700_mtu_rate”:

{master}

lab@R1-MX960-re0> show interfaces ge-7/0/0 | match “MTU|Rate” | save interface_ge700_mtu_rate

Wrote 3 lines of output to ‘interface_ge700_mtu_rate’

 

To read the file you can execute file show command as follows:

{master}
 lab@R1-MX960-re0> file show interface_ge700_mtu_rate
 Link-level type: Ethernet, MTU: 1514, Speed: 1000mbps, BPDU Error: None,
 MAC-REWRITE Error: None, Loopback: Disabled, Source filtering: Disabled,
 Input rate : 0 bps (0 pps)
 Output rate : 0 bps (0 pps)
{master}
 lab@R1-MX960-re0>
 

Here I am saving the whole output of show interface ge-7/0/0 to file name “interface_ge700″:

 {master}
 lab@R1-MX960-re0> show interfaces ge-7/0/0 | save interface_ge700
 Wrote 16 lines of output to 'interface_ge700'
{master}
 lab@R1-MX960-re0> file show interface_ge700
 Physical interface: ge-7/0/0, Enabled, Physical link is Up
 Interface index: 147, SNMP ifIndex: 1154
 Link-level type: Ethernet, MTU: 1514, Speed: 1000mbps, BPDU Error: None,
 MAC-REWRITE Error: None, Loopback: Disabled, Source filtering: Disabled,
 Flow control: Enabled, Auto-negotiation: Enabled, Remote fault: Online, 
 Speed-negotiation: Disabled, Auto-MDIX: Enabled
 Device flags : Present Running
 Interface flags: SNMP-Traps Internal: 0x4000
 Link flags : None
 CoS queues : 8 supported, 4 maximum usable queues
 Schedulers : 0
 Current address: 00:05:85:77:6c:83, Hardware address: 00:05:85:77:6c:83
 Last flapped : 2012-06-28 13:00:43 EST (1w4d 23:03 ago)
 Input rate : 0 bps (0 pps)
 Output rate : 0 bps (0 pps)
 Active alarms : None
 Active defects : None
 Interface transmit statistics: Disabled
{master}
 lab@R1-MX960-re0>
 

To identify the system timing, system uptime, when system last rebooted and configuration:

lab@R1> show system uptime

 Current time: 2012-07-10 15:51:03 UTC
 System booted: 2012-07-10 15:20:07 UTC (00:30:56 ago)
 Protocols started: 2012-07-10 15:22:14 UTC (00:28:49 ago)
 Last configured: 2012-07-10 15:21:38 UTC (00:29:25 ago) by root
 3:51PM up 31 mins, 1 user, load averages: 0.10, 0.07, 0.15
lab@R1>

To look at the CPU related information of Routing-Engine (RE):

In this command, you will be able to identify the memory and CPU utilization of RE, and you will be also able to find out the last reboot reason and time.

lab@R1> show chassis routing-engine

Routing Engine status:
Temperature                 41 degrees C / 105 degrees F
CPU temperature             40 degrees C / 104 degrees F
DRAM                      1536 MB
Memory utilization          26 percent
CPU utilization:
User                       0 percent
Background                 0 percent
Kernel                     3 percent
Interrupt                  1 percent
Idle                      96 percent
Model                          RE-850
Serial ID                      1000730181
Start time                     2012-07-10 15:20:07 UTC
Uptime                         6 hours, 41 minutes, 58 seconds
Last reboot reason             Router rebooted after a normal shutdown.
Load averages:                 1 minute   5 minute  15 minute
0.00       0.00       0.00

lab@R1>
 

To identify what kind of hardware inventory this router has:

In this command you will be able to identify the type of Routing-engine that you are using, Fabric information and Forwarding card information. This information is very useful when you want to replace faulty hardware and open an RMA with JTAC engineers.

 

lab@R1> show chassis hardware

Hardware inventory:
Item             Version  Part number  Serial number     Description
<snip>

To look at the FPC resource utilization:

lab@R1-MX960-re0> show chassis fpc   

 

                   Temp  CPU Utilization (%)   Memory    Utilization (%)
Slot State          (C)  Total  Interrupt      DRAM (MB) Heap     Buffer
  0  Online          36      5          0       1024       18         29
  1  Empty
  2  Online          39      7          0       2048       20         13
  3  Empty
  4  Empty
  5  Online          42      5          0       1024        7         41
  6  Empty
  7  Online          32     10          0       1024       26         29
  8  Empty
  9  Empty
 10  Empty
 11  Empty

lab@R1-MX960-re0> show chassis fpc detail

Slot 0 information:
  State                                 Online
  Temperature                        36
  Total CPU DRAM                   1024 MB
  Total RLDRAM                      256 MB
  Total DDR DRAM                   4096 MB
  Start time:                           2012-07-11 08:49:04 UTC
  Uptime:                               6 hours, 58 minutes, 32 seconds
  Max Power Consumption             310 Watts
Slot 2 information:
  State                                 Online
  Temperature                        39
  Total CPU DRAM                   2048 MB
  Total RLDRAM                     1324 MB
  Total DDR DRAM                   5120 MB
  Start time:                           2012-07-11 08:49:10 UTC
  Uptime:                               6 hours, 58 minutes, 26 seconds
  Max Power Consumption             440 Watts
Slot 5 information:
  State                                 Online
  Temperature                        42
  Total CPU DRAM                   1024 MB
  Total RLDRAM                      128 MB
  Total DDR DRAM                   2048 MB
  Start time:                           2012-07-11 08:48:58 UTC
  Uptime:                               6 hours, 58 minutes, 38 seconds
  Max Power Consumption             265 Watts
Slot 7 information:
  State                                 Online
  Temperature                        32
  Total CPU DRAM                   1024 MB
  Total RLDRAM                      256 MB
  Total DDR DRAM                   4096 MB
  Start time:                           2012-07-11 08:49:01 UTC
  Uptime:                               6 hours, 58 minutes, 35 seconds
  Max Power Consumption             335 Watts

lab@R1-MX960-re0>

 

To take a look at a configuration:

From operation mode:

lab@R1> show configuration

 

From configure mode:

[edit]

lab@R1# show


To look at the last 50 configuration commits with their time stamp and who executed those configuration changes:

lab@R1> show system commit

0   2012-07-11 15:49:02 UTC by lab via cli
1   2012-07-10 15:21:38 UTC by root via other
2   2012-07-10 15:01:08 UTC by lab via cli
3   2012-07-07 15:43:02 UTC by lab via cli
<snip>

To look at the difference between the current and 49th configuration:

lab@R1> show configuration | compare rollback 49

You can use any rollback number from 1 to 49.

To identify what are the process that are running on router:

lab@R1> show system processes extensive

last pid: 14820; load averages: 0.12, 0.07, 0.01 up 1+00:18:38 15:38:15
131 processes: 4 running, 110 sleeping, 17 waiting
Mem: 261M Active, 59M Inact, 48M Wired, 231M Cache, 69M Buf, 897M Free
Swap: 2048M Total, 2048M Free
  PID USERNAME  THR PRI NICE   SIZE    RES STATE    TIME   WCPU COMMAND
   11 root        1 171   52     0K    12K RUN     22.6H 91.70% idle
1387 root         1   4    0 32860K 10360K kqread   0:29  0.00% rpd
14819 root        1 101    0 28764K 11564K RUN      0:00 15.00% mgd
14816 root        1   4    0  4336K  2836K sbwait   0:00  3.00% cscript
 1344 root        1  96    0 34280K  9076K select  33:47  0.98% chassisd
 1083 root        1  96    0  4204K  2712K select   0:29  0.05% eventd

<snip>

To check the interface status on router:

lab@R1> show interfaces terse ge-0/3/0

Interface               Admin Link Proto    Local                 Remote
ge-0/3/0                up    up
ge-0/3/0.32767          up    up

lab@R1>

To look for all interfaces from specific FPC/MPC, use the “*” as shown:

lab@R1-MX960-re0> show interfaces terse ge-7/*

 

Interface               Admin Link Proto    Local                 Remote
ge-7/0/0                up    up
ge-7/0/1                up    up
ge-7/0/2                up    down
ge-7/0/3                up    down
ge-7/0/4                up    down
ge-7/0/5                up    down
ge-7/0/6                up    down
ge-7/0/7                up    down
ge-7/0/8                up    down
ge-7/0/9                up    down
ge-7/1/0                up    up
ge-7/1/1                up    down
ge-7/1/2                up    down
ge-7/1/3                up    down
ge-7/1/4                up    down
ge-7/1/5                up    up
ge-7/1/6                up    down
ge-7/1/7                up    down
ge-7/1/8                up    down
ge-7/1/9                up    up

lab@R1-MX960-re0>

To list only up interfaces you can use “match” condition along with “*”:

lab@R1-MX960-re0> show interfaces terse ge-7/* | match “up    up”

ge-7/0/0                up    up
ge-7/0/1                up    up
ge-7/1/0                up    up
ge-7/1/5                up    up
ge-7/1/9                up    up

lab@R1-MX960-re0>

To look at more information on interfaces for various counters, error counters, and other interface-related information, use the “extensive” keyword at the end:

lab@R1-MX960-re0> show interfaces ge-7/0/0 extensive

 

To identify total number of routes:

The following command will give you the total number of routes, as well as a breakdown of which protocol and which address family has how many routes. This command will also provide you information about the Router ID and autonomous system information.

 

lab@R1> show route summary

Autonomous system number: 300
Router ID: 192.168.1.101

inet.0: 20 destinations, 20 routes (20 active, 0 holddown, 0 hidden)
              Direct:      7 routes,      7 active
               Local:      8 routes,      8 active
                OSPF:      1 routes,      1 active
              Static:      2 routes,      2 active
                 PIM:      2 routes,      2 active

mpls.0: 3 destinations, 3 routes (3 active, 0 holddown, 0 hidden)
                MPLS:      3 routes,      3 active

inet6.0: 2 destinations, 2 routes (2 active, 0 holddown, 0 hidden)
                 PIM:      2 routes,      2 active

lab@R1>

To look at the specific route:

lab@R1> show route 192.168.10.18

 

inet.0: 22 destinations, 22 routes (22 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

192.168.10.18/32   *[OSPF/10] 1d 00:27:57, metric 3
                    > to 10.10.10.10 via lt-1/2/0.5

inet.3: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)
+ = Active Route, - = Last Active, * = Both

192.168.10.18/32   *[RSVP/7/1] 1d 00:27:49, metric 3
        > to 10.10.10.10 via lt-1/2/0.5, label-switched-path R2-to-R9

lab@R1>

To look at the more detailed information for a specific route, use the “extensive” keyword:

The following command will show you all required information, including which protocol learned this route, what is the next-hop neighbor as well as interface, what kind of label will be used to reach that particular route, and if there are multiple routes to reach the same destination, then which one is selected (look for selected keyword in the output).

lab@R1> show route 192.168.10.18 extensive

inet.0: 22 destinations, 22 routes (22 active, 0 holddown, 0 hidden)
192.168.10.18/32 (1 entry, 1 announced)
TSI:
KRT in-kernel 192.168.10.18/32 -> {10.10.10.10}
        *OSPF   Preference: 10
                Next hop type: Router, Next hop index: 1136
                Address: 0x8f93298
                Next-hop reference count: 14
                Next hop: 10.10.10.10 via lt-1/2/0.5, selected
                State: <Active Int>
                Age: 1d 0:28:13         Metric: 3
                Area: 0.0.0.0
                Task: OSPF
                Announcement bits (1): 2-KRT
                AS path: I

inet.3: 1 destinations, 1 routes (1 active, 0 holddown, 0 hidden)

192.168.10.18/32 (1 entry, 0 announced)
        State: <FlashAll>
        *RSVP   Preference: 7/1
                Next hop type: Router
                Address: 0x8f932e0
                Next-hop reference count: 4
                Next hop: 10.10.10.10 via lt-1/2/0.5 weight 0x1, selected
                Label-switched-path R2-to-R9
                Label operation: Push 299776
                Label TTL action: prop-ttl
                State: <Active Int>
                Age: 1d 0:28:05         Metric: 3
                Task: RSVP
                AS path: I

lab@R1>

 

In next post of this series, I will write more about protocol verification.

About Devang Patel

Devang Patel
JNCIE-M# 653 CCIE(SP)# 24801

  • ktokash

    Good article, I picked up some helpful tips here. One thing I’d like to add is that, unlike Cisco, the grep functionality in JunOS is not case sensitive. Personally I find that helpful, but I can see it annoying people.

    ktokash@Tauntaun> show log messages | last 5 | match KTOKASH
    Jul 9 10:45:27 Tauntaun sshd[31953]: Accepted password for ktokash from 192.168.1.102 port 32511 ssh2

    • Devang Patel

      Thanks Ktokash for reply. As JUNOS has BSD shell where you can execute the grep functionality which is by default the case sensitive search.

      lab@R1-M7i> start shell
      %
      % pwd
      /var/log
      %
      % cat messages | grep testing
      Jul 23 14:09:22 R1-M7i lab: testingtesting
      Jul 23 14:11:08 R1-M7i lab: testingtestingtesting
      % cat messages | grep Testing
      Jul 23 14:11:23 R1-M7i lab: TestingTestingTesting
      % cat messages | grep testing
      Jul 23 14:09:22 R1-M7i lab: testingtesting
      Jul 23 14:11:08 R1-M7i lab: testingtestingtesting

  • Phil

    Nice. Been using JUNOS 13 years and didn’t know about ‘set cli timestamp’!

  • Anon

    Nice Article! More useful than the last Junos post from their own employee

  • http://twitter.com/ericlwc Eric Leung

    Nice one, I like the tips in this post. Thanks a lot and looking forward for part II.

  • jelly andrews

    This
    is great. Very interesting and very informative!

  • vinodp

    this is great, very informative post. Do we have an option to get statistics of Data packets alone. I beleive the current stats display show total packet Transmitted or Received includes the control packets as well.