Port Mirroring
Table of Contents
A switch configuration that copies traffic from one or more source ports to a designated monitor port, allowing passive observation of network traffic without disrupting it. The monitoring device receives a copy of all frames passing through the mirrored ports.
Related: Wireshark Zeek Network Traffic Analysis Intrusion Detection System
Terminology
| Term | Meaning |
|---|---|
| SPAN (Switched Port Analyzer) | Cisco terminology for port mirroring |
| RSPAN | Remote SPAN — mirror traffic to a different switch |
| TAP (Test Access Point) | Hardware device that physically splits the signal — more reliable than SPAN |
| Monitor port | The destination port receiving the copy |
| Source port | The port(s) being mirrored |
SPAN vs TAP
| SPAN | Hardware TAP | |
|---|---|---|
| Setup | Software configuration on the switch | Physical inline device |
| Performance impact | May drop packets under high load | Passive — no impact |
| Reliability | Can miss traffic if switch is overloaded | Captures everything |
| Cost | Free (built into managed switches) | Hardware cost |
| Use case | Lab, light monitoring | Production IDS/NDR |
For production IDS and forensic-grade capture, hardware TAPs are preferred — SPAN can drop packets when the switch is busy.
Cisco SPAN Configuration
! Monitor port 1 and 2, send copies to port 24 Switch(config)# monitor session 1 source interface Gi0/1 - 2 Switch(config)# monitor session 1 destination interface Gi0/24 ! Monitor an entire VLAN Switch(config)# monitor session 1 source vlan 10 Switch(config)# monitor session 1 destination interface Gi0/24 ! Verify Switch# show monitor session 1
Use Cases
- IDS/IPS — feed mirrored traffic to a detection sensor without inline deployment risk
- Zeek — run on the monitor port to generate structured connection logs for threat hunting and anomaly detection
- Wireshark / packet capture — full packet analysis during an incident investigation
- Performance monitoring — baseline traffic patterns and identify bandwidth consumers
- Lab capture — mirror traffic between VMs in a virtual switch (VMware vSwitch, Open vSwitch) for analysis
Virtual Switch Port Mirroring
VMware vSwitch:
— vSphere → switch settings → Enable Promiscuous Mode on the
portgroup the monitoring VM is connected to
Open vSwitch (Linux lab):
ovs-vsctl add-br br0
ovs-vsctl -- set Bridge br0 mirrors=@m \
-- --id=@src get Port eth0 \
-- --id=@dst get Port eth1 \
-- --id=@m create Mirror name=mirror0 \
select-dst-port=@src output-port=@dst
Tips
- A monitor port receives but should not send — configure it as receive-only to avoid the monitoring device accidentally injecting traffic
- SPAN sessions have a limit (typically 4 per switch) and high-volume mirroring degrades switch performance — plan capacity
- In a home lab, promiscuous mode on a virtual switch port-group achieves the same effect as SPAN for VM-to-VM traffic capture
- For Zeek deployments, point it at the SPAN or TAP port receiving all north-south traffic for full network visibility