Saturday, February 22, 2020

Conditional Debug on Cisco IOS Router

Conditional debug is very useful to filter out some of the debug information that you see on a (busy) router. It allows us to only show debug information that matches a certain interface, MAC address, username and some other items.
It’s best to demonstrate this with an example, so let me show you the following router that is running RIP on two interfaces:
single Cisco router Two FE Interfaces
Let’s enable RIP debugging on this router:
R1#debug ip rip 
RIP protocol debugging is on
We will see RIP debug information from both interfaces:
R1#
RIP: sending v2 update to 224.0.0.9 via FastEthernet0/0 (192.168.12.1)
RIP: build update entries
 192.168.13.0/24 via 0.0.0.0, metric 1, tag 0
R1#
RIP: sending v2 update to 224.0.0.9 via FastEthernet0/1 (192.168.13.1)
RIP: build update entries
 192.168.12.0/24 via 0.0.0.0, metric 1, tag 0
If I only want to see the debug information from one interface then I can use a debug condition:
R1#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
This is quite a list with different items to choose from. I’ll use the interface as a condition:
R1#debug condition interface fastEthernet 0/0
Condition 1 set
Using this debug condition we will only see RIP debug information from the FastEthernet 0/0 interface:
R1#
RIP: sending v2 update to 224.0.0.9 via FastEthernet0/0 (192.168.12.1)
RIP: build update entries
 192.168.13.0/24 via 0.0.0.0, metric 1, tag 0
When you want to get rid of the debug condition then you can use the following command:
R1#undebug condition interface fastEthernet 0/0
This condition is the last interface condition set.
Removing all conditions may cause a flood of debugging
messages to result, unless specific debugging flags
are first removed.

Proceed with removal? [yes/no]: yes
Condition 1 has been removed
The router will warn you that you might be flooded with debug information after removing the debug condition. If you have a router that generates a lot of debug information then this is something to be aware.
Be careful…using no debug all or undebug all doesn’t remove the condition. You need to remove it using the command that I just showed you!
That’s all there is to it. I hope this helps you to make debugging easier to work with. If you have any questions feel free to leave a comment!

No comments:

Post a Comment