3 Aralık 2016 Cumartesi

Port Mirroring, Span,Rspan,Erspan

You can mirror all traffic on the interface to another interface, İt is very useful metod for monitoring.

set ethernet-switching-options analyzer sflow input ingress interface ge-0/0/0.0
set ethernet-switching-options analyzer sflow input egress interface ge-0/0/0.0

set ethernet-switching-options analyzer sflow output interface ge-0/0/1.0(This port will be closed the traffic just listen ge-0/0/0)

For cisco devices;
Span;

monitor session 1 source interface FastEthernet 0/1 -10 both (you can choose rx or tx)

analyzer port is 24;
monitor session 1 destination interface FastEthernet0/24

 that is it :) also you can monitor vlan traffic , I will give you a simple instance ;

monitor session 1 source vlan 10 rx
monitor session 1 source vlan 20 tx
monitor session 1 destination interface fastEthernet 0/24
-------------
Switch(config)#monitor session 1 source interface fa0/1
Switch(config)#monitor session 1 destination interface fa0/2
 
This filter above will only forward VLAN 1 – 100 to the destination
 
Switch(config)#monitor session 1 filter vlan 1 - 100 

---
monitor session 1 source interface Gi1/0/5 , Gi1/0/31
monitor session 1 source interface Gi2/0/5 , Gi2/0/31
monitor session 1 destination interface Gi1/0/8
monitor session 2 source interface Gi1/0/1 - 4
monitor session 2 source interface Gi2/0/1 - 4
monitor session 2 destination interface Gi1/0/45
Limitations;

Destination port must be a Physical port , portchannel dont accept on this device.

Destination port only monitor one session not support two or more than.


Rspan;

İt works similar like a span. all traffic sent to vlan not interface.
it is useful method for voice vlan.

Bir adet remote vlan belirliyoruz ornegin 555 olsun. daha sonra bu vlan mirror etmek istedğimiz vlanı atıyoruz vlan 120. Sw1 de iste sunucuya gönderiyoruz. 3. bir switch var ise arada portlar trunk olup remote-span tanımı yapılması yeterlıdir

Switch0 (config)#vlan 555
Switch0 (config-vlan)#remote-span
Switch0 (config-vlan)#exit
Switch0 (config)#monitor session 1 source vlan 120
Switch0 (config)#monitor session 1 destination remote vlan 555

Switch1 (config)#vlan 555
Switch1 (config-vlan)#remote-span
Switch1 (config-vlan)#exit
Switch1 (config)#monitor session 1 source remote vlan 555
Switch1 (config)#monitor session 1 destination interface gi0/2

You can save all calling conversation at voip device.



RSPAN Configuration

To demonstrate RSPAN I will use a topology with two switches:
cisco rspan sw1 sw2
The idea is to forward traffic from FastEthernet 0/1 on SW1 to FastEthernet 0/1 on SW2. There are a couple of things we have to configure here:

SW1(config)#vlan 100
SW1(config-vlan)#remote-span
SW2(config)#vlan 100
SW2(config-vlan)#remote-span
 
 
First we need to create the VLAN and tell the switches that it’s a RSPAN vlan. This is something that is easily forgotten. Secondly we will configure the link between the two switches as a trunk:

SW1(config)#interface fastEthernet 0/24
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW2(config)#interface fastEthernet 0/24
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#switchport mode trunk
 
 
Now we can configure RSPAN:
SW1(config)#monitor session 1 source interface fastEthernet 0/1
SW1(config)#monitor session 1 destination remote vlan 100
 
 
This selects FastEthernet 0/1 as the source and VLAN 100 as the destination…

SW2(config)#monitor session 1 source remote vlan 100
SW2(config)#monitor session 1 destination interface fastEthernet 0/1
 
And on SW2, we select VLAN 100 as the source and FastEthernet 0/1 as its destination. Here’s the output of the show monitor session command:


SW1#show monitor session 1
Session 1
---------
Type                   : Remote Source Session
Source Ports           :
    Both               : Fa0/1
Dest RSPAN VLAN        : 100
SW2#show monitor session 1
Session 1
---------
Type                   : Remote Destination Session
Source RSPAN VLAN      : 100
Destination Ports      : Fa0/1
    Encapsulation      : Native
          Ingress      : Disabled


----

ERSPAN


Kaynakta yapılacak ERSPAN source konfigürasyonu:
SUBE#conf t
Enter configuration commands, one per line. End with CNTL/Z .
SUBE(config)#monitor session 20 type erspan-source
SUBE(config-mon-erspan-src)#description MONITOR_EDILECEK_TRAFIK
SUBE(config-mon-erspan-src)#source vlan 79
SUBE(config-mon-erspan-src)#
SUBE(config-mon-erspan-src)#no shutdown
SUBE(config-mon-erspan-src)#destination
SUBE(config-mon-erspan-src-dst)#erspan-id 50
SUBE(config-mon-erspan-src-dst)#ip address 172.16.1.2
SUBE(config-mon-erspan-src-dst)#origin ip address 10.20.30.40
SUBE(config-mon-erspan-src-dst)#end
Şubede yaptığımız konfigürasyon aşağıda belirtildiği şekilde görüntülenebilir.
SUBE#show monitor session 20
Session 20
———-
Type : ERSPAN Source Session
Status : Admin Enabled
Description : MONITOR_EDILECEK_TRAFIK
Source VLANs :
Both : 79
Destination IP Address : 172.16.1.2
Destination ERSPAN ID : 50
Origin IP Address : 10.20.30.40
Egress SPAN Replication State:
Operational mode : Centralized
Configured mode : Centralized (default)
Şimdi sıra geldi merkezde yapılacak ERSPAN hedef konfigürasyonuna
MERKEZ#conf t
Enter configuration commands, one per line. End with CNTL/Z.
MERKEZ(config)#monitor session 30 type erspan-destination
MERKEZ(config-mon-erspan-dst)#description SUBEDEN_ALINAN_TRAFIK
MERKEZ(config-mon-erspan-dst)#destination interface FastEthernet 4/13
MERKEZ(config-mon-erspan-dst)#no shutdown
MERKEZ(config-mon-erspan-dst)#
MERKEZ(config-mon-erspan-dst)#source
MERKEZ(config-mon-erspan-dst-src)#erspan-id 50
MERKEZ(config-mon-erspan-dst-src)#ip address 172.16.1.2
MERKEZ(config-mon-erspan-dst-src)#end
Merkezde yaptığımız konfigürasyon aşağıda belirtildiği şekilde görüntülenebilir.
MERKEZ#show monitor session 30
Session 30
———-
Type : ERSPAN Destination Session
Status : Admin Enabled
Description : SUBEDEN_ALINAN_TRAFIK
Destination Ports : Fa4/13
Source IP Address : 172.16.1.2
Source ERSPAN ID : 50
Konfigürasyonumuzu tamamladıktan sonra şubeden gelen SPAN(monitor) trafiğini artık izleyebilir hale geldik.
Teknik olarak bir cihazın hem ERSPAN kaynak, hem de ERSPAN hedef cihazı olmasını engelleyecek bir kısıtlama yoktur. Bu durumda ERSPAN local SPAN gibi çalışacaktır. Konfigürasyon esnasında girilecek IP adresleri router ya da switch üzerindeki herhangi bir interface’in IP adresi olabilir.
Son olarak ERSPAN yapılırken dikkat dikkat edilmesi gereken hususlara değinip bu yazıma son vereceğim.
– ERSPAN ile bir paketin üzerine 50 bytlık bir header eklenmektedir. Bu yüzden MTU size’lara dikkat etmek gerekebilir.
– Her bir ERSPAN içinde tanımlayabileceğimiz port sayısı maksimum 128 dir
– Hem kaynak hem de hedef için birden fazla interface tanımlaması yapılabilmektedir.
– Bir kaynakta source interface olarak aynı anda hem VLAN hem de fiziksel interface tanımlanmasına izin verilmemektedir. İksinden bir tanesini seçmek durumundayız.
– Port-Channel interface’ler kaynak olarak tanımlanabilmektedir.
– Kaynakta ya da hedef bir kere ERSPAN oturumu oluşturulduğunda, CLI üzerinden oturumun ID’si ve tipinin değiştirilmesine izin verilmemektedir. Yapılabilecek tek şey no komutuyla konfigürasyonu kaldırıp baştan konfigürasyon yapmaktır.
– WAN interfacelerde VLAN filtrelemesi yapılamamaktadır.

Hiç yorum yok:

Yorum Gönder