Cisco IOS debugging is a very useful feature for the troubleshooting various issues on the Cisco Routers and switches. Though useful, debugging must be run on devices with caution as it is very CPU intensive and may result in router/switch crash if low PU memory is available on the device.
Conditional debugging is used to filter out the debug information so that the CPU consumption by debug is lowered significantly. It allows us to show debug information that matches a certain interface, MAC address etc.
Let us use the example below to understand this further –
We enable the RIP debug on R2 as below:
R2#debug ip rip
RIP protocol debugging is on
We see we are getting debug messages on both interfaces Fa0/0 and Fa1/0.
Now let us enable conditional debug as below for interface Fa0/0.
R2#debug condition interface fa0/0
R2#sh debug condition
Now we see we only get debug messages for interface Fa0/0.
To disable the conditional debug use the following command:
R2#undebug condition interface fa0/0