To display the Layer 2 path taken by the packets from the specified source MAC address to the specified destination MAC address,
use the traceroute mac command in privileged EXEC mode.
traceroute mac [interface interface-id] source-mac-address [interface interface-id] destination-mac-address [vlan vlan-id] [detail]
Syntax Description
interface
interface-id
|
(Optional) Specifies an interface on the source or destination .
|
source-mac-address
|
The MAC address of the source in hexadecimal format.
|
destination-mac-address
|
The MAC address of the destination in hexadecimal format.
|
vlan
vlan-id
|
(Optional) Specifies the VLAN on which to trace the Layer 2 path that the packets take from the source to the destination . Valid VLAN IDs are 1 to 4094.
|
detail
|
(Optional) Specifies that detailed information appears.
|
Command Default
No default behavior or values.
Command Modes
Privileged EXEC
Command History
Release |
Modification |
Cisco IOS XE Everest 16.5.1a
|
This command was introduced.
|
Usage Guidelines
For Layer 2 traceroute to function properly, Cisco Discovery Protocol (CDP) must be enabled on all of the es in the network. Do not disable CDP.
When the detects a device in the Layer 2 path that does not support Layer 2 traceroute, the continues to send Layer 2 trace queries and lets them time out.
The maximum number of hops identified in the path is ten.
Layer 2 traceroute supports only unicast traffic. If you specify a multicast source or destination MAC address, the physical
path is not identified, and an error message appears.
The traceroute mac command output shows the Layer 2 path when the specified source and destination addresses belong to the same VLAN.
If you specify source and destination addresses that belong to different VLANs, the Layer 2 path is not identified, and an
error message appears.
If the source or destination MAC address belongs to multiple VLANs, you must specify the VLAN to which both the source and
destination MAC addresses belong.
If the VLAN is not specified, the path is not identified, and an error message appears.
The Layer 2 traceroute feature is not supported when multiple devices are attached to one port through hubs (for example,
multiple CDP neighbors are detected on a port).
When more than one CDP neighbor is detected on a port, the Layer 2 path is not identified, and an error message appears.
This feature is not supported in Token Ring VLANs.
Examples
This example shows how to display the Layer 2 path by specifying the source and destination MAC addresses:
Device# traceroute mac 0000.0201.0601 0000.0201.0201
Source 0000.0201.0601 found on con6[WS-C3750E-24PD] (2.2.6.6)
con6 (2.2.6.6) :Gi0/0/1 => Gi0/0/3
con5 (2.2.5.5 ) : Gi0/0/3 => Gi0/0/1
con1 (2.2.1.1 ) : Gi0/0/1 => Gi0/0/2
con2 (2.2.2.2 ) : Gi0/0/2 => Gi0/0/1
Destination 0000.0201.0201 found on con2[WS-C3550-24] (2.2.2.2)
Layer 2 trace completed
This example shows how to display the Layer 2 path by using the detail keyword:
Device# traceroute mac 0000.0201.0601 0000.0201.0201 detail
Source 0000.0201.0601 found on con6[WS-C3750E-24PD] (2.2.6.6)
con6 / WS-C3750E-24PD / 2.2.6.6 :
Gi0/0/2 [auto, auto] => Gi0/0/3 [auto, auto]
con5 / WS-C2950G-24-EI / 2.2.5.5 :
Fa0/3 [auto, auto] => Gi0/1 [auto, auto]
con1 / WS-C3550-12G / 2.2.1.1 :
Gi0/1 [auto, auto] => Gi0/2 [auto, auto]
con2 / WS-C3550-24 / 2.2.2.2 :
Gi0/2 [auto, auto] => Fa0/1 [auto, auto]
Destination 0000.0201.0201 found on con2[WS-C3550-24] (2.2.2.2)
Layer 2 trace completed.
This example shows how to display the Layer 2 path by specifying the interfaces on the source and destination es:
Device# traceroute mac interface fastethernet0/1 0000.0201.0601 interface fastethernet0/3 0000.0201.0201
Source 0000.0201.0601 found on con6[WS-C3750E-24PD] (2.2.6.6)
con6 (2.2.6.6) :Gi0/0/1 => Gi0/0/3
con5 (2.2.5.5 ) : Gi0/0/3 => Gi0/0/1
con1 (2.2.1.1 ) : Gi0/0/1 => Gi0/0/2
con2 (2.2.2.2 ) : Gi0/0/2 => Gi0/0/1
Destination 0000.0201.0201 found on con2[WS-C3550-24] (2.2.2.2)
Layer 2 trace completed
This example shows the Layer 2 path when the is not connected to the source :
Device# traceroute mac 0000.0201.0501 0000.0201.0201 detail
Source not directly connected, tracing source .....
Source 0000.0201.0501 found on con5[WS-C3750E-24TD] (2.2.5.5)
con5 / WS-C3750E-24TD / 2.2.5.5 :
Gi0/0/1 [auto, auto] => Gi0/0/3 [auto, auto]
con1 / WS-C3550-12G / 2.2.1.1 :
Gi0/1 [auto, auto] => Gi0/2 [auto, auto]
con2 / WS-C3550-24 / 2.2.2.2 :
Gi0/2 [auto, auto] => Fa0/1 [auto, auto]
Destination 0000.0201.0201 found on con2[WS-C3550-24] (2.2.2.2)
Layer 2 trace completed.
This example shows the Layer 2 path when the cannot find the destination port for the source MAC address:
Device# traceroute mac 0000.0011.1111 0000.0201.0201
Error:Source Mac address not found.
Layer2 trace aborted.
This example shows the Layer 2 path when the source and destination devices are in different VLANs:
Device# traceroute mac 0000.0201.0601 0000.0301.0201
Error:Source and destination macs are on different vlans.
Layer2 trace aborted.
This example shows the Layer 2 path when the destination MAC address is a multicast address:
Device# traceroute mac 0000.0201.0601 0100.0201.0201
Invalid destination mac address
This example shows the Layer 2 path when source and destination es belong to multiple VLANs:
Device# traceroute mac 0000.0201.0601 0000.0201.0201
Error:Mac found on multiple vlans.
Layer2 trace aborted.