1-SPAN(Switched Port Analyzer Network)

To sniff or to analyse traffic on specific port or Vlan you can use SPAN. As it is shown in Figure 1, we want to have traffic of FastEthernet0/1 on port FastEthernet0/10. So, simple we can define monitor session for interface FastEthernet0/1 as a source and FastEthernet0/10 as a destination.

Figure 1: SPAN
Enter a caption for this image (optional)
SW# conf t
SW(config)#monitor session 1 source int fa0/1
SW(config)#monitor session 1 destination int fa0/10

You can define a receive, transmit or both in monitor session:

SW(config)#monitor session 1 source int fa0/1 rx | tx | both

2- RSPAN(Remotely Switched Port Analyzer Network)

This is exactly the same scenario of SPAN, but here we remotely monitor a port in switch. First, you have to define separate Vlan between two switches. Then, you can specify source and destination.

Enter a caption for this image (optional)
SW1# conf t
SW1(config)#vlan 20
SW1(config)#remote-span
SW1(config)#exit
SW1(config)#monitor session 1 source int fa0/1
SW1(config)#monitor session 1 destination remote-vlan 20
SW1# conf t
SW1(config)#monitor session 1 source remote-vlan 20
SW1(config)#monitor session 1 destination int fa0/10
3- show command
SW# show monitor session 1 detail