ファイル内のトラフィック サンプリング出力の収集
トラフィックサンプリングの結果は、/var/tmpディレクトリ内のファイルに設定します。サンプリングされたパケットをファイルに収集するには、[edit forwarding-options sampling output]階層レベルでfileステートメントを含めます。
[edit forwarding-options sampling family family-name output] file <disable> filename filename <files number> <size bytes> <stamp | no-stamp > <world-readable | no-world-readable>;
アクティブ フローがエクスポートされるまでの期間を設定するには、[edit forwarding-options sampling output family (inet | inet6 | mpls)] 階層レベルで flow-active-timeout ステートメントを含めます。
[edit forwarding-options sampling family (inet | inet6 | mpls) output] flow-active-timeout seconds;
フローが非アクティブと見なされるまでの期間を設定するには、[edit forwarding-options sampling output]階層レベルで flow-inactive-timeout ステートメントを含めます。
[edit forwarding-options sampling family (inet | inet6 | mpls) output] flow-inactive-timeout seconds;
監視対象情報を送信するインターフェイスを設定するには、[edit forwarding-options sampling output]階層レベルでinterfaceステートメントを含めます。
[edit forwarding-options sampling family (inet | inet6 | mpls) output] interface interface-name { engine-id number; engine-type number; source-address address; }
この機能は、バージョン 9 のテンプレート形式ではサポートされていません。バージョン 9 を使用して収集されたトラフィック フローをサーバーに送信する必要があります。詳細については、『 Collecting Traffic Sampling Output in the Cisco Systems NetFlow Services Export Version 9 Format』を参照してください。
トラフィックサンプリング出力形式
トラフィック サンプリングの出力は、ASCII テキスト ファイルに保存されます。以下は、 /var/tmp ディレクトリ内のファイルに保存されるトラフィック サンプリング出力の例です。出力ファイルの各行には、サンプリングされた 1 つのパケットの情報が含まれています。オプションで、各行のタイムスタンプを表示することができます。
列ヘッダーは、1000 パケットの各グループの後に繰り返されます。
# Apr 7 15:48:50
Time Dest Src Dest Src Proto TOS Pkt Intf IP TCP
addr addr port port len num frag flags
Apr 7 15:48:54 192.168.9.194 192.168.9.195 0 0 1 0x0 84 8 0x0 0x0
Apr 7 15:48:55 192.168.9.194 192.168.9.195 0 0 1 0x0 84 8 0x0 0x0
Apr 7 15:48:56 192.168.9.194 192.168.9.195 0 0 1 0x0 84 8 0x0 0x0
Apr 7 15:48:57 192.168.9.194 192.168.9.195 0 0 1 0x0 84 8 0x0 0x0
Apr 7 15:48:58 192.168.9.194 192.168.9.195 0 0 1 0x0 84 8 0x0 0x0
出力には、次のフィールドが含まれます。
時間—パケットが受信された時間(設定に
stampステートメントが含まれている場合にのみ表示されます)宛先 addr—パケット内の宛先 IP アドレス
送信元 addr—パケット内の元 IP アドレス
宛先ポート—宛先アドレスの伝送制御プロトコル(TCP)またはユーザ データグラム プロトコル(UDP)ポート
送信元ポート—送信元アドレスのTCPまたはUDPポート
Proto:パケットのプロトコル タイプ
TOS—IPヘッダーのtype-of-service(ToS)フィールドの内容
Pkt len:サンプル化されたパケットの長さ(バイト単位)
Intf num—サンプリングされた論理インターフェイスを識別する一意の番号
[IP frag]:IP フラグメント番号(該当する場合)
TCPフラグ—IPヘッダーで見つかったTCPフラグ
ファイル my-sample のタイムスタンプ オプションを設定するには、次のように入力します。
[edit forwarding-options sampling family (inet | inet6 | mpls) output file] user@host# set filename my-sample files 5 size 2m world-readable stamp;
タイムスタンプオプションを切り替えるたびに、新しいヘッダーがファイルに含まれます。 スタンプ ・オプションを設定すると、「 時間 」フィールドが表示されます。
# Apr 7 15:48:50 # Time Dest Src Dest Src Proto TOS Pkt Intf IP TCP # addr addr port port len num frag flags # Feb 1 20:31:21 # Dest Src Dest Src Proto TOS Pkt Intf IP TCP # addr addr port port len num frag flags