Debugging is a wonderful tool that we can have in our tool
belt. And we're going to use it sparingly,
because it does take, especially if we're doing lots of debug
informations, all coming to the console, that
takes a lot of CPU.
So we're going to use debug sparingly.
And also, I'd like to share with you
the option of a conditional debug, which
can, for some protocols, help reduce
the strain and the output on that device by that much more.
So with debugging, the first thing we would want to consider
is the destinations of the output.
Now, by default, we saw in our previous lab
that the destinations are the console, the buffer, WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
that the destinations are the console, the buffer,
and the monitor, the VTY lines that are connected
full force, at Level 7.
So if you want to control where all that is going,
we might want to constrain that, and maybe
do Level 7 as a buffer, which is great, as a default.
And maybe we take level of the console
and we tell it Level 6 and below.
That way, we're not going to overwhelm the console,
because that does take a lot of direct CPU
to send those console messages to the console,
line console 0, as opposed to buffer. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
line console 0, as opposed to buffer.
Memory is a lot faster than it is sending it to your CLA.
So that's one option that you want be aware of.
Secondly, when you do a debug, do as granular of a debug
as we can.
So if we want to debug, instead, like,
debug the entire protocol, maybe debug the specific part,
like hello messages or some piece of that protocol
that you're trying to troubleshoot.
Because that's going to help you in troubleshooting, also,
by looking at just detailed information that comes in.
Instead of, like, an ocean of information,
whether it's coming live at you at the console, which
is a pain in the rear, or whether it's coming to buffer. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
is a pain in the rear, or whether it's coming to buffer.
Also, at the console, what I always do, before I do a debug,
is I will do a undebug space all before I do the debug.
Because that way, I can hit the up arrow key one
time, press Enter, and I can do an undebug
to go ahead and bring back the previous--
I guess, two up arrows.
Because the previous command would be the debug itself.
So I want to have that in my history,
so I can hit the up arrow key a couple of times and do it.
So practicing those skills of getting out of danger
are important as well.
All right, so one other option I'd like to share with you WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
All right, so one other option I'd like to share with you
is the option of a conditional debug.
So let's imagine-- and it goes something like this.
Let's imagine we're debugging OSPF,
and we are debugging the hello messages.
We're interested in looking at those, that's
pretty granular to begin with.
But this router is receiving hello messages
and processing hello messages here and here.
And if we had other interfaces, elsewhere as well.
With conditional debugs, we could actually
say-- we could set up a condition and say,
only, the debug that's currently running, only WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
only, the debug that's currently running, only
have it apply for a specific interface.
And so if we pointed to this Interface 6,
the hello messages that happened over here
would not be included in our debug, in the output.
Now, there's good news and bad news about conditional debugs.
Well, first, a couple of other details, and then I'll
share with you the good news and bad news.
So you can set up conditions.
So if we say the condition is Interface 6,
then, like, condition Number 1.
And then we can say, also, I want WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
And then we can say, also, I want
to pay attention to a certain IP address or a certain something
else.
We could have IP, that can be condition Number 2.
And then we can actually group--
keep adding conditions.
And what will happen is, they have to match.
Anything that doesn't match in your conditions
won't be included as part of your output for debug.
So you can include multiple conditions for the debug.
So that's the good news, is it's very granular and really cool,
but here's--
let me go to the big screen.
The problem is-- oh, my gosh. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
The problem is-- oh, my gosh.
So as I'm brushing up for this, I labed it up
in a emulated environment.
And I just did some basic bugs and then I did conditions,
and it wasn't taking.
It was like, everything's still coming in.
And then I tried a different set of virtual gear,
different iOSs, same problem.
Then I said, great, I'll fire up some live gear,
fired up the live gear, same problems.
These conditional debugs, they don't
apply to every possible debug that you're going to be doing.
So I would recommend before you think WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
So I would recommend before you think
you're going to try one, like, debug IP packet,
and then say, just this interface,
you might want to test that out on the gear
that you would want to use that on before you're
in a production environment.
Because I discovered, on three different sets of gear,
two virtual, one physical, that it doesn't always
function for every single debug that's in the debug arsenal.
All right, having said that, in this hands on lab,
let me walk you through a scenario that
does work in the virtual environment
and also would work in a physical environment as well. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
and also would work in a physical environment as well.
So you can kind of get a taste and a feel
for working with conditional debugs.
And to do that in his lab that I've provided,
we are going to use Router 2, let's do a show IP protocols,
see what he's running.
And he's got OSPF and BGP, that's
fantastic, more than enough.
And let's do a show IP OSPF neighbor.
All right, we've got some neighbors, fantastic.
Let's do a debug of IP OSPF hello. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
Let's do a debug of IP OSPF hello.
There we go, so we are sitting, let's do a do--
let's do a show logging.
Though currently, we're logging to the console monitor
and buffer at Level 7, which includes Level 7 and below.
And we go show users, I'm currently
sitting at the console, great.
So we're seeing those messages.
And I'm seeing interfaces involved of gig 2/0,
and gig 1/0, and gig 0/0, great.
So let me turn that off for a moment, WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
So let me turn that off for a moment,
so you can see the typing roll up as it happens.
I've also got a logging synchronous
on the console line, that way it repaints the line for me,
which is--
we've done that forever.
So let's go ahead and set up a condition.
And the syntax is right here in privilege mode,
debug condition.
And then we set up the condition that we
want, we have Mac address, IP address, interface.
And we'll do an interface, and let me scroll up a little bit, WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
And we'll do an interface, and let me scroll up a little bit,
see what interfaces we had.
And here's what I'd like to do, I'm
going to do gig 0/0 and 1/0.
So either one of those will match the condition,
but we shouldn't see any gig 2/0,
regarding IP OSPF hellos after that.
So I'll interface gig 0/0, and there's one condition set,
and we'll also do 1/0.
And to see that, we're just going
to do a show debug condition, and it'll
show us what they are.
So condition 1 is looking for that interface, condition 2.
So any debugs that we do now-- WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
So any debugs that we do now--
I shouldn't say any, because some debugs don't
give a hoot about filtering based on interface,
but the IP OSPF hellos do.
They will only pay attention to those hellos
and show up messages if it's regarding 0/0 or 1/0,
2/0 is not going to show up.
So I'll do a debug, IP OSPF hello, and there it goes.
So we're going to get some messages,
we're looking for 0/0, 1/0, but no 2/0, they just
shouldn't show up anymore.
If you want, we can link it up to 1/0.
So let's go ahead and do a show debug conditions, WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
So let's go ahead and do a show debug conditions,
and we can say, no debug condition.
And let's take off debug condition 2.
You can actually type out what the condition was,
but it's a lot easier to do the 2.
So I'll take out debug condition 2,
so now it should be just gig 0/0.
So there's a send on 0/0, there's a hello on 0/0,
it's a party.
But it's only a party for gig 0/0, because of this,
show debug conditions.
Also, it's important to know for troubleshooting WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
Also, it's important to know for troubleshooting
that, if you have these conditions in place,
and you're done with your debug, you
go home, whatever, you come back,
these conditions are still there.
So if you do a debug in the future,
and that condition is still present,
you may be filtering some of the output
that you would otherwise expect to go ahead and see.
So if we did a no debug condition,
and I'm going to take off condition 1, right there,
because it's stated as 1.
It's going to give me a warning, this is your last condition,
are you sure you want to remove them?
You're not going to have any conditions left.
I'll say, yes. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
I'll say, yes.
And now if we do a debug IP OSPF hello, there's no conditions,
so any hello in a storm is going to do.
That includes 0/0, 1/0, and 2/0.
Because when those hellos show up, the debug is triggered,
and it's going to show us that information.
So I'm going to turn it off with the undebug all,
and there you have it.
Conditional debugging, make sure you practice with it,
with the gear that you're going to be
using in production to know what the behaviors are before.
you just expect that, oh, if I limit it to gig, like,
1/0, that means everything else, other than that one interface, WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
1/0, that means everything else, other than that one interface,
is going to be excluded.
And for most of the debugs that I tried in setting this up,
most of the debugs don't give a hoot about that condition.
So in this video and hands on lab,
we've had the opportunity to discover, practice, and verify
the use of debugging conditions on a Cisco router.
So thanks for joining me in this set of videos
regarding logging and I'll see you in the next set.
Meanwhile, I hope this has been informative for you,
and I'd like to thank you for viewing.