例:MS-MIC および MS-MPC を搭載した MXシリーズ ルーターでのフロー監視の設定
この例は、MS-MICとMS-MPCを搭載したMXシリーズルーター上のフロー監視用にJunos Traffic Visionを設定する方法を示し、以下のセクションで構成されています。
MS-MIC でのフロー監視の設定
CLIクイック構成
この例を素早く設定するには、以下のコマンドをコピーしてテキストファイルに貼り付け、改行を削除し、ネットワーク設定に合わせて必要な詳細を変更し、コマンドを[edit]階層レベルのCLIにコピー&ペーストしてください。
MS-MPC でフロー監視を設定する場合、同じ手順に従い、同じ設定を使用できます。
サービス インターフェイス カードの有効化
set interfaces ms-2/0/0 unit 0 family inet
テンプレートとタイマーの設定
set services flow-monitoring version9 template template1 set services flow-monitoring version9 template template1 flow-active-timeout 120 set services flow-monitoring version9 template template1 flow-inactive-timeout 60 set services flow-monitoring version9 template template1 ipv4-template set services flow-monitoring version9 template template1 template-refresh-rate packets 100 set services flow-monitoring version9 template template1 template-refresh-rate seconds 600 set services flow-monitoring version9 template template1 option-refresh-rate packets 100 set services flow-monitoring version9 template template1 option-refresh-rate seconds 600
サービス セット プロパティの設定
set services service-set ss1 jflow-rules sampling set services service-set ss1 sampling-service service-interface ms-2/0/0.0
転送オプションとフロー サーバー設定の構成
set forwarding-options sampling input rate 10 set forwarding-options sampling input run-length 18 set forwarding-options sampling family inet output flow-server 10.44.4.3 port 1055 set forwarding-options sampling family inet output flow-server 10.44.4.3 version9 template template1 set forwarding-options sampling family inet output interface ms-2/0/0.0 source-address 203.0.113.1
手順
次の例では、設定階層のいくつかのレベルに移動する必要があります。CLIのナビゲーションについては、CLIユーザー・ガイド の コンフィギュレーション・モードでのCLIエディタの使用を参照してください。
MSインターフェイスは、コレクターが到達可能なファミリータイプで設定する必要があります。サンプリング トラフィックのコレクタが IPv4 経由で到達可能な場合、たとえば IPv6 および MPLS トラフィックのみをサンプリングする場合でも、MS インターフェイスでファミリー inet を設定する必要があります。
サービスインターフェイスを設定します。
[edit interfaces] user@router1# set interfaces ms-2/0/0 unit 0 family inet user@router1# set interfaces ms-2/0/0 unit 1 family inet6 user@router1# set interfaces ms-2/0/0 unit 2 family mpls
テンプレートのプロパティとエクスポートポリシーのタイマーを設定します。
[edit services] user@router1# set flow-monitoring version9 template template1 user@router1# set flow-monitoring version9 template template1 flow-active-timeout 120 user@router1# set flow-monitoring version9 template template1 flow-inactive-timeout 60 user@router1# set flow-monitoring version9 template template1 ipv4-template user@router1# set flow-monitoring version9 template template1 template-refresh-rate packets 100 user@router1# set flow-monitoring version9 template template1 template-refresh-rate seconds 600 user@router1# set flow-monitoring version9 template template1 option-refresh-rate packets 100 user@router1# set flow-monitoring version9 template template1 option-refresh-rate seconds 600
表 1: この階層レベルでの主要な構成ステートメントのクイック リファレンス 設定ステートメント
形容
flow-active-timeoutアクティブなフローがエクスポートされるまでの間隔(秒単位)を設定します。
範囲は 10 〜 600 秒で、デフォルト値は 60 秒です。
flow-inactive-timeoutフローが非アクティブとマークされるまでの非アクティブの間隔(秒単位)を設定します。
範囲は 10 〜 600 秒で、デフォルト値は 60 秒です。
ipv4-template | ipv6-template | mpls-template | mpls-ipv4-template
テンプレートを使用するトラフィックのタイプを指定します。
template-refresh-rateテンプレートのリフレッシュレートを、パケット数(範囲は1〜480,000、デフォルト値は4800)、または秒単位(範囲は10〜600、デフォルトは600)で指定します。
フロー ジェネレータとフロー コレクター間の通信は一方向の通信であるため、フロー ジェネレータはテンプレート定義に関する更新をフロー コレクターに定期的に送信する必要があります。このステートメントに設定された値によって、このような更新の頻度が制御されます。
option-refresh-rateオプションのリフレッシュレートを、パケット数(範囲は1〜480,000、デフォルト値は4800)または秒単位(範囲は10〜600、デフォルトは60)で指定します。
サービスセットのプロパティを設定します。
[edit services] user@router1# set service-set ss1 jflow-rules sampling user@router1# set service-set ss1 sampling-service service-interface ms-2/0/0.0
表 2: この階層レベルの設定ステートメントのクイックリファレンス 設定ステートメント
形容
samplingサンプリング/フロー監視アクティビティを処理するようにサービス セットを設定します。
service-interfaceサービス・セットに関連付けられたサービス・インターフェースを指定します。
ここで設定するインターフェイスは、
[edit forwarding-options sampling family inet output]で設定されたインターフェイスと一致する必要があります。また、インターフェイスを他のサービス セットに関連付けないでください。転送オプションとフロー サーバーのプロパティを設定します。
[edit forwarding-options] user@router1# set sampling input rate 10 user@router1# set sampling input run-length 18 user@router1# set sampling family inet output flow-server 10.44.4.3 port 1055 user@router1# set sampling family inet output flow-server 10.44.4.3 version9 template template1 user@router1# set sampling family inet output interface ms-2/0/0.0 source-address 203.0.113.1
手記:サンプリング パラメータは、グローバル レベル(この例を参照)で指定することも、サンプリング インスタンスを定義することで FPC レベルで指定することもできます。サンプリングインスタンスを定義するには、
[edit forwarding-options sampling]階層にinstanceステートメントを、[edit chassis fpc number]階層レベルでsampling-instanceステートメントを記述し、サンプリングインスタンスとFPCを関連付けます。[edit forwarding-options sampling instance instance]階層レベルには、このステップで説明するinputとoutputの設定も含める必要があります。表 3: この階層レベルでの主要な構成ステートメントのクイック リファレンス 設定ステートメント
形容
rateサンプリングされるパケット数の比率。たとえば、レートを 10 に指定すると、10 番目のパケットごと(10 パケット中 1 パケット)がサンプリングされます。
範囲は 1 から 16000000(16M) です。
run-length最初のトリガー イベントに続くサンプルの数。これにより、すでにサンプリングされているパケットに続いてパケットをサンプリングできます。
範囲は 0 から 20 で、デフォルトは 0 です。
flow-serverバージョン 9 フォーマットを使用してサンプリングされたフローを収集するホスト システム。
source-addressエクスポートされたパケットの送信元アドレスとして使用される IPv4 アドレス。
結果
設定モードから、 show chassis fpc 2、 show interfaces、および show forwarding-options コマンドを入力して設定を確認します。出力結果に意図した設定内容が表示されない場合は、この例の手順を繰り返して設定を修正します。
user@router1# show interfaces
ms-2/0/0 {
unit 0 {
family inet;
}
}
user@router1# show services
flow-monitoring {
version9 {
template template1 {
flow-active-timeout 120;
flow-inactive-timeout 60;
template-refresh-rate {
packets 100;
seconds 600;
}
option-refresh-rate {
packets 100;
seconds 600;
}
ipv4-template;
}
}
}
service-set ss1 {
jflow-rules {
sampling;
}
sampling-service {
service-interface ms-2/0/0.0
}
}
user@router1# show forwarding-options
sampling {
input {
rate 10;
run-length 18;
}
family inet {
output {
flow-server 10.44.4.3 {
port 1055;
version9 {
template {
template1;
}
}
}
interface ms-2/0/0.0 {
source-address 203.0.113.1;
}
}
}
}
ハードウェア要件とソフトウェア要件
この例では、以下を備えたMXシリーズルーターが必要です。
Junos OS リリース 13.2 が実行されています。
インストールされているMS-MIC
MS-MIC および MS-MPC での Junos Traffic Vision のサポート
Junos Traffic Vision(旧称:Jflow)は、MS-MICおよびMS-MPCで利用可能なアカウンティングサービスです。Junos Traffic Vision を使用すると、MS-MIC または MS-MPC で受信したパケットを追跡し、パケットの送信元アドレス、パケットの宛先アドレス、パケットおよびバイト数などの情報を含むフロー レコードを生成できます。Junos Traffic Visionの実装では、トラフィックを中断させるのではなく、受信パケットのコピーを作成して、そのコピーをサービスインターフェイスカードに送信し、情報の分析と記録の維持を行います。
リリース13.2以降、Junos OS拡張プロバイダーパッケージは、マルチサービスMICおよびMPC(MS-MIC、MS-MPC)にプリインストールされています。[edit chassis fpc number pic number]階層レベルでのadaptive-services構成は、これらのカードで事前に構成されています。
MS-MICまたはMS-MPCでJunos Traffic Visionを設定する前に、 sample アクションとして設定されたファイアウォールフィルターを作成し、トラフィックを監視するインターフェイスに適用する必要があります。Junos Traffic Vision実装のフローコレクターは、フローレコードを収集するためのデバイスです。フローコレクターは通常、ネットワーク外に導入されます。
ファイアウォールフィルターの設定の詳細については、Junos OS ファイアウォールフィルター設定ガイドを参照してください。
MS-MIC および MS-MPC では、Junos OS は Junos Traffic Vision バージョン 9(v9)をサポートします。Junos Traffic Vision v9は、IPv4、IPv6、MPLSトラフィックのサンプリングをサポートしています。サービスインターフェイスカードはv9の実装に不可欠であるため、これはしばしばPICベースの監視として知られています。
フロー レコードがサービス インターフェイス カードに保存される最大時間を設定することができます。テンプレートの定義時に設定するアクティブ タイムアウトと非アクティブ タイムアウトの値は、コレクターへのフロー レコードのエクスポートを制御します。MS-MIC は最大 1,400 万件のフロー レコードを保存できますが、MS-MPC は NPU ごとに最大 3,000 万個のフローを保存できます。
Junos OS 拡張プロバイダー パッケージを使用した Junos Traffic Vision の設定では、フロー監視の開始後に以下のステートメントを変更すると、既存のすべてのフローの有効期限が切れます。
[edit forwarding-options sampling instance instance-name family (inet |inet6 |mpls) output]および[edit forwarding-options sampling family (inet |inet6 |mpls) output]階層レベルでは、次のようになります。flow-server ip-addressflow-server port port-numberflow-server template template
[edit services flow-monitoring version9 template template-name mpls-ipv4-template]および[edit services flow-monitoring version9 template template-name mpls-template]階層レベルでは、次のようになります。label-position
これらの変更を行うと進行中のフロー監視が中断される可能性があるため、デバイスでフロー監視が開始された後は、これらの値を変更しないことをお勧めします。フロー監視の進行中にこれらの設定ステートメントに加えられた変更は、新しく作成されたフローにのみ適用されます。
また、これらの変更によって、Junos OSレイヤー2サービスパッケージを使用してJflow設定を実行しているデバイスでのフロー監視が中断されることはありません。ただし、レイヤー 2 サービス パッケージベースの設定の場合でも、変更は新しく作成されたフローにのみ適用されます。既存のフローは、引き続き初期設定を使用します。
Junos Traffic Vision が MS-MIC および MS-MPC で設定されている場合、サンプリングされたフローの宛先が複数のパスで到達可能であると、IPv4 および IPv6 のフロー レコードにネクストホップ アドレスと発信インターフェイスが正しく表示されません。
検証
設定が正常に機能していることを確認します。
Junos Traffic Vision の設定を検証する
目的
ルーターで Junos Traffic Vision が有効になっていることを確認します。
アクション
動作モードから、 show services accounting status コマンドを入力します。
user@router1> show services accounting status Service Accounting interface: ms-2/0/0 Export format: 9, Route record count: 2093 IFL to SNMP index count: 35, AS count: 2 Configuration set: Yes, Route record set: Yes, IFL SNMP map set: Yes
意味
監視が設定されているサービス インターフェイスを示し、使用されているエクスポート形式(この場合はバージョン 9)に関する情報も提供します。
フローの詳細の表示
目的
フロー監視用に設定されたインターフェイスでフローの詳細を表示します。
アクション
動作モードから show services accounting flow コマンドを入力します。
user@router1> show services accounting flow
Flow information
Service Accounting interface: ms-2/0/0, Local interface index: 229
Flow packets: 220693, Flow bytes: 24276230
Flow packets 10-second rate: 99, Flow bytes 10-second rate: 10998
Active flows: 10, Total flows: 12
Flows exported: 199, Flows packets exported: 718
Flows inactive timed out: 2, Flows active timed out: 199
サービスインターフェイスで発生したエラーの詳細の表示
目的
フロー監視用に設定されたインターフェイス上のエラーがあれば、その詳細を表示します。
アクション
動作モードから、 show services accounting errors コマンドを入力します。
user@router1> show services accounting errors
Error information
Service Accounting interface: ms-2/0/0
Service sets dropped: 0, Active timeout failures: 0
Export packet failures: 0, Flow creation failures: 0
Memory overload: No