- [Instructor] Another common troubleshooting tool
available for network management
is the traceroute command.
This is used to show the path
of a packet throughout your network,
displaying a list of all the routers
the traffic passes through
until it reaches the destination.
Additionally, this will show us
if the packet fails to reach the destination
or if it is discarded in transit.
And it'll also show us the time
that it takes between hops.
And by hops we mean from router to router.
This is especially helpful
if we have multiple routes out to the same destination.
And if we want to know which route our traffic is taking.
Now in this case,
we're using a very simple topology here
as you can see on screen.
We have three interconnected routers
and we're going to do a traceroute
to the loop back interface on router three
which has the IP address 3.3.3.3.
So first let's just do a quick ping to 3.3.3.3
just to make sure we do have connectivity.
And we do, that's perfect.
We have 100% success rate.
So from router one we can say traceroute 3.3.3.3.
Now we could also use a domain name if we want to,
but in my case I'm going to use the IP address
that I want to reach.
And you can see that that'll take just a moment
and it will complete
with a successful traceroute for that packet.
Now of course we only have a single route
out to this particular router in this topology.
So there's no question really of which path was taken.
But the output here does show that information.
It shows our next hop IP address that was used,
which is 192.0.2.2.
And if we look at our topology,
we can see that this is the IP address for router two.
This is the ingress interface.
And then we see the next hop
in the traffic path shown as well of 203.0.113.2.
And again from the topology
you can see this is the ingress interface of router three.
So that is exactly the output
that we would expect to see from this traceroute.
Now the way that Cisco routers implement traceroute
is that they send a UDP message
to the destination IP address.
In our case, that was 3.3.3.3.
And they have a series of packets sent out
that have escalating TTL values
or time to live values.
Each time a packet crosses a router,
the TTL value of the packet is decremented.
Once that TTL value reaches zero,
the packet is considered to be timed out
and the packet is essentially considered dead in transit.
So when we started this traceroute command
from router one
it first sends out
a packet with a TTL value of one.
That packet reached router two
and then the TTL value was decremented down to zero.
And what we're seeing in the very first line
of this traceroute,
we're seeing an ICMP message
received from router two letting us know
that the packet TTL value reached zero.
Well, in other words the packet timed out.
The IP address that we see listed here, 192.0.2.2.
That is the IP address of the device
that has let us know about the timeout,
which is of course router two.
And then once that happens,
our router will send out another UDP packet
this time with a TTL value of two.
So this packet will cross router two.
It will be decremented to one for the TTL value
and then when it reaches router three,
the TTL value will be decremented again
and it will reach zero.
In that second line again,
we see an ICMP response from router three
letting us know that the packet has timed out.
And this would repeat with escalating TTL values as needed
up to 30 hops or 30 routers.
Now 30 hops is the default limit for that.
There are ways to trace further than 30 hops,
but most likely anything that you need to do
can be taken care of in 30 hops or less.
A couple of things I do want to show you.
First, let's try to traceroute to a host
that might be on the same network
as the loop back address of router three
but that does not actually exist.
You can see in our topology
that we don't have a host at 3.3.3.2.
That doesn't exist,
so if we try to traceroute to that,
notice that this time in our output
we get a couple of different things there.
We see an exclamation point with a capital H.
We actually see two of those.
And this means that we received an ICMP message
from router three
indicating that the host appears to be down.
Now, of course,
again, we don't actually have a host at that IP address,
so that makes complete sense.
But in a real world environment,
this tells us a couple of things.
It tells us that the final next hop address,
the 203.0.113.2,
that did respond.
So we can get to that final hop.
But we can't reach that specific host.
So again, this is starting
to help us to narrow down our issues.
What if we try to traceroute
to a completely nonexistent network
to mimic a route that would be unreachable for us.
So this time, let's say traceroute
and we'll do 2.2.2.2.
That doesn't exist on this network.
So this is essentially,
this output is going to mimic somewhere
that we can't reach at all.
We'll let that go for just a bit
and you'll see
that we're going to be met with some failures here.
And again, just as with ping,
we can break out of this command
with the Ctrl+Shift+6 key combination.
And I'll go ahead and do that
because this will just go on almost indefinitely.
And you can see those patterns
of three asterisks here.
Those indicate three attempts
to send our UDP segments that have failed.
So that's what a completely unsuccessful traceroute
would look like.
We don't have any next hop information
at all presented to us
because our traffic essentially went nowhere.
One last thing.
Let's jump over to router three.
Get connected into that
and let's go under Global Configuration mode
on router three and under interface gig 0/1,
let's shut down that interface.
So we have that shut down now.
We'll jump back to router one
and from here let's do another traceroute.
Let's traceroute to that valid loop back address
of 3.3.3.3 on router three
and at this time we get some information.
Again, let me break out of that traceroute command
so that that doesn't continue on
with the Ctrl+Shift+6 combination.
So we do see a little bit of information.
We see that our first hop was successful, the 192.0.2.2.
So we are able to reach router two
but since we shut down the ingress interface
on router three,
we don't receive any ICMP reply
from router three at all.
So that's where our traceroute fails.
So from a troubleshooting perspective,
this tells us that our traffic
can go as far as router two before it stops.
So again, another way that that helps us
to narrow down the issues within our network.
If we say traceroute 3.3.3.3
and we use our contextual help,
you can see
that there are several extended traceroute options
available to us.
Options such as the number of probes per each hop.
Remember that by default that's designated as three.
Now we can certainly make that higher
if we want to or lower.
That's indicated by the three asterisks
that we see here in this output that failed.
So default, it's going to probe three times.
We can also manually set TTL values if we want to.
We can set minimum and maximum values for that.
If we want to trace further than 30 hops away,
we can do that.
We can use specific port numbers
and many, many other things
that we have available to us here.
So that's a look at the traceroute command
and how that can help us to narrow down issues
within our networks.