2013-10-30 12:03 PM
Ethanalyzer は、Wireshark (旧称 Ethereal)オープン ソース コードをベースとした Cisco NX-OS プロトコル アナライザ ツールです。 パケットのキャプチャとデコード用の Wireshark のコマンド ライン バージョンで、ネットワークのトラブルシューティングおよびコントロール プレーン トラフィックを分析する場合に使用します。このドキュメントは Ethanalyzer の設定に関するもので、 Ethanalyzer の実施例および ACLs の "log" オプションを使用して、データ プレーン トラフィックをスニファする方法を示します。
Ethanalyzer の設定コマンドを次の表に示します。
コマンド | 目的 |
ethanalyzer local interface | スーパーバイザによって送受信されたパケットをキャプチャし、詳細なプロトコル情報を提供します。 |
ethanalyzer local interface inband | スーパーバイザによって送受信されたパケットをキャプチャし、インバンドおよびアウトバンドの詳細なプロトコル情報を提供します。 |
ethanalyzer local interface mgmt | スーパーバイザによって送受信されたパケットをキャプチャし、管理インターフェイスの詳細なプロトコル情報を提供します。 |
ethanalyzer local interface {inband | mgmt} brief | スーパーバイザによって送受信されたパケットをキャプチャし、要約されたプロトコル情報を提供します。 |
ethanalyzer local interface {inband | mgmt} limit-captured-frames | キャプチャするフレームの数を制限します。 |
ethanalyzer local interface {inband | mgmt} limit-frame-size | キャプチャするフレームの長さを制限します。 |
ethanalyzer local interface {inband | mgmt} capture-filter | キャプチャするパケットのタイプをフィルタします。 |
ethanalyzer local interface {inband | mgmt} display-filter | 表示するキャプチャ済みパケットのタイプをフィルタします。 |
ethanalyzer local interface {inband | mgmt} decode-internal | Cisco NX-OS の内部フレーム ヘッダーをデコードします。 (注) このオプションは、 Ethanalyzer の代わりに Wireshark を使用してデータを分析する場合には使用しないでください。 |
ethanalyzer local interface {inband | mgmt} write | キャプチャしたデータをファイルに保存します。 |
ethanalyzer local read | キャプチャしたデータファイルを開き、分析します。 |
Ethanalyzer は、Cisco NX-OS がハードウェアで転送するデータ トラフィックはキャプチャしませんが、回避策として ACLs の log オプションを使用する方法があります(下記の " ACLs および Ethanalyzer によるデータ プレーンのサンプリング" を参照してください)。
Ethanalyzer は、 tcpdump のフィルタ構文および Wireshark ディスプレイ フィルタ構文と同じ構文を使用します。
Wireshark weekly tips には、このツールを使用する上で役立つヒントがあります。
フィルタは2つのタイプをサポートしています。
1. capture-filter: tcpdump 標準フィルタ構文
tcp/udp port <>, src/dst portrange <>, src/dst port <>, src/dst host <>, src/dst net <>, less/greater <>, vlan etc …
2. display-filter: Wireshark 標準ディスプレイ フィルタ構文
ip.src==x.x.x.x, frame.len > x, http.request.uri == http://www.wireshark.org/
キャプチャされたパケットデータは、簡易デバッグ用として、別の場所に保存できます:
Nexus7000# ethanalyzer local read ?
bootflash:, logflash:, slot0:, usb1:, usb2:, volatile:
1. Ethanalyzer の出力を bootflash: 上のファイルに書き込みます:
Nexus7000# ethanalyzer local interface inband write bootflash:sniff_capture
2. bootflash: にある Ethanalyzer 出力ファイルを読み込みます("パイプ" を使用することも可能です):
Nexus7000# ethanalyzer local read bootflash:sniff_capture
ファイル サイズは 10485 KB に設定されており、このサイズを超える場合は、フラッシュに十分な空き容量がある場合でも、パケットをドロップします。
Switch# ethanalyzer local interface inband capture-filter " ip proto 89" limit-captured-frames 0 write logflash:ospf.pcap
Capturing on inband
81342
2560 packets dropped
Ethanalyzer は CPU 上のトラフィックのみをキャプチャするため、データ プレーン トラフィック分析としては一見、不適切なように思われます。しかし、 ACL のロギングを使用することによって、データ プレーンから特定のパケットをサンプリングすることができます。
Nexus 7000 の ACLs 機能:
ACLs のアクセス コントロール エントリ(ACEs)に "log" キーワードが指定されている場合、マッチングしたパケットのコピーがスーパバイザの CPU にパントされます。 重要な点は、オリジナルのトラフィックはハードウェアのパフォーマンスを低下させることなく、転送またはドロップされるということです。パントされたコピーは hardware rate-limiter によりレートが制限されることに注意してください。フォワーディング エンジンは、帯域内インターフェイスや CPU の飽和を避けるため、レートを制限します。
hardware rate-limit access-list-log コマンドで、レートを調整します(デフォルトで100 PPS)。
"log" キーワードは、 ACEs の許可や拒否の指定および syslog のパント パケットに使用できます。
n7010# 2008 Sep 15 19:21:00 n7010 %$ VDC-1 %$ %ACLLOG-6-ACLLOG_FLOW_INTERVAL: Source IP: 10.1.1.2, Destination IP: 10.1.2.2, Source Port: 1024, Destination Port: 40000, Source Interface: Ethernet1/1, protocol: "TCP"(6), Hit-count = 6224
1. 分析したいトラフィックと一致するようにロギングと ACL エントリを定義します。
ip access-list acl-cap
permit tcp 10.1.1.3/32 10.1.2.2/32 eq 5000 log
permit ip any any
2. インターフェイスに ACL をアタッチします。
interface e1/1
ip access-group acl-cap in
3. キャプチャおよびディスプレイ フィルタを定義し、対象トラフィックをキャプチャします。
ethanalyzer local interface inband capture-filter “tcp port 5000”
log キーワードが指定された ACEs と照合された全てのパケットはパントされます(レート制限付き)。 その中の一部のトラフィックを、キャプチャ/ディスプレイ フィルタを使用して表示します。
4. スイッチ上でのキャプチャされたトラフィックを表示します。 もしくは GUI での分析用に PC やワークステーションにコピーします。
例 - スイッチ上での簡易デコード
n7010# ethanalyzer local interface inband brief capture-filter "tcp port 5000" limit-cap 3
Capturing on eth0
2008-09-16 18:36:08.315736 10.1.1.3 -> 10.1.2.2 TCP 5000 > 5000 [ACK] Seq=0 Ack=0 Win=4096 Len=454
2008-09-16 18:36:08.988747 10.1.1.3 -> 10.1.2.2 TCP [TCP Retransmission] 5000 > 5000 [ACK] Seq=0 Ack=0 Win=4096 Len=454
2008-09-16 18:36:09.873360 10.1.1.3 -> 10.1.2.2 TCP [TCP Retransmission] 5000 > 5000 [ACK] Seq=0 Ack=0 Win=4096 Len=454
3 packets captured
n7010#
例 - スイッチ上でのフル デコード
n7010# ethanalyzer local interface inband capture-filter "tcp port 5000" limit-captured-frames 1 | no-more
Capturing on eth0
Frame 1 (508 bytes on wire, 508 bytes captured)
Arrival Time: Sep 16, 2008 18:33:12.138957000
[Time delta from previous captured frame: 1221615192.138957000 seconds]
[Time delta from previous displayed frame: 1221615192.138957000 seconds]
[Time since reference or first frame: 1221615192.138957000 seconds]
Frame Number: 1
Frame Length: 508 bytes
Capture Length: 508 bytes
[Protocols in frame: eth:ip:tcp:data]
Ethernet II, Src: 00:1b:54:c2:40:41 (00:1b:54:c2:40:41), Dst: 00:10:94:00:00:02 (00:10:94:00:00:02)
<…>
Internet Protocol, Src: 10.1.1.3 (10.1.1.3), Dst: 10.1.2.2 (10.1.2.2)
Version: 4
Header length: 20 bytes
Differentiated Services Field: 0x00 (DSCP 0x00: Default; ECN: 0x00)
<…>
Source: 10.1.1.3 (10.1.1.3)
Destination: 10.1.2.2 (10.1.2.2)
Transmission Control Protocol, Src Port: 5000 (5000), Dst Port: 5000 (5000), Seq: 0, Ack: 0, Len: 454
Source port: 5000 (5000)
Destination port: 5000 (5000)
<…>
例 - ファイルへのデータ書き込み
n7010# ethanalyzer local interface inband capture-filter "tcp port 5000" limit-captured-frames 50 write bootflash:test.cap //Use “write” option to send captured frames to flash file instead of print onscreen.
Capturing on eth0
50
n7010# dir test.cap
26224 Sep 16 18:40:08 2008 test.cap
Usage for bootflash://sup-local
1138716672 bytes used
671182848 bytes free
1809899520 bytes total
n7010# copy bootflash: scp: //Copy cap file off-box to a PC/workstation to view the file contents in GUI version of wireshark.
Enter source filename: test.cap
Enter vrf (If no input, current vrf 'default' is considered): management
Enter hostname for the scp server: dove
Enter username: tstevens
Password: ***
test.cap 100% 26KB 25.6KB/s 00:00
n7010#
1. 管理インターフェイス上でキャプチャしたデータ(4つのパケットのみ)を次に示します。
switch(config)# ethanalyzer local interface mgmt brief limit-captured-frames 4
Capturing on eth1
2008-02-18 13:21:21.841182 172.28.230.2 -> 224.0.0.2 HSRP Hello (state Standy)
2008-02-18 13:21:21.842190 10.86.249.17 -> 172.28.231.193 TCP 4261 > telnet [AC] Seq=0 Ack=0 Win=64475 Len=0
2008-02-18 13:21:21.843039 172.28.231.193 -> 10.86.249.17 TELNET Telnet Data ..
2008-02-18 13:21:21.850463 00:13:5f:1c:ee:80 -> ab:00:00:02:00:00 0x6002 DEC DN
Remote Console
4 packets captured
2. HSRP パケットの詳細をキャプチャしたデータを次に示します。
switch(config)# ethanalyzer local interface mgmt capture-filter "udp port 1985"
limit-captured-frames 1
Capturing on eth1
Frame 1 (62 bytes on wire, 62 bytes captured)
Arrival Time: Feb 18, 2008 13:29:19.961280000
[Time delta from previous captured frame: 1203341359.961280000 seconds]
[Time delta from previous displayed frame: 1203341359.961280000 seconds]
[Time since reference or first frame: 1203341359.961280000 seconds]
Frame Number: 1
Frame Length: 62 bytes
Capture Length: 62 bytes
[Frame is marked: False]
[Protocols in frame: eth:ip:udp:hsrp]
Ethernet II, Src: 00:00:0c:07:ac:01 (00:00:0c:07:ac:01), Dst: 01:00:5e:00:00:02
(01:00:5e:00:00:02)
Destination: 01:00:5e:00:00:02 (01:00:5e:00:00:02)
Address: 01:00:5e:00:00:02 (01:00:5e:00:00:02)
.... ...1 .... .... .... .... = IG bit: Group address (multicast/broadcast)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
Source: 00:00:0c:07:ac:01 (00:00:0c:07:ac:01)
Address: 00:00:0c:07:ac:01 (00:00:0c:07:ac:01)
.... ...0 .... .... .... .... = IG bit: Individual address (unicast)
.... ..0. .... .... .... .... = LG bit: Globally unique address (factory default)
Type: IP (0x0800)
Internet Protocol, Src: 172.28.230.3 (172.28.230.3), Dst: 224.0.0.2 (224.0.0.2)
Version: 4
Header length: 20 bytes
Differentiated Services Field: 0xc0 (DSCP 0x30: Class Selector 6; ECN: 0x00)
1100 00.. = Differentiated Services Codepoint: Class Selector 6 (0x30)
.... ..0. = ECN-Capable Transport (ECT): 0
.... ...0 = ECN-CE: 0
Total Length: 48
Identification: 0x0000 (0)
Flags: 0x00
0... = Reserved bit: Not set
.0.. = Don't fragment: Not set
..0. = More fragments: Not set
Fragment offset: 0
Time to live: 1
Protocol: UDP (0x11)
Header checksum: 0x46db [correct]
[Good: True]
[Bad : False]
Source: 172.28.230.3 (172.28.230.3)
Destination: 224.0.0.2 (224.0.0.2)
User Datagram Protocol, Src Port: 1985 (1985), Dst Port: 1985 (1985)
Source port: 1985 (1985)
Destination port: 1985 (1985)
Length: 28
Checksum: 0x8ab9 [correct]
[Good Checksum: True]
[Bad Checksum: False]
Cisco Hot Standby Router Protocol
Version: 0
Op Code: Hello (0)
State: Active (16)
Hellotime: Default (3)
Holdtime: Default (10)
Priority: 105
Group: 1
Reserved: 0Authentication Data: Default (cisco)
Virtual IP Address: 172.28.230.1 (172.28.230.1)
1 packets captured
3. アクティブな HSRP パケットを表示するディスプレイ フィルタの使用例を次に示します。
switch(config)# ethanalyzer local interface mgmt brief display-filter "hsrp.state==Active" limit-captured-frames 2
Capturing on eth1
2008-02-18 14:35:41.443118 172.28.230.3 -> 224.0.0.2 HSRP Hello (state Active)
2008-02-18 14:35:44.326892 172.28.230.3 -> 224.0.0.2 HSRP Hello (state Active)
2 packets captured
4. その他のフィルタ例を次に示します。
ethanalyzer local interface mgmt capture-filter “dst host 172.16.185.1”
ethanalyzer local interface inband capture-filter “stp”
ethanalyzer local interface inband decode-internal capture-filter “stp”
ethanalyzer local interface inband capture-filter “stp” limit-frame-size 64
ethanalyzer local interface inband capture-filter “icmp and host 10.10.10.1” limit-captured-frames 1000 write bootflash:icmp
検索バーにキーワード、フレーズ、または質問を入力し、お探しのものを見つけましょう
シスコ コミュニティをいち早く使いこなしていただけるよう役立つリンクをまとめました。みなさんのジャーニーがより良いものとなるようお手伝いします