Cisco SPAN

From HackerNet
Revision as of 20:06, 28 January 2016 by Helikopter (talk | contribs)
Jump to: navigation, search

Switch Port Analyzer är Ciscos namn på att spegla trafik, antingen på samma switch eller till en remote switch. Alla typer av portar kan speglas. SPAN består av source (portar eller VLAN) och destination port/ar. Med RSPAN fungerar source på samma sätt men destination port finns på en annan switch så det skickas i ett RSPAN VLAN till den andra switchen. ERSPAN (Encapsulated Remote SPAN) är samma som RSPAN men att det kapslas in med GRE så att det kan routas till en annan switch. Man kan även ha Wireshark som endpoint för GRE-tunneln. Man kan välja om rx, tx eller att både och ska speglas, default är all rx och tx med undantag vissa frames (t.ex. CDP, BPDU, VTP, DTP, PAgP). SPAN ligger före trafikmodifikation för receive, t.ex. VACL, QoS och ingress policing. För tx ligger det efter så med andra ord SPAN händer längst ut. På vissa low-end switchar måste man låna en asic från en oanvänd port för att switchen ska kunna SPANa.

Begränsningar

  • All konfigurationen på en port inaktiveras när den blir konfad som destination port för SPAN. Inklusive EtherChannel.
  • Destination port har inte stöd för 802.1x, Private VLAN, CDP, STP, VTP, DTP, etc.
  • Som source går det ej att mixa portar och VLAN.
  • Destinationporten är best effort, dvs överflöd slängs.
  • Endast en SPAN-session kan skicka trafik till en destination port.

SPAN

IOS

monitor session 1 source interface fa0/2 rx
monitor session 1 source interface fa0/3 both
monitor session 1 destination interface fa0/10 encapsulation replicate

Encapsulation replicate gör att exakt alla frames speglas.

monitor session 1 filter vlan 2 - 5

Speglar man en trunkport kan man filtrera bort VLAN.

NX-OS
Destination

interface Ethernet1/1
 description MONITOR-SESSION-1
 switchport
 switchport monitor
 no shutdown

Monitor session

monitor session 1
 description SPAN-to-SERVER
 source vlan 10-20 both
 rate-limit auto
 destination interface Ethernet1/1
 no shut

Verify

show monitor

RSPAN

Skapa RSPAN VLAN på alla switchar.

vlan 999
 remote span
 exit

Source & Destination

monitor session 1 source interface fa0/3 both
monitor session 1 destination remote vlan 999

Switch 2

monitor session 1 source remote vlan 999
monitor session 1 destination interface gi0/8

Verify

show monitor session 1

ERSPAN

IOS
Source

monitor session 1 type erspan-source
source interface gi0/1 both
no shut
destination
 erspan-id 101
 ip address 10.0.0.20
 origin ip address 172.20.0.10

Destination

monitor session 1 type erspan-destination
destination interface gi0/2 
no shut
source
 erspan-id 101
 ip address 10.0.0.20

Verify

show monitor session 1

NX-OS

monitor session 1 type erspan-source
description ERSPAN direct to Sniffer PC
erspan-id 32                              # required, # between 1-1023
vrf default                               # required
destination ip 10.1.2.3                   # IP address of Sniffer PC
source interface port-channel1 both       # Port(s) to be sniffed
filter vlan 3900                          # limit VLAN(s) (optional)
no shut                                   # enable
monitor erspan origin ip-address 10.1.2.1 global