- [Instructor] Now let's take a look at
conditional debug outputs.
In the previous video, we use the command
debug IP OSP F hello,
that was one of the examples that we looked at.
And that might seem like a conditional command
on the surface, but that's actually not what we would call
a conditional command.
Conditional commands, don't refer to limiting the contents
of the debug output itself in the way that we used
the limited command with IP SPF hello messages.
So that may be a bit counterintuitive at first.
The conditional nature comes from the fact that
you're limiting the output to a specific interface, a V LAN,
a Mac address and IP address and so on.
So using the same topology from our previous video,
we're again, connected into router three,
where we issued that debug IPO SPF, hello command,
and let's say we wanted to create
a conditional debug output for this.
You can see that we have routers two and four,
both being OSPs adjacencies to router three,
where we're currently connected.
So let's say we wanted to debug those hello messages
only from router four.
We can do that with a conditional debug.
We can see in the typology that gig 0/2
is the interface connected to our four,
in the 198.51.100.0/30 network.
If I say debug condition,
and we look at context sensitive help,
you can see all of the conditional debug options
we have at our disposal.
If I say interface,
and I follow that with the interface number,
which in my case is gig 0/2,
you can see where it's hold condition one is set.
And this means now that the debug output
is going to be limited to showing only packets that arrive
on the gig 0/2 interface.
So again, just as we mentioned before,
the more specific you can be with your debug commands
the safer things are going to be.
You'll have less risk of the output, overloading your CPU
and potentially crashing your device.
Now, remember, in the previous video,
we had already entered a debug IP OSP F hello command,
so when you enable conditional debugging,
as we've done here, any debugging that's already running
on the device or any debug commands that you issue
after this, those are only going to display information
related to packets arriving
on the interface gig 0/2, in this case.
It's also notable that you can use
multiple conditional debug commands
to further narrow down your output.
So we could go back and again, say debug condition,
and if this time, what if we wanted to say IP,
and we want to say 4.4.4.4, we can do that,
and it tells us condition two is set.
So that's going to further limit
the debugging information that I'm presented with.
So let's say that you're not seeing what you expect
in your debug output, maybe you've gone in,
or maybe someone else has, and they've configured
conditional debugging, and you're not aware of that.
You can verify any conditional debug that's in place
with the command show debug condition.
And you can see we're told we have two conditions in place,
we see the condition for interface 0/2,
and the condition for the IP for 4.4.4.4.
Now, if you need to remove any condition,
you can simply do that by using the same command
and you prepare that with the no key word,
so we can see it tells us condition two
has now been removed.
One more thing to take note of is that if we say no,
debug all to turn off all possible debugging,
and we again say show the bug condition.
Notice that the condition that I did not delete
is still in place, we still have condition one there.
So even if you turn off all possible debugging,
that does not reset your conditions.
So if you were to use debugging again, later on this router,
and you weren't expecting this conditional filtering,
maybe someone else configured it,
or maybe you just forgot that you put it in place,
you might not get the output that you're expecting.
So the show debug condition output is another command
you want to use if you're getting something strange
in your debug output.
Again, there are many, many more options
for conditional debugging than we've looked at here.
So take a look at contextual help
when you're configuring this for some guidance on your own.
So that's a look at using conditional debugging
for troubleshooting.