Network: репликация трафика span, rspan, erspan, tap, optical splitter, bypass

SPAN/RSPAN
  • SPAN – Switch Port Analyzer. Local mirroring of traffic to SPAN destination ports
  • RSPAN – Remote mirroring of traffic, spend send through RSPAN vlan to remote destinations.
  • ERSPAN – Encapsulation(IPv4) of traffic to ERSPAN remote destinations.

Правила/особенности настройки SPAN (Cisco Catalyst):

  • На большинстве моделей есть ограничения по Destination порту (на который трафик передается) – 1) может использоваться только один в span сессии 2) portchannel с балансировкой трафика не может использоваться в качестве destination
    • в случае необходимости отправки на несколько портов в таком случае может помочь отключение mac learning и превращение свича в хаб для определенного vlan (с учетом всех недостатков этого отключения)
    • при этом на Cisco WS-C3850-12XS 16.09.03a возможно как использование нескольких интерфейсов как destination, так и использование в качестве destination LAG (portchannel)
С4900(config)#monitor session 1 destination interface Te1/3
% This platform allows a maximum of 1 monitor destination(s)

С3850#show running-config | i monitor
monitor session 2 source interface Te1/0/3 - 6 rx
monitor session 2 destination interface Te1/0/1, Te1/0/11
monitor session 2 destination interface Po2
  • Source порт (с которого трафик забирается) может использоваться в нескольких span сессиях
  • Source портов может быть несколько в одной span сессии (в том числе непоследовательные, через запятую), но в одной сессии нельзя использовать и source vlan и source interfaces (в том числе может использоваться portchannel) одновременно
  • Source не должен быть равен destination порт
  • Ingress – по умолчанию после включения span на destination порт он перестает изучать MAC с этого порта и дропает весь входящий трафик приходящий на этот порт (не исходящий с порта). Для разрешения трафика нужно при указании destination порта указывать ingress (если поддерживается).
  • При настройке источника и назначения всегда нужно учитывать возможное несоответствие (oversubscription) в пропускной способности, это касается как того, что снятие одного порта rx/tx требует х2 ресурсов т.к. обе полосы должны поместится в tx span порта; так и того, когда порты разноскоростные – порта со span и с которого происходит mirroring – 10gbip -> 1gbit, vlan traffic 3gb -> 1gbit, etc.
  • Разное количество span сессий может поддерживаться коммутаторами, к примеру, Cat 2950 может поддерживать 2, а Cat 3750 66 сессий.
Switch(config)#monitor session ?
  <1-66>  SPAN session number
CONFIG

Простейшая настройка на Cisco Catalyst:

# SRC
monitor session 1 source interface gigabitEthernet 0/1 both

monitor session 1 source vlan 10 both

# DST
monitor session 1 destination interface gigabitEthernet 0/1
monitor session 1 destination interface gigabitEthernet 0/1 ingress untagged vlan 1 # разрешаем прием трафика на destination port как принадлежащий vlan 1, опция ingress может не поддерживаться


# DELETE
no monitor session 1
no monitor # clears all SPAN sessions

Можно настроить много разных фильтров на сессию.

Можно встретить:

  • rx (использую чаще всего)/tx/both
  • good/bad (только без ошибок/только с ошибками; по умолчанию good)
  • unicast/multicast/broadcast
  • vlan
  • acl
When filters of both types are configured, only packets that pass both filters are spanned. For example, if you set both “error” and “multicast,” only multicast packets with errors are spanned.

monitor session 1 filter packet-type good rx # default
monitor session 1 filter vlan 1
monitor session 1 filter address-type unicast rx

Доступность настроек зависит от платформы:

(CAT3K_CAA-UNIVERSALK9-M), Version 16.9.3a
SW(config)#monitor session 1 filter ?
ip Specify IP Access control rules
ipv6 Specify IPv6 Access control rules
mac Specify MAC Access control rules
vlan SPAN filter VLAN

(cat4500e-IPBASE-M), Version 15.0(2)SG
SW(config)#monitor session 1 filter ?
address-type SPAN filter address-type
ip Specify IP Access control rules
packet-type SPAN filter packet-type
vlan SPAN filter VLAN

RSPAN

RSPAN vlan – это грубо говоря vlan с отключенным mac-learning. Если другой вендор это поддерживает, то можно и между вендорами пробрасывать.

monitor session 1 destination remote vlan 1007 # rspan
SHOW
Switch#show monitor session all
Session 1
---------
Type                     : Local Session
Source Ports             :
    Both                 : Gi0/1
Destination Ports     : Gi0/2
    Encapsulation     : Native

Switch#show monitor session 1 detail
Session 1
---------
Type                     : Local Session
Description            : -
Source Ports             :
    RX Only              : None
    TX Only              : None
    Both                 : Gi0/1
Source VLANs             :
    RX Only              : None
    TX Only              : None
    Both                 : None
Source RSPAN VLAN      : None
Destination Ports      : Gi0/2
    Encapsulation      : Native
Filter VLANs           : None
Dest RSPAN VLAN        : None
Profitap (profishark)

Продают как tap 1/10G (copper/fiber), так и packet brokers и даже 10/40G bypass tap для врезки перед ngfw/ips как router on a stick с активным мониторингом.

https://www.profitap.com/profishark-1g/
https://www.youtube.com/watch?v=ylj7ER9PUBU 
Network Tap

Ixia пиарит свои tap, находя все возможные аргументы против использования span – низкая производительность, собирает не все, дорого стоит (время сотрудников), небезопасно. По факту, довольно спорно, причем по каждому пункту.

Вот пример.

Там ссылаются на white paper Cisco каких-то мохнатых годов, который даже сложно найти на просторах интернета.

“the switch treats SPAN data with a lower priority than regular port-to-port data.”

Во первых если все таки постараться найти источник, то тут пишется о ситуации, когда на одном и том же порту передается span и обычный трафик. Это очень хорошо, что при переподписке трафика будет дропнут span-трафик, а не пользовательский. Тоже самое (другими словами) пишется и в текущих доках Cisco к span.

Cisco explanation
"Cisco warns that the switch treats SPAN data with a lower priority than regular port-to-port data. In other words, if any resource under load must choose between passing normal traffic and SPAN data, the SPAN loses and the mirrored frames are arbitrarily discarded. This rule applies to preserving network traffic in any situation. For instance, when transporting remote SPAN traffic through an Inter Switch Link (ISL), which shares the ISL bandwidth with regular network traffic, the network traffic takes priority. If there is not enough capacity for the remote SPAN traffic, the switch drops it."
Cisco explanation2
Switch congestion can cause packets to be dropped at ingress source ports, egress source ports, or SPAN destination ports. In general, these characteristics are independent of one another. For example:
- A packet might be forwarded normally but dropped from monitoring due to an oversubscribed SPAN destination port.
- An ingress packet might be dropped from normal forwarding, but still appear on the SPAN destination port.
- An egress packet dropped because of switch congestion is also dropped from egress SPAN.

Leave a Reply