One of the many useful features that Cisco provides in its switching technology is the Switched Port ANalyzer (SPAN). It allows you to mirror traffic from a target port, set of ports, VLAN or set of VLANs to another port or VLAN. This is useful for several reasons.
First, security. As a SPAN port allows you to view traffic running through your switch, you can monitor said traffic for violations and threats. The classic example is attaching a sniffer/IDS to the span port of the switch closest to your egress point. In the example below, you’ll want to monitor the trunk port (FE0/24) that connects the switch the edge router.
Second, performance monitoring. You can use the span port in conjunction with something like TCPDump or Wireshark to monitor the packets running across the network. You can thereby see if you duplicate or unexpected traffic, errors and other potential issues inside the network. You can also utilize certain software tools which monitor packets and generate traffic/packet statistics (such as NTOP).
Finally, troubleshooting. You can use the SPAN port to troubleshoot network issues. If you’re trying to ensure that multicast traffic traverses your switch, you can monitor the SPAN port with TCPDump/Wireshark to see if the traffic goes through. While you can do the same with debug commands on the routers, sometimes it’s valuable to see the traffic as it comes across the switch directly.
That’s it for a quick intro. I’ll post more example diagrams and the configs later.
Example 1: Basic setup. Monitoring a single port on the same VLAN.
Switch Type: Cisco 3750 running 12.2(35)SE5
Target port: FastEthernet1/0/18
Monitoring Port: FastEthernet1/0/8
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#monitor session 1 source interface fastethernet1/0/18
Switch(config)#monitor session 1 destination interface fastethernet1/0/8
Switch(config)#end
Switch#show monitor session 1
Session 1
———
Type : Local Session
Source Ports :
Both : Fa1/0/18
Destination Ports : Fa1/0/8
Encapsulation : Native
Ingress : DisabledSwitch#sh int fa1/0/8
FastEthernet1/0/8 is up, line protocol is down (monitoring)
Hardware is Fast Ethernet, address is 001f.6c6b.0f0a (bia 001f.6c6b.0f0a)
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set
Keepalive set (10 sec)
Full-duplex, 100Mb/s, media type is 10/100BaseTX
input flow-control is off, output flow-control is unsupported
ARP type: ARPA, ARP Timeout 04:00:00
Last input never, output 00:00:23, output hang never
Last clearing of “show interface” counters never
Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
Queueing strategy: fifo
Output queue: 0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 11000 bits/sec, 5 packets/sec
1210 packets input, 119091 bytes, 0 no buffer
Received 762 broadcasts (0 multicasts)
0 runts, 0 giants, 0 throttles
(SNIP)
To test this, fire up Wireshark on your monitoring computer. You should be able to monitor packets from your target at this point. As you can see in the screenshot below, I pinged 1.2.3.4 and 5.6.7.8; Wireshark picked up these packets (among others) on the monitoring computer.



