Enabling Traceoptions in Juniper Router and monitoring the trace.

Rakesh Madupu JNCIE-SP #02079 CCIE-SP#47613Network Development Engineer
Published:
Hello ,

This is a short article on how would you go about enabling traceoptions on a Juniper router . Traceoptions are similar to Cisco debug commands but these traceoptions are implemented in Juniper networks router .

The following demonstrates a traceoptions configuration on a Juniper router which has ospf enabled on it and we will be tracing for ospf .

First this is to go into a mode to make this happen Below is the command from the start of the router .

login: lab
                      Password:
                      
                      --- JUNOS 9.6R2.11 built 2009-10-06 20:56:00 UTC
                      lab> configure 
                      Entering configuration mode
                      Users currently editing the configuration:
                        lab terminal d0 (pid 1359) on since 2011-06-11 00:48:19 IST, idle 12:27:15
                            [edit]
                        lab terminal p2 (pid 1510) on since 2011-06-11 14:40:34 IST, idle 05:10:52
                            [edit]
                      
                      [edit]
                      lab# 

Open in new window


Now that you have done this we will go ahead and configure the protocol

[edit]
                      lab# set protocols ospf area 0 interface all 
                      
                      [edit]
                      lab# commit 
                      commit complete
                      
                      [edit]
                      lab# 

Open in new window


how would you enable traceoptions ? well traceoptions are protocol specific and not device specific . In the sense you would have traceoptions for ospf , rip , and protocols not for the entire router itself

let us enable traceoptions for ospf

[edit]
                      lab# edit protocols ospf 
                      
                      [edit protocols ospf]
                      lab# set traceoptions file testtrace 
                      
                      [edit protocols ospf]
                      lab# set traceoptions flag all 
                      
                      [edit protocols ospf]
                      lab# commit 
                      commit complete
                      
                      [edit protocols ospf]
                      lab# 

Open in new window


Now , how would you monitor it ... simple

[edit]
                      lab# exit 
                      Exiting configuration mode
                      
                      lab> monitor start testtrace 
                      
                      lab> 
                      *** testtrace ***
                      Jun 11 21:23:51.316731 task_timer_dispatch: calling OSPF_internal timer, late by 0.000
                      Jun 11 21:23:51.316798 task_timer_dispatch: returned from OSPF_internal timer, rescheduled in 0
                      Jun 11 21:23:51.875790 task_process_events: recv ready for OSPF I/O./var/run/ppmd_control
                      Jun 11 21:23:51.875864 task_process_events: recv ready for OSPF I/O./var/run/ppmd_control
                      Jun 11 21:23:51.875898 task_timer_uset: timer OSPF I/O./var/run/ppmd_control_PPM Hold <Touched> set to offset 2:00 at 21:25:51
                      Jun 11 21:23:51.875912 OSPF periodic xmit from 22.1.1.2 to 224.0.0.5 (IFL 78 area 0.0.0.0)
                      Jun 11 21:23:53.415544 task_process_events: recv ready for OSPF I/O./var/run/ppmd_control
                      Jun 11 21:23:53.415634 task_process_events: recv ready for OSPF I/O./var/run/ppmd_control
                      Jun 11 21:23:53.415663 task_timer_uset: timer OSPF I/O./var/run/ppmd_control_PPM Hold <Touched> set to offset 2:00 at 21:25:53
                      Jun 11 21:23:53.415677 OSPF periodic xmit from 10.141.227.1 to 224.0.0.5 (IFL 3 area 0.0.0.0)
                      
                      monitor stop 
                      
                      lab> 

Open in new window


one thing to keep in mind though , you can type monitor stop at anytime to stop the trace.

You can also see the log file which gets generated along with this

lab> file list /var/log | match testtrace 
                      testtrace
                      
                      lab> 

Open in new window


The same thing is with protocol rip or any other protocol . So what are all the options available under ospf traceoptions

lab# set traceoptions flag ?
                      Possible completions:
                        all                  Trace everything
                        database-description  Trace database description packets
                        error                Trace errored packets
                        event                Trace OSPF state machine events
                        flooding             Trace LSA flooding
                        general              Trace general events
                        graceful-restart     Trace graceful restart
                        hello                Trace hello packets
                        ldp-synchronization  Trace synchronization between OSPF and LDP
                        lsa-ack              Trace LSA acknowledgment packets
                        lsa-analysis         Trace LSA analysis
                        lsa-request          Trace LSA request packets
                        lsa-update           Trace LSA update packets
                        normal               Trace normal events
                        nsr-synchronization  Trace NSR synchronization events
                        on-demand            Trace demand circuit extensions
                        packet-dump          Dump the contents of selected packet types
                        packets              Trace all OSPF packets
                        policy               Trace policy processing
                        route                Trace routing information
                        spf                  Trace SPF calculations
                        state                Trace state transitions
                        task                 Trace routing protocol task processing
                        timer                Trace routing protocol timer processing
                      [edit protocols ospf]
                      lab# set traceoptions flag    

Open in new window


if you can see , you can do a trace for each and every type of state ospf has , my suggestion if you are learning ospf and if you are in a lab environment then we can go with traceoptions which has 'state' tag enabled so that we can see the state information of the protocol , 'timers' which is self explanatory protocol timers

if we wanted to go for the protocol state only , then we would do the following
set protocols ospf traceoptions flag state

Open in new window


Hope this helps and please feel free to post any suggestions or comments that might make this a better Article, or, maybe a follow up Article.
0
13,641 Views

Comments (0)

Have a question about something in this article? You can receive help directly from the article author. Sign up for a free trial to get started.