例:ファイアウォールフィルターの統計情報収集の設定
この例では、関連するアカウンティング プロファイルで指定されたパラメーターに従ってデータを収集するファイアウォール フィルターを構成および適用する方法を示します。
要件
ファイアウォール フィルター アカウンティング プロファイルは、 を除く family any
すべてのトラフィック タイプでサポートされています。
この例を設定する前に、デバイス初期化以外の特別な設定は必要ありません。
概要
この例では、ファイアウォールフィルターアカウンティングプロファイルを作成し、ファイアウォールフィルターに適用します。アカウンティング プロファイルは、パケット数とバイト数の統計情報を収集する頻度と、統計情報が書き込まれるファイル名を指定します。また、プロファイルは、3 つのファイアウォール フィルター カウンターに関する統計を収集することも指定します。
トポロジ
ファイアウォール フィルター アカウンティング プロファイル filter_acctg_profile
は、統計情報が 60 分ごとに収集され、統計情報がファイル /var/log/ff_accounting_file
に書き込まれることを指定します。、 、 counter3
という名前counter1
counter2
のカウンターの統計情報が収集されます。
という名前 my_firewall_filter
のIPv4ファイアウォールフィルターは、3つのフィルター条件ごとにカウンターをインクリメントします。フィルターは、論理インターフェイスに適用されます ge-0/0/1.0
。
設定
次の例では、設定階層内のさまざまなレベルに移動する必要があります。CLI のナビゲーションについては、 を参照してください 設定モードでのCLIエディターの使用。
この例を設定するには、以下のタスクを実行します。
- CLI クイックコンフィギュレーション
- アカウンティングプロファイルの設定
- アカウンティングプロファイルを参照するファイアウォールフィルターを設定する
- インターフェイスへのファイアウォールフィルターの適用
- 受験者の構成を確認する
- カウンターをクリアして受験者の設定をコミットする
CLI クイックコンフィギュレーション
この例を迅速に設定するには、以下の設定コマンドをテキスト ファイルにコピーし、改行を削除してから、 階層レベルの CLI にコマンドを [edit]
貼り付けます。
set accounting-options file ff_accounting_file files 10 set accounting-options file ff_accounting_file transfer-interval 10 set accounting-options filter-profile filter_acctg_profile file ff_accounting_file set accounting-options filter-profile filter_acctg_profile interval 60 set accounting-options filter-profile filter_acctg_profile counters counter1 set accounting-options filter-profile filter_acctg_profile counters counter2 set accounting-options filter-profile filter_acctg_profile counters counter3 set firewall family inet filter my_firewall_filter accounting-profile filter_acctg_profile set firewall family inet filter my_firewall_filter term term1 from protocol ospf set firewall family inet filter my_firewall_filter term term1 then count counter1 set firewall family inet filter my_firewall_filter term term1 then discard set firewall family inet filter my_firewall_filter term term2 from source-address 10.108.0.0/16 set firewall family inet filter my_firewall_filter term term2 then count counter2 set firewall family inet filter my_firewall_filter term term2 then discard set firewall family inet filter my_firewall_filter term accept-all then count counter3 set firewall family inet filter my_firewall_filter term accept-all then accept set interfaces ge-0/0/1 unit 0 family inet address 10.1.2.3/30 set interfaces ge-0/0/1 unit 0 family inet filter input my_firewall_filter
アカウンティングプロファイルの設定
手順
アカウンティングプロファイルを設定するには:
-
アカウンティング プロファイルに関連付けるログ ファイルを作成します。
[edit] user@host# edit accounting-options file ff_accounting_file files 10 edit accounting-options file ff_accounting_file transfer-interval 10
-
会計プロファイルを作成します
filter_acctg_profile
。[edit] user@host# edit accounting-options filter-profile filter_acctg_profile
アカウンティングプロファイルを設定して、パケット数とバイト数の統計情報を60分ごとにフィルタリングして収集し、ファイルに
/var/log/ff_accounting_file
書き込みます。[edit accounting-options filter-profile filter_acctg_profile] user@host# set file ff_accounting_file user@host# set interval 60
アカウンティングプロファイルを設定して、3つのカウンターのフィルタープロファイル統計(パケット数とバイト数)を収集します。
[edit accounting-options filter-profile filter_acctg_profile] user@host# set counters counter1 user@host# set counters counter2 user@host# set counters counter3
アカウンティングプロファイルを参照するファイアウォールフィルターを設定する
手順
アカウンティングプロファイルを参照するファイアウォールフィルターを設定するには:
ファイアウォール フィルターを作成します
my_firewall_filter
。[edit] user@host# edit firewall family inet filter my_firewall_filter
フィルターアカウンティングプロファイル
filter_acctg_profile
をファイアウォールフィルターに適用します。[edit firewall family inet filter my_firewall_filter] user@host# set accounting-profile filter_acctg_profile
最初のフィルター条件とカウンターを設定します。
[edit firewall family inet filter my_firewall_filter] user@host# set term term1 from protocol ospf user@host# set term term1 then count counter1 user@host# set term term1 then discard
2番目のフィルター条件とカウンターを設定します。
[edit firewall family inet filter my_firewall_filter] user@host# set term term2 from source-address 10.108.0.0/16 user@host# set term term2 then count counter2 user@host# set term term2 then discard
3 番目のフィルター条件とカウンターを設定します。
[edit firewall family inet filter my_firewall_filter] user@host# set term accept-all then count counter3 user@host# set term accept-all then accept
インターフェイスへのファイアウォールフィルターの適用
手順
ファイアウォールフィルターを論理インターフェイスに適用するには、次の手順に従います。
ファイアウォールフィルターを適用する論理インターフェイスを設定します。
[edit] user@host# edit interfaces ge-0/0/1 unit 0 family inet
論理インターフェイスのインターフェイスアドレスを設定します。
[edit interfaces ge-0/0/1 unit 0 family inet] user@host# set address 10.1.2.3/30
論理インターフェイスにファイアウォールフィルターを適用します。
[edit interfaces ge-0/0/1 unit 0 family inet] user@host# set filter input my_firewall_filter
受験者の構成を確認する
手順
受験者の構成を確認するには、以下の手順に同意します。
-
設定モードコマンドを入力して、アカウンティングプロファイルの設定を
show accounting-options
確認します。コマンド出力に意図した設定が表示されない場合は、この例の手順を繰り返して設定を修正します。[edit] user@host# show accounting-options file ff_accounting_file { files 10; transfer-interval 10; } filter-profile filter_acctg_profile { file ff_accounting_file; interval 60; counters { counter1; counter2; counter3; } }
設定モードコマンドを入力して、ファイアウォールフィルターの設定を
show firewall
確認します。コマンド出力に意図した設定が表示されない場合は、この例の手順を繰り返して設定を修正します。[edit] user@host# show firewall family inet { filter my_firewall_filter { accounting-profile filter_acctg_profile; term term1 { from { protocol ospf; } then { count counter1; discard; } } term term2 { from { source-address { 10.108.0.0/16; } } then { count counter2; discard; } } term accept-all { then { count counter3; accept; } } } }
設定モードコマンドを入力して、インターフェイスの設定を
show interfaces
確認します。コマンド出力に意図した設定が表示されない場合は、この例の手順を繰り返して設定を修正します。[edit] user@host# show interfaces ge-0/0/1 { unit 0 { family inet { filter { input my_firewall_filter; } address 10.1.2.3/30; } } }
カウンターをクリアして受験者の設定をコミットする
手順
カウンターをクリアし、候補の設定をコミットするには:
運用コマンド モードから、 コマンドを
clear firewall all
使用して、すべてのファイアウォール フィルターの統計情報をクリアします。この例でインクリメントされたカウンターのみをクリアするには、ファイアウォールフィルターの名前を含めます。
[edit] user@host> clear firewall filter my_firewall_filter
受験者の設定をコミットします。
[edit] user@host# commit
検証
フィルターが論理インターフェイスに適用されていることを確認するには、 または extensive
出力レベルで コマンドをdetail
実行show interfaces
します。
3 つのカウンターが個別に収集されていることを確認するには、 コマンドを show firewall filter my_firewall_filter
実行します。
user@host> show firewall filter my_firewall_filter Filter: my_firewall_filter Counters: Name Bytes Packets counter1 0 0 counter2 0 0 counter3 0 0