Mirror Configuration
[Command] show mirror
[Purpose] Show configuration related to mirror
[View] System view
[Use Cases]
sonic# show mirror session+----------------+--------------------+---------------+--------+-------------+| Session Name | Destination Port | Source Port | Type | Direction |+================+====================+===============+========+=============+| 1 | Ethernet1 | Ethernet2 | SPAN | BOTH |+----------------+--------------------+---------------+--------+-------------+mirror session
Section titled “mirror session”[Command] mirror sessionidspan [direction {rx|tx|both}] {src-ethernet|src-vlan}port-name{dst-ethernet}port-name no mirror session*id*span
[Purpose] Create a mirror session or add port to the mirror session
[Parameter]
| Parameter | Description |
|---|---|
| id | mirror session ID, value range: 1-6 |
| interface-name | Interface name, support VLAN interface and Ethernet interface |
| direction {rx|tx|both} | Direction of traffic to be mirrored |
| rx | the entry direction |
| tx | the outgoing direction |
| both | mirror in both directions |
| {src-ethernet|src-vlan} | The interface on which traffic needs to be mirrored |
| {dst-ethernet} | The destination interface for mirrored traffic |
[View] System configuration view
[Use Cases]
sonic# configuresonic(config)# mirror session 1 span direction both src-ethernet 2 dst-ethernet 3mirror session id erspan
Section titled “mirror session id erspan”[Command] mirror sessioniderspan [direction {rx|tx|both}] {src-ethernet}port-namegre-src-ipA.B.C.D/A::Bgre-dst-ipA.B.C.D/A::B**[gre-vrfvrf-name]** no mirror sessioniderspan
[Purpose] Create a remote mirroring session and add the source and destination addresses for GRE encapsulation
[Parameter]
| Parameter | Description |
|---|---|
| id | Mirror session ID, valid range: 1-6 |
| direction {rx|tx|both} | Traffic direction to be mirrored. |
| rx | Inbound direction. |
| tx | Outbound direction. |
| {src-ethernet} | Interface to be mirrored. |
| gre-src-ip | Source IP for GRE encapsulation |
| gre-dst-ip | Destination IP for GRE encapsulation |
| vrf-name | VRF for GRE encapsulation, with the default VRF set to “default” |
[View] System view
[Usage Scenario] ERSPAN is a Layer 3 remote mirroring technology that duplicates packets from specified ports. It sends the duplicated packets to a remote data monitoring device through a GRE tunnel, allowing users to analyze these packets using the monitoring device for network monitoring and troubleshooting.
[Notes] To configure encapsulation parameters for Layer 3 remote mirroring, you only need to specify the mirror source and destination port on the source device. Additionally, all devices must have a unicast routing protocol configured, ensuring a seamless Layer 3 network between the devices.It should be noted that ERSPAN needs to be configured after the destination IP actually takes effect. For example, if the destination IP corresponds to a static ARP, then the static ARP needs to be configured first before configuring the ERSPAN function.
[Use Cases]
sonic# configuresonic(config)# mirror session 1 erspan direction rx src-ethernet 3 gre-src-ip 10.1.1.1 gre-dst-ip 30.1.1.2