例:ファイアウォールフィルターの統計情報収集の設定
この例では、関連するアカウンティングプロファイルで指定されたパラメータに従ってデータを収集するファイアウォールフィルターを設定および適用する方法を示しています。
要件
ファイアウォール フィルター アカウンティング プロファイルは、を除くすべてのトラフィック タイプ でサポートされています。family any
この例を設定する前に、デバイス初期化以外の特別な設定を行う必要はありません。
概要
この例では、ファイアウォールフィルター アカウンティング プロファイルを作成し、それをファイアウォール フィルターに適用します。アカウンティングプロファイルは、パケット数とバイト数の統計を収集する頻度と、統計が書き込まれるファイル名を指定します。また、このプロファイルは、3 つのファイアウォール フィルター カウンターの統計を収集することも指定します。
トポロジー
ファイアウォール フィルター アカウンティング プロファイル は、統計情報が 60 分ごとに収集され、その統計情報がファイル に書き込まれることを指定します。filter_acctg_profile
/var/log/ff_accounting_file
、 、 という名前のカウンターの統計が収集されます。counter1
counter2
counter3
という名前の IPv4 ファイアウォール フィルターは、3 つのフィルター条件のそれぞれについてカウンターをインクリメントします。my_firewall_filter
フィルターは、論理インターフェイス に適用されます。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
検証
フィルターが論理インターフェイスに適用されていることを確認するには、または 出力レベルでコマンドを実行します。show interfaces
detail
extensive
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