10-9
Catalyst 4500 Series Switch, Cisco IOS Software Configuration Guide - Cisco IOS XE 3.9.xE and IOS 15.2(5)Ex
 
Chapter 10      Checking Port Status and Connectivity
Using Layer 2 Traceroute
Layer 2 switches can participate as the source or destination of the trace command but does not appear 
as a hop in the trace command output.
The trace command uses the time to live (TTL) field in the IP header to cause routers and servers to 
generate specific return messages. Traceroute starts by sending a User Datagram Protocol (UDP) 
datagram to the destination host with the TTL field set to 1. If a router finds a TTL value of 1 or 0, it 
drops the datagram and sends back an Internet Control Message Protocol (ICMP) Time-Exceeded 
message to the sender. Traceroute determines the address of the first hop by examining the source 
address field of the ICMP Time-Exceeded message.
To identify the next hop, traceroute sends a UDP packet with a TTL value of 2. The first router 
decrements the TTL field by 1 and sends the datagram to the next router. The second router sees a TTL 
value of 1, discards the datagram, and returns the Time-Exceeded message to the source. This process 
continues until the TTL is incremented to a value large enough for the datagram to reach the destination 
host or until the maximum TTL is reached.
To determine when a datagram reaches its destination, traceroute sets the UDP destination port in the 
datagram to a very large value that the destination host is unlikely to be using. When a host receives a 
datagram with an unrecognized port number, it sends an ICMP Port Unreachable error message to the 
source. The Port Unreachable error message indicates to traceroute that the destination has been reached.
Running IP Traceroute
To trace the path that packets take through the network, enter this command in EXEC or privileged 
EXEC mode:
This example shows how to use the trace command to display the route a packet takes through the 
network to reach its destination:
Switch# trace ip ABA.NYC.mil
 
Type escape sequence to abort.
Tracing the route to ABA.NYC.mil (26.0.0.73)
  1 DEBRIS.CISCO.COM (192.180.1.6) 1000 msec 8 msec 4 msec
  2 BARRNET-GW.CISCO.COM (192.180.16.2) 8 msec 8 msec 8 msec
  3 EXTERNAL-A-GATEWAY.STANFORD.EDU (192.42.110.225) 8 msec 4 msec 4 msec
  4 BB2.SU.BARRNET.NET (192.200.254.6) 8 msec 8 msec 8 msec
  5 SU.ARC.BARRNET.NET (192.200.3.8) 12 msec 12 msec 8 msec
  6 MOFFETT-FLD-MB.in.MIL (192.52.195.1) 216 msec 120 msec 132 msec
  7 ABA.NYC.mil (26.0.0.73) 412 msec 628 msec 664 msec
Switch# 
Using Layer 2 Traceroute 
The Layer 2 traceroute feature allows the switch to identify the physical path that a packet takes from a 
source device to a destination device. Layer 2 traceroute supports only unicast source and destination 
MAC addresses. It determines the path by using the MAC address tables of the switches in the path. 
When the switch detects a device in the path that does not support Layer 2 traceroute, the switch 
continues to send Layer 2 trace queries and lets them time out.
Command Purpose
Switch# trace [protocol] [destination]
Runs IP traceroute to trace the path that packets 
take through the network.