Sometimes we have a need for debugging and Cisco has a lot of options for debugging, this is one of the things why I definately prefer Cisco to HP or other network vendors.

I did some vol2 labbing yesterday and had a need to debug OSPF packets to verify that an adjacency was being form over unicast and not multicast. Sounds easy but when running labs with many neighbors there can be a lot of packets flowing and we might miss some important information when debugging. If we are debugging IP packets we can specify an ACL to narrow down the selection but I am not aware of such an option when debugging routing protocols, at least not for the IGP’s. What I found out is that there is an option for settings conditions on what to debug. This is how we do it.

Rack8R2#debug condition ?
application Application
called called number
calling calling
card card
glbp interface group
interface interface
ip IP address
mac-address MAC address
match-list apply the match-list
standby interface group
username username
vcid VC ID
vlan vlan
voice-port voice-port number
xconnect Xconnect conditional debugging on segment pair

So we have some different options we can used, the two most obvious are ip and interface. I will show how to debug OSPF packets coming in or out a specific interface, this will narrow down traffic a lot if we have multiple neighbors.

Rack8R2#debug condition interface serial 0/1
Condition 1 set

Only traffic coming in or out Serial 0/1 will be debugged. Use show debug condition to see what conditions has been set.

Rack8R2#show debug condition
Condition 1: interface Se0/1 (1 flags triggered)
Flags: Se0/1

Lets debug OSPF packets.

Rack8R2#debug ip ospf packet
OSPF packet debugging is on
*Mar 1 00:14:44.523: OSPF: rcv. v:2 t:1 l:48 rid:
aid: chk:BB84 aut:0 auk: from Serial0/1
*Mar 1 00:14:53.987: OSPF: rcv. v:2 t:1 l:48 rid:
aid: chk:BB84 aut:0 auk: from Serial0/1
*Mar 1 00:15:03.859: OSPF: rcv. v:2 t:1 l:48 rid:
aid: chk:BB84 aut:0 auk: from Serial0/1

So this is a very handy command to use when the need for debugging arises. As every CCIE candidate we should avoid using Google to find this information and you can find the document describing this feature by going to -> Configure -> Products -> Cisco IOS and NX-OS Software -> Cisco IOS -> Cisco IOS Software Release 12.4 Family -> Cisco IOS Software Releases 12.4T -> Reference Guides -> Command References -> Debug

The direct URL is here.

Debug condition – conditional debugging
Tagged on:     

4 thoughts on “Debug condition – conditional debugging

  • February 28, 2011 at 9:12 pm

    Very interresting information,
    Thanks you very much,
    Daniel or Hono(techexaman)

  • March 2, 2011 at 5:38 pm

    Awesome. Does this debug condition stay in the running config?

  • March 3, 2011 at 1:27 pm

    Doesn’t seem like it. It is configured from privileged mode and not config mode so it doesn’t get into the running-config.

  • May 5, 2018 at 12:46 am

    Daniel, did you actually run this with multiple neighbors? I ran it with multiple neighbors and was receiving OSPF packets for all interfaces running OSPF. The condition is only conditional for the specific commands which exclude both EIGRP and OSPF.
    “Use the debug condition command to restrict the debug output for some commands. If any debug condition commands are enabled, output is generated only for interfaces associated with the specified keyword. In addition, this command enables debugging output for conditional debugging events. Messages are displayed as different interfaces meet specific conditions. ”


Leave a Reply

Your email address will not be published. Required fields are marked *