В маршрутизаторах серии ESR реализована возможность анализировать трафик на интерфейсах из CLI. Сниффер запускается командой monitor:
esr# monitor ? bridge Bridge interface e1 E1 interface fortygigabitethernet Fortygigabitethernet interface gigabitethernet Gigabit interface gre GRE tunnel hundredgigabitethernet hundredgigabitethernet interface ip4ip4 IPv4-over-IPv4 tunnel l2tp L2TP tunnel l2tpv3 L2TPV3 tunnel lt logical tunnel modem Show IP information of specific modem interface multilink Multilink interface openvpn OpenVPN tunnel port-channel port-channel interface pppoe PPPoE tunnel pptp PPTP tunnel tengigabitethernet Tengigabit interface twentyfivegigabitethernet Twentyfivegigabitethernet interface vti VTI tunnel wireguard Wireguard tunnel
Для удобства использования организована возможность фильтрации вывода, например:
esr# monitor gigabitethernet 1/0/1 ? address Filter by IP address destination-address Filter by destination IP address destination-mac Filter by destination MAC address detailed Detailed output file Write a traffic dump into file host-mac Filter by MAC address packets Count packets protocol Choose protocol type source-address Filter by source IP address source-mac Filter by source MAC address <cr>
esr# monitor gigabitethernet 1/0/1 protocol ? 0-255 Filter by IP protocol number RDP Filter by RDP protocol ah Filter by AH protocol arp Filter by ARP protocol eigrp Filter by EIGRP protocol esp Filter by ESP protocol gre Filter by GRE protocol icmp Filter by ICMP protocol icmp6 Filter by ICMP6 protocol igmp Filter by IGMP protocol igrp Filter by IGRP protocol ipip Filter by IPIP protocol l2tp Filter by L2TP protocol ospf Filter by OSPF protocol pim Filter by PIM protocol rdp Filter by RDP protocol tcp Filter by TCP protocol udp Filter by UDP protocol vrrp Filter by VRRP protocol
Пример использования нескольких фильтров одновременно:
esr# monitor gigabitethernet 1/0/1 destination-address 192.0.2.1 source-address 198.51.100.1 detailed
Для того чтобы записать логи в файл есть возможность указать расположение необходимого файла с любым расширением – .pcap, .pcapng, .txt и др.:
esr# monitor gi 1/0/1 file
DESTINATION Select destination:
flash:data/FILE
usb://usb_name:/FILE
mmc://mmc_name:/FILE
Для записи дампов в файл в память ESR (раздел flash:data) дефолтное значение: 1000 пакетов. Для того чтобы изменить количество, необходимо указать параметр packets:
esr# monitor gigabitethernet 1/0/1 packets 1-2147483647 Count packets
После того как указать куда записывать данные, команда будет показывать в реальном времени сколько передано в файл:
esr# monitor gi 1/0/1 file flash:data/dump.pcap Got 15
Далее можно скопировать полученный файл на необходимый сервер:
esr# copy flash:data://dump.pcap tftp://<ip-address>:<port>:/copied_dump.pcap