はじめに
C9800 の有線ポートパケットを EPC (Embeded Packet Capture)で取得する方法について紹介します。
※ 17.12.4 での動作例となります。
設定コマンド
※ 本記事で紹介する以下のコマンド例はあくまで一例のため、取得状況に合わせてヘルプコマンドを用いて適切に設定を行なってください。
1. #monitor capture <capture name> interface <interface> both << キャプチャするポートを選ぶ。パケットは in と out (C9800 ポートに入ってくる/出ていくパケット)両方取る。
2. #monitor capture <capture name> buffer size <1 - 100> circular << バッファサイズが 100 MB (1-100 入力可)までで越えた分は削除して最新までのものが取得される。
3. #monitor capture <capture name> match any << すべてのパケットを取る。
4. #show monitor capture <capture name> parameter << 設定したパラメータを見る。
5. #show monitor capture <capture name> << キャプチャの Status を見る。
6. #monitor capture <capture name> start << 取得開始。通常この後に事象を発生させる。
7. #monitor capture <capture name> stop << 取得停止。
8. #monitor capture <capture name> export location bootflash:<filename>.pcap << 取得したものを bootflash 上に pcap ファイルとしてエクスポートする。
9. copy bootflash:<filename>.pcap tftp: << tftp でコピーする。
動作例
1. test_capture という名前のキャプチャの設定を行う。
C9800#monitor capture test_capture interface GigabitEthernet 1 both
C9800#monitor capture test_capture buffer size 100 circular
C9800#monitor capture test_capture match any
2. test_capture の設定を確認する。
C9800#show monitor capture test_capture parameter
monitor capture test_capture interface GigabitEthernet1 BOTH
monitor capture test_capture match any
monitor capture test_capture buffer size 100 circular
3. test_capture の状態を確認する。
Status が Inactive となっているため、まだキャプチャが開始されていない状態である。
C9800#show monitor capture test_capture
Status Information for Capture test_capture
Target Type:
Interface: GigabitEthernet1, Direction: BOTH
Status : Inactive
Filter Details:
Capture all packets
Inner Filter Details:
Continuous capture: disabled
Buffer Details:
Buffer Type: CIRCULAR
Buffer Size (in MB): 100
Limit Details:
Number of Packets to capture: 0 (no limit)
Packet Capture duration: 0 (no limit)
Packet Size to capture: 0 (no limit)
Packet sampling rate: 0 (no sampling)
4. キャプチャを開始する。
キャプチャ開始後に test_capture の状態の確認すると、Status が Active となっていればキャプチャが開始されている。
C9800#monitor capture test_capture start
Started capture point : test_capture
C9800#show monitor capture test_capture
Status Information for Capture test_capture
Target Type:
Interface: GigabitEthernet1, Direction: BOTH
Status : Active
Filter Details:
Capture all packets
Inner Filter Details:
Continuous capture: disabled
Buffer Details:
Buffer Type: CIRCULAR
Buffer Size (in MB): 100
Limit Details:
Number of Packets to capture: 0 (no limit)
Packet Capture duration: 0 (no limit)
Packet Size to capture: 0 (no limit)
Maximum number of packets to capture per second: 1000
Packet sampling rate: 0 (no sampling)
5. 事象を確認後、取得を停止し、bootflash に pcap ファイルとしてエクスポートする。
C9800#monitor capture test_capture stop
Stopped capture point : test_capture
C9800#monitor capture test_capture export bootflash:test_capture.pcap
Exported Successfully
6. 最後に TFTP サーバなどを用意してコピーする。
C9800#copy bootflash:test_capture.pcap tftp
Address or name of remote host []? 172.32.32.1
Destination filename [test_capture.pcap]?
!!!!!!
1144713 bytes copied in 1.192 secs (960330 bytes/sec)
参考情報
https://www.cisco.com/c/en/us/td/docs/wireless/controller/9800/17-12/config-guide/b_wl_17_12_cg/m_embedded_packet_capture.html
関連資料
C9800 の有線ポートパケットを EPC (Embeded Packet Capture) で取得する方法(GUI 編)