Concepts / Switches

Switches

Port mirroring (SPAN)

Also called SPAN, mirror port, monitor session, network tap, TAP, RSPAN

A switch copying every frame of some ports out of another port, where a sensor or capture box listens.

The problem

A capture box on its own switch port sees only its own traffic, not the conversations it should watch.

  1. Carol's machine will be the capture box; the conversation to watch is alice's, on the port alice.
  2. officeSwitch is told to copy every frame in and out of alice to the port carol (on Linux, a tc mirror rule).
  3. Alice pings bob. The switch forwards each frame to bob as usual, and sends a copy to carol.
  4. Carol records frames that are not addressed to her, without being in their path.
The switch sends a copy and still forwards the original
The switch sends a copy and still forwards the original

The capture box gets a copy of each frame out of the destination port. It is not on the path from A to B, so it can watch the conversation but cannot slow or break it.

What you'd see

$ tcpdump -e -nn -i eth0 icmp
18:49:19.765343 b6:a0:12:30:a8:0b > 06:c7:51:36:4e:b8, ethertype IPv4 (0x0800), length 98: 10.0.1.10 > 10.0.1.11: ICMP echo request, id 81, seq 1, length 64
18:49:19.765372 06:c7:51:36:4e:b8 > b6:a0:12:30:a8:0b, ethertype IPv4 (0x0800), length 98: 10.0.1.11 > 10.0.1.10: ICMP echo reply, id 81, seq 1, length 64
  • Recorded on carol, while the switch knew both alice and bob, so nothing was flooded.
  • 10.0.1.10 > 10.0.1.11 and back: alice and bob's ping, seen by carol only because the port is mirrored.
  • Bob still got every frame: a mirror copies, it never diverts.

Guess first

Carol's capture box stops. Does alice's ping to bob break?

Show answer

No. The originals still go from alice to bob; only the copies are lost. A mirror can neither slow nor break what it watches.

In short

Port mirroring (SPAN on Cisco) makes a switch send a copy of every frame on chosen source ports out of one destination port, and still forwards the original. An IDS or capture box there sees conversations not addressed to it, and cannot slow or break them. A network TAP does the same in hardware on one cable. If the sources carry more than the destination port can, copies are lost.

See it on real machines

Read next

Learn it on real machines.

Every lab is a small network of real Linux machines in your browser. Sign in with Google or email to start.

Start this lab