Często do rozwiązania problemu w sieci potrzebujemy zobaczyć ruch jaki przechodzi poprzez interfejs sieciowy urządzenia. Od Cisco IOS 12.4(20)T została udostępniona funkcjonalność Embedded Packet Capture umożliwiająca zapis ruchu do pliku w formacie .pcap przydatnym do dalszej analizy np. za pomocą Wireshark. Tak wygląda przykładowa konfiguracja
R1#conf t R1(config)#ip access-list ext PACKET_CAP_FILTER R1(config-ext-nacl)#permit ip any any R1(config-ext-nacl)#end
R1#monitor capture buffer PACKET_CAP size 512 max-size 512 circular R1#monitor capture buffer PACKET_CAP filter access-list PACKET_CAP_FILTER
R1#monitor capture point ip cef CAP_POINT Gi 0/0.1 both R1#monitor capture point associate CAP_POINT PACKET_CAP Filter Association succeeded
R1#monitor capture point start CAP_POINT
R1#show monitor capture buffer all parameters Capture buffer PACKET_CAP (circular buffer) Buffer Size : 524288 bytes, Max Element Size : 512 bytes, Packets : 645 Allow-nth-pak : 0, Duration : 0 (seconds), Max packets : 0, pps : 0 Associated Capture Points: Name : CAP_POINT, Status : Active Configuration: monitor capture buffer PACKET_CAP size 512 max-size 512 circular monitor capture point associate CAP_POINT PACKET_CAP monitor capture buffer PACKET_CAP filter access-list PACKET_CAP_FILTER R1#show monitor capture point all Status Information for Capture Point CAP_POINT IPv4 CEF Switch Path: IPv4 CEF , Capture Buffer: PACKET_CAP Status : Active Configuration: monitor capture point ip cef CAP_POINT GigabitEthernet0/0.1 both R1#show monitor capture buffer PACKET_CAP 13:21:56.487 CEDT Jul 21 2016 : IPv4 LES CEF : Gi0/1 Gi0/0.1 13:21:56.491 CEDT Jul 21 2016 : IPv4 LES CEF : Gi0/1 Gi0/0.1 13:21:56.491 CEDT Jul 21 2016 : IPv4 LES CEF : Gi0/0.1 None 13:21:56.491 CEDT Jul 21 2016 : IPv4 LES CEF : Gi0/0.1 None 13:21:56.491 CEDT Jul 21 2016 : IPv4 LES CEF : Gi0/1 Gi0/0.1 13:21:56.491 CEDT Jul 21 2016 : IPv4 LES CEF : Gi0/1 Gi0/0.1 13:21:56.491 CEDT Jul 21 2016 : IPv4 LES CEF : Gi0/0.1 None Buffer is active. Current element has been overwritten, bailing out
R1#monitor capture point stop CAP_POINT
R1#monitor capture buffer PACKET_CAP export scp://user:@192.168.0.111:/cap_buff.pcap Writing cap_buff.pcap Password: ! Sink: C0644 456745 cap_buff.pcap !
R1#no monitor capture point ip cef CAP_POINT Gi 0/0.1 both R1#no monitor capture buffer PACKET_CAP Capture Buffer deleted R1#conf t R1(config)#no ip access-list ext PACKET_CAP_FILTER R1(config)end R1#
A jak to wygląda na Linuxie przy użyciu np. tcpdump?
Znacznie prościej:
# tcpdump -i eth0 -w capture.pcap # scp capture.pcap user@192.168.0.111: