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
Rack8R2#
*Mar 1 00:14:44.523: OSPF: rcv. v:2 t:1 l:48 rid:150.8.3.3
aid:0.0.0.0 chk:BB84 aut:0 auk: from Serial0/1
Rack8R2#
*Mar 1 00:14:53.987: OSPF: rcv. v:2 t:1 l:48 rid:150.8.3.3
aid:0.0.0.0 chk:BB84 aut:0 auk: from Serial0/1
Rack8R2#
*Mar 1 00:15:03.859: OSPF: rcv. v:2 t:1 l:48 rid:150.8.3.3
aid:0.0.0.0 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 Cisco.com -> 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.
Very interresting information,
Thanks you very much,
Daniel or Hono(techexaman)
Awesome. Does this debug condition stay in the running config?
Doesn’t seem like it. It is configured from privileged mode and not config mode so it doesn’t get into the running-config.
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. ”
https://www.cisco.com/c/en/us/td/docs/ios-xml/ios/debug/command/a1/db-a1-cr-book/db-c1.html#wp1384201382