Mirror Configuration
6 min
\<font color="#1d50a2">mirror configuration\</font> \<font color="#1d50a2">show mirror session\</font> \[command] show mirror session \[ number ] \[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 | + + + + + + \<font color="#1d50a2">mirror session\</font> \[command] mirror session session id span \[direction {rx|tx|both}] {src ethernet|src vlan} port name {dst ethernet|dst vlan|dst link aggregation} port name no mirror session id span \[purpose] create a mirror session or add port to the mirror session \[parameter] parameter description session id mirror session id, value range 1 6 port name interface name, support vlan interface and ethernet interface direction {rx|tx|both} direction of traffic to be mirroredrx is the entry directiontx is the outgoing directionboth is mirror in both directions {src ethernet|src vlan} the interface on which traffic needs to be mirrored {dst ethernet|dst vlan|dst link aggregation} the destination interface for mirrored traffic \[view] system configuration view \[use cases] sonic(config)# mirror session 1 span sonic(config span mirror 1)# src ethernet 4 sonic(config span mirror 1)# dst ethernet 7 sonic(config span mirror 1)# \<font color="#1d50a2">mirror session rspan\</font> \[command] mirror session id rspan \[direction {rx|tx|both}] {src ethernet|src vlan} port name {dst ethernet|dst link aggregation} port name remote vlan vlan id no mirror session id rspan \[purpose] create a remote mirroring session or add source/destination interfaces to an existing mirroring session \[parameter] parameter description id mirror session id, valid range 1 6 port name interface name, supports vlan interfaces and ethernet interfaces direction {rx|tx|both} traffic direction to be mirrored rx inbound direction tx outbound direction both both directions, mirroring all traffic {src ethernet|src vlan} interface to be mirrored {dst ethernetdst link aggregation} destination interface for mirrored traffic vlan id rspan dedicated vlan for mirroring traffic \[view] system view \[usage scenario] rspan's main function is to copy the traffic of ports on one switch to an analysis port on another remote switch, allowing network administrators to monitor and analyze traffic on the remote switch without direct access to the target device remote switched port analyzer (rspan) builds upon local port mirroring by encapsulating packets with a specified vlan, transmitting them through intermediate devices, and ultimately reaching the destination switch the vlan is then stripped off at the destination switch before being forwarded to the backend analyzer \[notes] as the rspan dedicated vlan, "remote vlan" is not recommended for other purposes the destination interface needs to be added to the "remote vlan " \[use cases] sonic(config)# mirror session 1 rspan sonic(config rspan mirror 1)# src ethernet 4 sonic(config rspan mirror 1)# dst ethernet 7 sonic(config rspan mirror 1)# remote vlan 100 \<font color="#1d50a2">mirror session erspan\</font> \[command] mirror session id erspan \[direction {rx|tx|both}] {src ethernet|src vlan} port name src ip ip address dst ip ip address \[vrf vrf name ] no mirror session id erspan \[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 7 direction {rx|tx|both} traffic direction to be mirrored rx inbound direction tx outbound direction both both directions, mirroring all traffic {src ethernet|src vlan} interface to be mirrored ip address source ip address and destination ip address for gre encapsulation vrf name vrf for gre encapsulation \[view] system view \[usage scenario] erspan is a layer 3 remote mirroring technology that duplicates packets from specified ports or vlans 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 \[comment] 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 \[use cases] sonic# configure sonic(config)# mirror session 1 erspan sonic(config erspan mirror 1)# src ethernet 1 sonic(config erspan mirror 1)# src ip 10 1 5 1 sonic(config erspan mirror 1)# dst ip 20 1 5 1 sonic(config erspan mirror 1)# exit
