Conditional debugging 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 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:
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:
Rene,
Hi. With the debug condition there are multiple options that can be used such as interface (as you highlighted) ip address, mac address, etc… When you have multiple debug conditions configured is it a logical “and” or “or”? In other words do they all have to match for it to work with multiple conditions? When using the “ip” condition could that be any IP going through the router? Could it also include traffic to the router itself? Many thanks.
Thomas
Hi Thomas,
The debug condition command is pretty simple, it doesn’t work with and/or operators. For example if you enable “debug condition int fa0/0” then it will only show debug information for that interface. When you add “debug condition int fa0/1” then it will also show debug information from fa0/1, that’s it. It’s not like it will now match on traffic that enters fa0/0 and exits fa0/1 (or vice versa). It works more like access-list statements, if it matches…the debug info will show up, if it doesn’t match then you don’t see it.
Debug ip will show anything,
... Continue reading in our forumRene,
I have been able to get conditional debug to work with interface. However, I have yet to perform a successful conditional debug with ip. Here’s an example:
... Continue reading in our forumHi Ronald,
I just tried this on some IOS 15 routers but I’m having the same issue as you. Whatever IP address I try in “debug condition ip”…nothing shows up I’m guessing that this command doesn’t work for most debug commands…
Rene
Rene,
Thank you for checking as well. Much appreciated.
Roland