PTXルーターでの選択的クラスベースフィルタリング
PTXルーターでの選択的クラスベースフィルタリング
サポートされているPTXシリーズルーターとラインカードでは、送信元または宛先の分類(ソースクラス使用率、SCU)と(宛先クラス使用率、DCU)に基づいて、IPv4およびIPv6トラフィックをフィルタリングできます。これは、クラス内のすべてのパケットではなく、クラス内のパケットのサブセットに選択的にフィルターを適用できるため便利です。さらに、パケット転送エンジン(PFE)を通るパケットフローが最適化され、フィルタリングがより効率的になります。
サービス プロバイダの場合、クラスベース フィルタリングにより、次のような高度なサービスを提供できます。
-
送信元または宛先パケットのクラスおよびその他のフィルター基準に基づいてパケットの転送クラスを調整することによる、ホップ単位の動作操作。
-
大量のトラフィックをドロップする特定の顧客インターフェイスに向けたトラフィック レート制限(DDoS攻撃下など)。通常は、発信インターフェイス フィルターを展開してトラフィックのレート制限を行います。しかし、分散システムではトラフィックがファブリックを通過し、消費するファブリックの帯域幅も限られているため、これは非効率的かもしれません。PTXのような仮想出力キューイングシステムでは、出力フィルタが実行される前にエグレス キューへのアドミッションが行われ、その後の出力フィルタでのドロップ アクションで補正が必要になります。キューに許可されるトラフィックを増やす必要があり、ファブリック帯域幅とエグレスのオンチップ バッファ領域(限られたリソース)が必要になります。クラスベースフィルターは、パケットがエグレスキューに入る前に、イングレスパイプラインで実行されます。特定の宛先に向けて大量のトラフィックをドロップすることが予想される場合、このメカニズムは通常の出力インターフェイスフィルターよりも推奨されます。
クラスベースのフィルタリングは、通常のトラフィックパターンを模倣してアプリケーションやサーバーのリソースを標的とする「低速および低速」DoS攻撃にも効果的です。
クラスベースのフィルタリングをサポートするために、PTXルーターの転送テーブルに2つの新しいバインドポイントが導入されました。source-class
と destination-class
があります。
CLI階層はここに表示され、 src-class-name または dest-class-name は、対応するポリシーで定義したフィルターの名前です。
routing-options forwarding-table source-class src-class-name family [inet | inet6] filter <filter-name>
routing-options forwarding-table destination-class dest-class-name family [inet | inet6] filter <filter-name>
また、複数のSCUおよびDCUクラスにわたってインスタンス固有のフィルタを設定することもできます。デフォルトでは、フィルターに対してインスタンス化されるカウンターとポリサーのセットは 1 つだけです。インスタンス固有のフィルターでは、フィルターのアタッチポイントごとに個別のカウンターとポリサーのセットが作成されます。
firewall family [inet | inet6] filter <filter name> instance-specific
PTXルーターでのクラスベースフィルタリングを理解する
当初、ソースクラス使用(SCU)機能が導入され、発信元プレフィックスごとに特定のインターフェイスに送信されたトラフィックの統計内訳を提供しました(ソースクラスによって識別されます)。宛先クラス使用率(DCU)はもともと、宛先プレフィックス(宛先クラスによって識別される)ごとにインターフェイスで受信したトラフィックの統計内訳を提供するために導入されました。
送信元または宛先の両方のクラスが、送信元または宛先のルックアップ プロセスでパケットに割り当てられます。したがって、送信元と送信先のフィルターの一致条件は、検索後にフィルターが実行された場合にのみ評価できます。
ジュニパーのルーターは、複数のフィルターバインドポイントをサポートしています。送信元と宛先の分類結果を利用できるものを、使用のガイドラインとともに、以下にリストします。
-
出力インターフェイス フィルター(set interfaces <interface name>ファミリーinetフィルター<c0/>。<output>すべてのPTXプラットフォームでサポートされていますが、定常状態で大量のトラフィックを破棄することが予想される場合(DDoS攻撃緩和フィルターを実装する場合など)は推奨されません。破棄されたDDoS攻撃トラフィックは、ファブリック帯域幅と限られたegressオンチップバッファスペースにより、DDoS攻撃基準に一致しない他のトラフィックによって補償されない場合があります。
-
転送テーブル フィルター ルックアップ後のフィルター(転送オプション ファミリー inet フィルター <filter-name> 出力を設定)。Express 2 (PE) および Express 3 (ZX) プラットフォームでサポートされています。ただし、フィルターはエグレスパイプラインでインスタンス化されるため、破棄動作は通常の出力インターフェイスフィルターと同様です。
-
ソースまたは宛先クラス固有のバインドポイント(ルーティングオプション転送テーブルソースクラスsrcクラス名ファミリ[inet | inet6]フィルタ<filter-name>を設定)。Express 2 (PE)、Express 3 (ZX)、Express 4 (BT) の各プラットフォームでサポートされています。このフィルターは、イングレス パイプラインでインスタンス化されます。これは、大量のトラフィックを破棄する場合に推奨されるオプションです。このオプションは、転送クラスをオーバーライドし、その後の出力キュー割り当てを行う必要がある場合にもお勧めします。仮想出力キューイング システムでは、キューはイングレス パイプラインで選択され、オーバーライドはイングレス パイプラインでも行う必要があります。
-
これらのフィルターアクションは、ソースまたは宛先クラス固有のバインドポイントにバインドされたフィルターではサポートされていません。
-
ルーティングインスタンス
-
ネクストIP
-
ネクストインターフェイス
-
カプセル化解除
-
カプセル 化
-
-
選択的クラスベース フィルターは、ホスト宛のパケットには適用できません。
-
uRPFルックアップに失敗するが、uRPFフェイルフィルターで復元されたパケットは、SCU/DCUルックアップの対象にはなりません。そのため、このようなパケットに選択的なクラスベース フィルターは適用できません。
-
フィルタは、SCU/DCU機能が有効になっているインターフェイスで受信するパケットにのみ適用されます。つまり、SCUが出力インターフェイスに設定されているかどうかに関係なく、フィルタが適用されます。
-
選択的なクラスベース フィルターを適用する必要があるパケットは、パフォーマンスの低下を引き起こす可能性があります。パフォーマンスの低下は、着信トラフィックのレート、平均パケット サイズ、およびフィルターの対象となるトラフィックの量によって決まります。ただし、選択的なクラスベース フィルターが適用されていないパケットは、パフォーマンスに影響しません。
-
DCUアカウンティングは、フィルターによってドロップされたパケットに適用されます。
-
SCU出力アカウンティングは、フィルターによってドロップされたパケットには適用されません。
-
選択的クラスベース フィルターは、インターフェイス固有のノブでのみ適用可能なため、インターフェイス固有のノブでは使用できません。
-
選択的クラスベースフィルタのリスト(入出力リスト)はサポートされていません。
-
論理システムはサポートされていません。
-
サポートされているペイロード プロトコルは、IPv4 と IPv6 のみです。MPLSはサポートされません。
-
パケットがSCUとDCUの両方の選択的クラスベースフィルタに一致する場合、最後のフィルタ(DCUフィルタ)のみがパケットに適用され、両方のフィルタには適用されません。
例:選択的クラスベースフィルタリング(PTXルーター)
この例では、送信元または宛先の分類に基づいて、IPv4およびIPv6トラフィックフローにファイアウォールアクション(破棄、拒否、またはポリシング)を適用する方法を示します。Junos Evolved OSリリース21.2を搭載したPTX10001-36MR、PTX10003-160C、PTX10003-80C、PTX10004、PTX10008ルーター、JUNOS Evolved OSリリース21.4を搭載したPTX10016ルーター、またはJunos OSリリース21.2以降のソフトウェアを搭載したPTX3000、PTX-5000、PTX1000、PTX10002、PTX10008、PTX10016ルーターに適用されます。
要件
この例ではBGPを使用していますが、それはBGPを使用して、カスタマーエッジ、プロバイダエッジ、プロバイダルーターで構成されるネットワークトポロジー内のデバイス間でルートを交換できるためです。詳しくは BGP設定の概要 を参照してください。
概要
この例では、3つのルーティングデバイスを使用しています。カスタマーエッジ(CE)デバイス、プロバイダエッジ(PE)デバイス、プロバイダコア(P)デバイス。IPv4トラフィックの設定が表示されており、2セットのSCUクラスとDCUクラス、およびファイアウォールフィルターが含まれています。次の図では、/32 IP プレフィックスは、それぞれカスタマーエッジ (CE) ルーターとプロバイダー (P) ルーターに接続されたホストを表しています。

この例では、2 つのトラフィック クラスを定義します。SCU-1 および SCU-2。最初のものはサブネット 172.16.2.0/24 のプレフィックスに割り当てられ、2 番目のものはサブネット 172.16.3.0/24 のプレフィックスに割り当てられます。その他のプレフィックスには、クラスの割り当てはありません。次の CLI スニペットに示すように、ルーティングポリシーが PE ルーターで定義され、ソースクラス scu-1 とソースクラス scu-2 にプレフィックスを割り当てます。
show policy-options policy-statement scu-class { term gold { from { route-filter 172.16.2.0/24 orlonger; } then source-class scu-1; accept; term silver { from { route-filter 172.16.3.0/24 orlonger; } then source-class scu-2; accept; }
CEからPEのインターフェイスに入るトラフィックを考慮するために、PEルーターで定義された dcu-class と呼ばれるポリシーは、ルートフィルターを使用してトラフィックを dcu-1に配置します。他のプレフィックスにはクラスの割り当てはありません。
show policy-options policy-statement dcu-class { term gold { from { route-filter 172.16.5.0/24 orlonger; } then destination-class dcu-1; accept; }
その後、ポリシーが転送テーブルに適用されます。
forwarding-table { export [ dcu_class scu_class ]; }
次のステップでは、PEルーターにフィルターを設定します。
show firewall { family inet { filter f1 { term t1 { from { protocol icmp; } then { count c1; } } } } }
そして、そのフィルターをPEルーター上の特定の送信元クラスと宛先クラスのバインドポイントにアタッチします。
show routing-options forwarding-table source-class scu-1 { family inet { filter { f1; } } } destination-class dcu-1 { family inet { filter { f1; } } }
設定
手順
CLIクイック構成
この例をすばやく設定するには、次のコマンドをコピーしてテキスト ファイルに貼り付け、改行を削除して、ネットワーク構成に合わせて必要な詳細を変更し、コマンドをコピーして CLI に貼り付けます。
この例では、スタティックルートを使用して、動作をテストするための接続とループバックインターフェイスアドレスを提供しています。
デバイスCE
set interfaces et-1/2/0 unit 0 family inet address 10.0.0.1/30 set interfaces lo0 unit 0 family inet address 192.168.0.1/32 set interfaces lo0 unit 0 family inet address 172.16.0.1/32 set protocols bgp group ext type external set protocols bgp group ext export send-direct set protocols bgp group ext export send-static set protocols bgp group ext peer-as 200 set protocols bgp group ext neighbor 10.0.0.2 set policy-options policy-statement send-direct term 1 from protocol direct set policy-options policy-statement send-direct term 1 then accept set policy-options policy-statement send-static term 1 from protocol static set policy-options policy-statement send-static term 1 then accept set routing-options static route 10.1.0.0/30 next-hop 10.0.0.2 set routing-options autonomous-system 100
デバイスPE
set interfaces et-1/2/0 unit 0 family inet address 10.0.0.2/30 set interfaces et-1/2/1 unit 0 family inet accounting source-class-usage input set interfaces et-1/2/1 unit 0 family inet accounting destination-class-usage set interfaces et-1/2/1 unit 0 family inet address 10.1.0.1/30 set interfaces lo0 unit 0 family inet address 192.168.0.2/32 set protocols bgp group ext type external set protocols bgp group ext export send-direct set protocols bgp group ext neighbor 10.0.0.1 peer-as 100 set protocols bgp group ext neighbor 10.1.0.2 peer-as 300 set policy-options policy-statement dcu_class term gold from route-filter 172.16.5.0/24 orlonger set policy-options policy-statement dcu_class term gold then destination-class dcu-1 set policy-options policy-statement scu_class term gold from route-filter 172.16.2.0/24 orlonger set policy-options policy-statement scu_class term gold then source-class scu-1 set policy-options policy-statement scu_class term silver from route-filter 172.16.3.0/24 orlonger set policy-options policy-statement scu_class term silver then source-class scu-1 set policy-options policy-statement send-direct term 1 from protocol direct set policy-options policy-statement send-direct term 1 then accept set firewall family inet filter f1 term 0 from protocol icmp set firewall family inet filter f1 term 0 then count c1 set firewall family inet filter f1 term 0 then accept set routing-options autonomous-system 200 set routing-options forwarding-table export dcu_class set routing-options forwarding-table export scu_class
デバイスP
set interfaces et-1/2/1 unit 0 family inet address 10.1.0.2/30 set interfaces lo0 unit 0 family inet address 192.168.0.3/32 set interfaces lo0 unit 0 family inet address 172.16.0.3/32 set interfaces lo0 unit 0 family inet address 172.16.0.3/32 set interfaces lo0 unit 0 family inet address 172.16.0.3/32 set interfaces lo0 unit 0 family inet address 172.16.0.3/32 set interfaces lo0 unit 0 family inet address 172.16.0.3/32 set interfaces lo0 unit 0 family inet address 172.16.0.3/32 set protocols bgp group ext type external set protocols bgp group ext export send-direct set protocols bgp group ext export send-static set protocols bgp group ext peer-as 200 set protocols bgp group ext neighbor 10.1.0.1 set policy-options policy-statement send-direct term 1 from protocol direct set policy-options policy-statement send-direct term 1 then accept set policy-options policy-statement send-static term 1 from protocol static set policy-options policy-statement send-static term 1 then accept set routing-options static route 10.0.0.0/30 next-hop 10.1.0.1 set routing-options static route 172.16.2.0/24 discard set routing-options static route 172.16.3.0/24 discard set routing-options static route 172.16.4.0/24 discard set routing-options static route 172.16.5.0/24 discard set routing-options static route 172.16.6.0/24 discard set routing-options static route 172.16.7.0/24 discard set routing-options autonomous-system 300
ステップバイステップでの手順
転送クラスで送信元プレフィックスと宛先プレフィックスをグループ化するには:
-
PE ルーターでルーター インターフェイスを作成します。
[edit interfaces] set et-1/2/0 unit 0 family inet accounting source-class-usage output set et-1/2/0 unit 0 family inet address 10.0.0.2/30 set et-1/2/1 unit 0 family inet accounting source-class-usage input set et-1/2/1 unit 0 family inet accounting destination-class-usage set et-1/2/1 unit 0 family inet address 10.1.0.1/30 set lo0 unit 0 family inet address 192.168.0.2/32
-
PE ルーターで BGP を設定します。
[edit] set protocols bgp group ext type external set protocols bgp group ext export send-direct set protocols bgp group ext neighbor 10.0.0.1 peer-as 100 set protocols bgp group ext neighbor 10.1.0.2 peer-as 300
-
PEルーターの自律システム(AS)番号を設定します。
[edit] set routing-options autonomous-system 200
-
PE ルーターで DCU ポリシーを設定します。
[edit] set policy-options policy-statement dcu_class term class-1 from route-filter 172.16.5.0/24 orlonger set policy-options policy-statement dcu_class term class-1 then destination-class dcu-1
-
PE ルーターで SCU ポリシーを設定します。
[edit] set policy-options policy-statement scu_class term class-1 from route-filter 172.16.2.0/24 orlonger set policy-options policy-statement scu_class term class-1 then source-class scu-1
-
PE ルーターの転送テーブルにポリシーを適用します。
[edit] set routing-options forwarding-table export dcu_class set routing-options forwarding-table export scu_class
-
PE ルーターでフィルターを作成します。
[edit] set firewall family inet filter f1 from protocol icmp then count c1
-
フィルターを PE ルーターの送信元クラスと宛先クラスのバインド ポイントにバインドします。
フィルターを宛先クラスの使用にバインドします。
[edit] set routing-options forwarding-table destination-class dcu-1 family inet filter f1
フィルターをソース クラスの使用にバインドします。
[edit] set routing-options forwarding-table source-class scu-1 family inet filter f1
-
(オプション)PE ルーター上で直接ルートを広告するルーティング ポリシーを設定します。
[edit] set policy-options policy-statement send-direct term 1 from protocol direct set policy-options policy-statement send-direct term 1 then accept
結果
設定モードから 、PE ルーターで show interfaces
、 show protocols
、 show policy-options
、および show routing-options
コマンドを発行して設定を確認します。出力結果に意図した設定内容が表示されない場合は、この例の手順を繰り返して設定を修正します。
show interfaces et-1/2/0 { unit 0 { family inet { address 10.0.0.2/30; } } } et-1/2/1 { unit 0 { family inet { accounting { source-class-usage { input; } } address 10.1.0.1/30; } } } lo0 { unit 0 { family inet { address 192.168.0.2/32; } } }
show interface statistics et-1/2/0 Physical interface: et-1/2/0:0, Enabled, Physical link is Up Interface index: 1087, SNMP ifIndex: 622 Link-level type: Ethernet, MTU: 1514, LAN-PHY mode, Speed: 10Gbps, BPDU Error: None, Loop Detect PDU Error: None, MAC-REWRITE Error: None, Loopback: Disabled, Source filtering: Disabled, Flow control: Enabled, Media type: Fiber Device flags : Present Running Interface flags: SNMP-Traps CoS queues : 8 supported, 8 maximum usable queues Current address: e4:5d:37:4e:e8:40, Hardware address: e4:5d:37:4e:e8:40 Last flapped : 2021-03-16 09:33:43 PDT (03:39:51 ago) Statistics last cleared: 2021-03-16 13:13:01 PDT (00:00:33 ago) Input rate : 0 bps (0 pps) Output rate : 0 bps (0 pps) Input errors: 0, Output errors: 0 Active alarms : None Active defects : None PCS statistics Seconds Bit errors 0 Errored blocks 0 PRBS Mode : Disabled Interface transmit statistics: Disabled Link Degrade : Link Monitoring : Disable Logical interface et-1/2/0:0.0 (Index 1047) (SNMP ifIndex 673) Flags: Up SNMP-Traps Encapsulation: ENET2 Input packets : 14 Output packets: 6 Protocol inet, MTU: 1500 Flags: Sendbcast-pkt-to-re, SCU-out Packets Bytes Source class (packet-per-second) (bits-per-second) scu-1 6 504 ( 0)( 0) Addresses, Flags: Is-Preferred Is-Primary Destination: 44.4.4/24, Local: 44.4.4.4, Broadcast: 44.4.4.255 Protocol inet6, MTU: 1500 Flags: None, SCU-out Packets Bytes Source class (packet-per-second) (bits-per-second) scu-1 0 0 ( 0) ( 0) Addresses, Flags: Is-Preferred Is-Primary Destination: 4001::/64, Local: 4001::4001 Addresses, Flags: Is-Preferred Destination: fe80::/64, Local: fe80::e65d:37ff:fe4e:e840 Protocol multiservice, MTU: Unlimited Flags: None
show firewall Filter: f1 Counters: Name Bytes Packets c1 0 0 Filter: v4_instance_new-scu-scu-1 Counters: Name Bytes Packets c_v4_instance_new-scu-scu-1 504 6 Filter: v6_instance_new-scu-scu-1 Counters: Name Bytes Packets c_v6_instance_new-scu-scu-1 0 0
show policy-options policy-statement dcu_class { term class-1 { from { route-filter 172.16.5.0/24 orlonger; } then destination-class dcu-1; } } policy-statement scu_class { term class-1 { from { route-filter 172.16.2.0/24 orlonger; } then source-class scu-1; } } policy-statement send-direct { term 1 { from protocol direct; then accept; } }
show routing-options autonomous-system 200; forwarding-table { export [ dcu_class scu_class ]; }
デバイスの設定が完了したら、設定モードからコミットを入力します。