例:静的環境でサービスのレートを制限するための階層型ポリサーの設定
この例では、階層型ポリサーを構成し、MX シリーズ ルーター上の論理インターフェイスでイングレス レイヤー 2 トラフィックにポリサーを適用する方法を示します。
必要条件
開始する前に、環境が次の要件を満たしていることを確認してください。
階層ポリサーを適用するインターフェイスは、MX シリーズ ルーターでホストされるインターフェイスです。
階層ポリサーを適用するインターフェイスの入力に他のポリサーは適用されません。
入力フィルターも適用されている論理インターフェイスに階層ポリサーを適用すると、ポリサーが最初に実行されることに注意してください。
概要
この例では、階層ポリサーを設定し、そのポリサーを論理インターフェイスでイングレスレイヤー2トラフィックに適用します。 表 1 に、論理インターフェイスと物理インターフェイスで階層型ポリサーを設定および適用できる階層レベルを示します。
ポリサーの設定 |
レイヤー 2 アプリケーション |
キーポイント |
---|---|---|
階層型ポリサー
すべてのプロトコルファミリーのレイヤー2イングレストラフィックを階層的にレート制限します。エグレストラフィック、レイヤー3トラフィック、またはインターフェイス階層の特定のプロトコルレベルには適用されません。MXシリーズルーターの高密度ポートコンセントレータ(DPC)上のインターフェイスでサポートされています。 |
||
階層型ポリサーの集約型およびプレミアムポリシングコンポーネント: [edit dynamic-profiles profile-name firewall] hierarchical-policer policer-name { aggregate { if-exceeding { bandwidth-limit bps; burst-size-limit bytes; } then { discard; forwarding-class class-name; loss-priority supported-value; } } premium { if-exceeding { bandwidth-limit bps; burst-size-limit bytes; } then { discard; } } } |
オプションA(物理インターフェイス)—物理インターフェイス上のレイヤー2入力トラフィックに直接適用します。 [edit dynamic-profiles profile-name interfaces] interface-name { layer2-policer { input-hierarchical-policer policer-name; } } |
物理インターフェイス上に設定されたすべてのプロトコルファミリーと論理インターフェイスのレイヤー2イングレストラフィックを階層的にレート制限します。
手記:
物理インターフェイスで階層ポリサーを適用する場合、メンバーの論理インターフェイスにも階層ポリサーを適用することはできません。 |
オプションB(論理インターフェイス)—論理インターフェイス上のレイヤー2入力トラフィックに直接適用します。 [edit dynamic-profiles profile-name interfaces] interface-name { unit unit-number { layer2-policer { input-hierarchical-policer policer-name; } } } |
特定の論理インターフェイス上に設定されたすべてのプロトコルファミリーのレイヤー2イングレストラフィックを階層的にレート制限します。
手記:
論理インターフェイスには、少なくとも 1 つのプロトコルファミリーを設定する必要があります。 |
IPv4 トラフィック用に設定したギガビット イーサネット論理インターフェイス ge-1/2/0.0 にポリサーを適用します。階層ポリサーを論理インターフェイスに適用すると、IPv4トラフィックは階層的にレート制限されます。物理インターフェイス ge-1/2/0 に階層ポリサーを適用することを選択した場合、階層ポリシングは論理インターフェイス全体の IPv4 トラフィックにも適用されます。
構成
次の例では、設定階層のいくつかのレベルに移動する必要があります。CLIのナビゲーションについては、「 1 コンフィグレーション・モードでのCLIエディタの使用」を参照してください。
この例を設定するには、以下のタスクを実行します。
- CLIクイック構成
- 加入者管理の基本的な動的プロファイルの設定
- インターフェイスの設定
- ファイアウォールフィルターの設定
- 転送クラスの設定
- 階層ポリサーの設定
- 物理または論理インターフェイスのレイヤー2イングレストラフィックへの階層ポリサーの適用
CLIクイック構成
この例をすばやく設定するには、次の設定コマンドをテキスト ファイルにコピーし、改行を削除してから、 [edit]
階層レベルの CLI にコマンドを貼り付けます。
set dynamic-profiles basic-profile set dynamic-profiles basic-profile interfaces “$junos-interface-ifd-name” set dynamic-profiles basic-profile interfaces "$junos-interface-ifd-name" unit “$junos-underlying-interface-unit” set dynamic-profiles basic-profile interfaces "$junos-interface-ifd-name" unit $junos-underlying-interface-unit family inet set dynamic-profiles interfaces ge-1/2/0 unit 0 family inet address 203.0.113.80/31 set dynamic-profiles basic-profile firewall family inet filter hierarch-filter set dynamic-profiles basic-profile firewall family inet filter hierarch-filter interface-specific set dynamic-profiles basic-profile firewall family inet filter hierarch-filter term match-ip1 set dynamic-profiles basic-profile firewall family inet filter hierarch-filter term match-ip2 set dynamic-profiles basic-profile firewall family inet filter hierarch-filter term match-ip1 from precedence critical-ecp protocol set dynamic-profiles basic-profile firewall family inet filter hierarch-filter term match-ip1 from protocol tcp set dynamic-profiles basic-profile firewall family inet filter hierarch-filter term match-ip1 then hierarchical-policer hp1-share filter-specific set dynamic-profiles basic-profile firewall family inet filter hierarch-filter term match-ip2 from precedence internet-control set dynamic-profiles basic-profile firewall family inet filter hierarch-filter term match-ip2 from protocol tcp set dynamic-profiles basic-profile firewall family inet filter hierarch-filter term match-ip2 then hierarchical-policer hp2-share set class-of-service forwarding-classes class fc0 queue-num 0 priority high policing-priority premium set class-of-service forwarding-classes class fc1 queue-num 1 priority low policing-priority normal set class-of-service forwarding-classes class fc2 queue-num 2 priority low policing-priority normal set class-of-service forwarding-classes class fc3 queue-num 3 priority low policing-priority normal set dynamic-profiles basic-profile firewall hierarchical-policer policer-agg-prem aggregate if-exceeding bandwidth-limit 10m burst-size-limit 100k set dynamic-profiles basic-profile firewall hierarchical-policer policer-agg-prem aggregate then forwarding-class fc1 set dynamic-profiles basic-profile firewall hierarchical-policer policer-agg-prem premium if-exceeding bandwidth-limit 2m burst-size-limit 50k set dynamic-profiles basic-profile firewall hierarchical-policer policer-agg-prem premium then discard set dynamic-profiles basic-profile interfaces ge-1/2/0 unit 0 layer2-policer input-hierarchical-policer policer-agg-prem
加入者管理の基本的な動的プロファイルの設定
手順
動的プロファイルとは、一種のテンプレートで定義された特性のセットで、ブロードバンドアプリケーション向けに動的な加入者アクセスとサービスを提供するために使用できます。これらのサービスは、インターフェイスに動的に割り当てられます。基本プロファイルにはプロファイル名が含まれ、[edit dynamic-profiles profile-name interfaces
階層レベルに含まれるインターフェイス変数名($junos-interface-ifd-nameなど)と、[edit dynamic-profiles profile-name interfaces variable-interface-name unit]
階層レベルに含まれる論理インターフェイス変数名($junos-underlying-interface-unitや$junos-interface-unitなど)の両方が含まれている必要があります。
新しい動的プロファイルを作成します。
[edit] user@host# set dynamic-profiles basic-profile
受信インターフェイスのインターフェイス名と一致するためにルーターが使用する内部$junos-interface-ifd-name変数で、
interface-name
変数ステートメントを定義します。[edit dynamic-profiles basic-profile] user@host# set interfaces “$junos-interface-ifd-name”
内部変数を持つ
variable-interface-name unit
ステートメントを定義します。既存のインターフェイスを参照する場合、受信インターフェイスのユニット値と一致するようにルーターが使用する $junos-underlying-interface-unit 変数を指定します。
動的インターフェイスを作成する場合、ルーターがインターフェイスのユニット値を生成するために使用する $junos-interface-unit 変数を指定します。
[edit dynamic-profiles basic-profile interfaces "$junos-interface-ifd-name"] user@host# set unit $junos-underlying-interface-unit
又は
[edit dynamic-profiles basic-profile interfaces "$junos-interface-ifd-name"] user@host# set unit $junos-interface-unit
$junos-interface-unit 変数のファミリーアドレスタイプ(IPv4 の場合は inet)を定義します。
[edit dynamic-profiles basic-profile interfaces "$junos-interface-ifd-name" unit $junos-underlying-interface-unit] user@host# set family inet
業績
show dynamic-profiles
コンフィギュレーション コマンドを入力して、動的プロファイルの設定を確認します。コマンドの出力結果に意図した設定内容が表示されない場合は、この手順の手順を繰り返して設定を修正します。
[edit] user@host# show dynamic-profiles dynamic-profiles { basic-profile { interfaces { "$junos-interface-ifd-name" { unit "$junos-underlying-interface-unit" { family inet; } } } } }
デバイスの設定が完了したら、設定モードから commit
を入力します。
インターフェイスの設定
手順
この階層ポリサーの例の物理インターフェイスと論理インターフェイスを定義します。
物理インターフェイスを設定します。
[edit dynamic-profiles basic-profile] user@host# set interfaces ge-1/2/0
IPv4(inet)プロトコルファミリーインターフェイスを持つユニット0として論理インターフェイスを設定します。
[edit dynamic-profiles basic-profile interfaces ge-1/2/0] user@host# set unit 0 family inet address 203.0.113.80/31
手記:この論理インターフェイスにレイヤー2ポリサーを適用する場合、少なくとも1つのプロトコルファミリーを設定する必要があります。
業績
show dynamic-profiles basic-profile interfaces
コンフィギュレーション コマンドを入力して、コンフィギュレーションを確認します。コマンドの出力結果に意図した設定内容が表示されない場合は、この手順の手順を繰り返して設定を修正します。
[edit] user@host# show dynamic-profiles basic-profile interfaces ge-1/2/0 { unit 0 { family inet { address 203.0.113.80/31; } } }
ファイアウォールフィルターの設定
手順
階層ポリサーをフィルターアクションとして設定するには、まずファイアウォールフィルタを設定する必要があります。
ファイアウォールフィルターのファミリーアドレスタイプ(IPv4の場合はinet)を設定し、フィルター名を指定します。
フィルターの目的を示す名前をフィルターに付けることをお勧めします。
[edit dynamic-profiles basic-profile] user@host# set firewall family inet filter hierarch-filter
カウンターとポリシング アクションの集約をオーバーライドし、各カウンターまたはポリシー機能を各インターフェイス アプリケーションに固有のものにするには、フィルターに
interface-specific
ステートメントを含めます。[edit dynamic-profiles basic-profile firewall family inet filter hierarch-filter] user@host# set interface-specific
フィルターの用語名を指定します。
各用語名を一意にし、その機能を表します。
[edit dynamic-profiles basic-profile firewall family inet filter hierarch-filter] user@host# set term match-ip1 user@host# set term match-ip2
各ファイアウォールフィルターの条件において、パケットのコンポーネントの照合に使用する条件を指定します。
最初の条件を、TCP経由で受信したIPv4パケットをIP優先度フィールドクリティカルecp(0xa0)プロトコルと照合するように設定し、階層ポリサーをフィルターアクションとして適用します。
[edit dynamic-profiles basic-profile firewall family inet filter hierarch-filter term match-ip1] user@host# set from precedence critical-ecp protocol user@host# set from protocol tcp
パケットが最初の条件のすべての条件に一致した場合に実行するアクションを指定します。1 つのフィルター内のすべての階層型ポリサーが、パケット転送エンジン内の同じポリサー インスタンスを共有できるようにします。
[edit dynamic-profiles basic-profile firewall family inet filter hierarch-filter term match-ip1] user@host# set then hierarchical-policer hp1-share filter-specific
2 番目の条件を設定して、TCP 経由で受信した IPv4 パケットを IP precedence フィールド internet-control(0xc0)と照合し、階層ポリサーをフィルターアクションとして適用します。
[edit dynamic-profiles basic-profile firewall family inet filter hierarch-filter term match-ip2] user@host# set from precedence internet-control user@host# set from protocol tcp
パケットが第 2 条件のすべての条件に一致した場合に実行するアクションを指定します。
[edit dynamic-profiles basic-profile firewall family inet filter inet-filter term match-ip2] user@host# set then hierarchical-policer hp2-share
業績
show dynamic-profiles basic-profile firewall
コンフィギュレーション コマンドを入力して、コンフィギュレーションを確認します。コマンドの出力結果に意図した設定内容が表示されない場合は、この手順の手順を繰り返して設定を修正します。
[edit] user@host# show dynamic-profiles basic-profile firewall family inet { filter hierarch-filter { interface-specific; term match-ip1 { from { precedence critical-ecp protocol; protocol tcp; } then hierarchical-policer hp1-share; } term match-ip2 { from { precedence internet-control; protocol tcp; } then hierarchical-policer hp2-share; } } }
転送クラスの設定
手順
集約ポリサーアクションとして参照される転送クラスを定義します。階層型ポリサーが機能するためには、イングレストラフィックがプレミアムバケットと非プレミアムバケットに正しく分類されている必要があります。階層型ポリサーは、プレミアム/優先転送(EF)トラフィックを非プレミアム/非EFトラフィックから分離する必要があるため、何らかのサービスクラス(CoS)の設定が必要です。
転送クラスの設定を有効にします。
[edit] user@host# set class-of-service forwarding-classes
CoS転送クラスを定義して、どの転送クラスがプレミアムであるかの指定を含めます。これは、EF トラフィックに関連付けられた転送クラスにデフォルト設定されます。
[edit class-of-service forwarding-classes] user@host# set class fc0 queue-num 0 priority high policing-priority premium user@host# set class fc1 queue-num 1 priority low policing-priority normal user@host# set class fc2 queue-num 2 priority low policing-priority normal user@host# set class fc3 queue-num 3 priority low policing-priority normal
業績
show class-of-service
設定コマンドを入力して、集約ポリサーアクションとして参照されている転送クラスの設定を確認します。コマンドの出力結果に意図した設定内容が表示されない場合は、この手順の手順を繰り返して設定を修正します。
[edit] user@host# show class-of-service forwarding-classes { class fc0 queue-num 0 priority high policing-priority premium; class fc1 queue-num 1 priority low policing-priority normal; class fc2 queue-num 2 priority low policing-priority normal; class fc3 queue-num 3 priority low policing-priority normal; }
階層ポリサーの設定
手順
階層型ポリサーの集約型およびプレミアム ポリシング コンポーネントを設定します。
階層ポリサーの設定を有効にします。
[edit dynamic-profiles basic-profile] user@host# set firewall hierarchical-policer policer-agg-prem
集約ポリサーは、帯域幅制限を 10 Mbps、バーストサイズ制限を 100 KB、不適合アクションを設定して転送クラスを fc1 に変更するように設定します。
[edit dynamic-profiles basic-profile firewall hierarchical-policer policer-agg-prem] user@host# set aggregate if-exceeding bandwidth-limit 10m burst-size-limit 100k user@host# set aggregate then forwarding-class fc1
手記:集約ポリサーの場合、不適合フローのパケットに対する設定可能なアクションは、パケットの廃棄、損失優先度の変更、または転送クラスの変更です。
プレミアム ポリサーは、帯域幅制限を 2 Mbps、バースト サイズ制限を 50 KB、不適合アクションをパケットを破棄するように設定するように設定します。
[edit dynamic-profiles basic-profile firewall hierarchical-policer policer-agg-prem] user@host# set premium if-exceeding bandwidth-limit 2m burst-size-limit 50k user@host# set premium then discard
手記:プレミアム ポリサーの帯域幅制限は、集約ポリサーの帯域幅制限より大きくすることはできません。プレミアム ポリサーの場合、不適合トラフィック フロー内のパケットに対する設定可能な唯一のアクションは、パケットの廃棄です。
業績
show dynamic-profiles basic-profile firewall
設定コマンドを入力して、階層ポリサーの設定を確認します。コマンドの出力結果に意図した設定内容が表示されない場合は、この手順の手順を繰り返して設定を修正します。
[edit] user@host# show dynamic-profiles basic-profile firewall hierarchical-policer policer-agg-prem { aggregate { if-exceeding { bandwidth-limit 10m; burst-size-limit 100k; } then { forwarding-class fc1; } } premium { if-exceeding { bandwidth-limit 2m; burst-size-limit 50k; } then { discard; } } }
物理または論理インターフェイスのレイヤー2イングレストラフィックへの階層ポリサーの適用
手順
ポリサーをインターフェイスに直接適用することも、フィルターを介して適用して、一致するトラフィックのみに影響を与えることもできます。ほとんどの場合、入力、出力、または双方向でポリシング機能を呼び出すことができます。
物理インターフェイスの場合、階層型ポリサーは単一のポリサー インスタンスを使用して、論理インターフェイスに inet やbridge などの相互に排他的なファミリがある場合でも、物理インターフェイス上で設定されたすべての論理インターフェイスとプロトコル ファミリーのレートを制限します。
論理インターフェイスの場合、階層型ポリサーは、論理インターフェイス上でそのようなファミリーごとにポリサーを個別にインスタンス化することなく、複数のプロトコルファミリーからのトラフィックをポリシングできます。
論理インターフェイス ge-1/2/0.0 上の IPv4 トラフィックのレイヤー 2 イングレストラフィックを階層的にレート制限するには、論理インターフェイス設定からポリサーを参照します。
論理インターフェイスを設定します。
[edit dynamic-profiles basic-profile] user@host# set interfaces ge-1/2/0 unit 0
論理インターフェイスでレイヤー2トラフィックにポリサーを適用する場合、論理インターフェイスに少なくとも1つのプロトコルファミリーを定義する必要があります。
ポリサーを論理インターフェイスに適用します。
[edit dynamic-profiles basic-profile interfaces ge-1/2/0 unit 0] user@host# set layer2-policer input-hierarchical-policer policer-agg-prem
または、すべてのプロトコルファミリーと、物理インターフェイスge-1/2/0に設定された すべての論理インターフェイス のレイヤー2イングレストラフィックを階層的にレート制限するには、物理インターフェイス設定からポリサーを参照します。
業績
show dynamic-profiles basic-profile interfaces
コンフィギュレーション コマンドを入力して、階層ポリサーの設定を確認します。コマンドの出力結果に意図した設定内容が表示されない場合は、この手順の手順を繰り返して設定を修正します。
[edit] user@host# show dynamic-profiles basic-profile interfaces ge-1/2/0 { unit 0 { layer2-policer { input-hierarchical-policer policer-agg-prem; } family inet { address 203.0.113.80/31; } } }
検証
設定が正常に機能していることを確認します。
インターフェイスのトラフィック統計情報の表示
目的
物理インターフェイスを通過するトラフィック フローを確認します。
アクション
物理インターフェイス ge-1/2/0 には show interfaces
運用モードコマンドを使用し、 detail
または extensive
オプションを含めます。
user@host> show interfaces ge-1/2/0 extensive Physical interface: ge-1/2/0, Enabled, Physical link is Down Interface index: 156, SNMP ifIndex: 630, Generation: 159 Link-level type: Ethernet, MTU: 1514, MRU: 1522, Speed: 1000mbps, BPDU Error: None, MAC-REWRITE Error: None, Loopback: Disabled, Source filtering: Disabled, Flow control: Enabled, Auto-negotiation: Enabled, Remote fault: Online Pad to minimum frame size: Disabled Device flags : Present Running Down Interface flags: Hardware-Down SNMP-Traps Internal: 0x4000 Link flags : None CoS queues : 8 supported, 8 maximum usable queues Schedulers : 0 Hold-times : Up 0 ms, Down 0 ms Current address: 00:00:5E:00:53:4c, Hardware address: 00:00:5E:00:53:4c Last flapped : 2014-11-10 13:36:25 EST (01:26:30 ago) Statistics last cleared: Never Traffic statistics: Input bytes : 0 0 bps Output bytes : 42 0 bps Input packets: 0 0 pps Output packets: 1 0 pps IPv6 transit statistics: Input bytes : 0 Output bytes : 0 Input packets: 0 Output packets: 0 Dropped traffic statistics due to STP State: Input bytes : 0 Output bytes : 0 Input packets: 0 Output packets: 0 Input errors: Errors: 0, Drops: 0, Framing errors: 0, Runts: 0, Policed discards: 0, L3 incompletes: 0, L2 channel errors: 0, L2 mismatch timeouts: 0, FIFO errors: 0, Resource errors: 0 Output errors: Carrier transitions: 0, Errors: 0, Drops: 0, Collisions: 0, Aged packets: 0, FIFO errors: 0, HS link CRC errors: 0, MTU errors: 0, Resource errors: 0 Egress queues: 8 supported, 8 in use Queue counters: Queued packets Transmitted packets Dropped packets 0 0 0 0 1 0 0 0 2 0 0 0 3 0 0 0 4 0 0 0 5 0 0 0 6 0 0 0 7 0 0 0 Queue number: Mapped forwarding classes 0 best-effort 1 expedited-forwarding 2 assured-forwarding 3 network-control 4 be1 5 ef1 6 af1 7 nc1 Active alarms : LINK Active defects : LINK MAC statistics: Receive Transmit Total octets 0 0 Total packets 0 0 Unicast packets 0 0 Broadcast packets 0 0 Multicast packets 0 0 CRC/Align errors 0 0 FIFO errors 0 0 MAC control frames 0 0 MAC pause frames 0 0 Oversized frames 0 Jabber frames 0 Fragment frames 0 VLAN tagged frames 0 Code violations 0 Total errors 0 0 Filter statistics: Input packet count 0 Input packet rejects 0 Input DA rejects 0 Input SA rejects 0 Output packet count 0 Output packet pad count 0 Output packet error count 0 CAM destination filters: 0, CAM source filters: 0 Autonegotiation information: Negotiation status: Incomplete Packet Forwarding Engine configuration: Destination slot: 0 (0x00) CoS information: Direction : Output CoS transmit queue Bandwidth Buffer Priority Limit % bps % usec 0 best-effort 95 950000000 95 0 low none 3 network-control 5 50000000 5 0 low none Interface transmit statistics: Disabled
意味
Traffic statisticsのコマンド出力セクションには、インターフェイス上で送受信されたバイト数とパケット数が一覧表示されます。
指定されたポリサーによってポリシングされたパケット数の表示
目的
ポリサーによって評価されたパケットの数を確認します。プレミアム ポリサー カウンターはサポートされていません。
アクション
show policer
動作モード コマンドを使用し、オプションでポリサー policer-agg-prem
の名前を指定します。コマンドの出力は、指定されたポリサーによって各方向に評価されたパケットの数を表示します。
user@host> show policer policer-agg-prem Policers: Name Bytes Packets policer-agg-prem-ge-1/2/0.0-inet-i 10372300 103723
-inet-i サフィックスは、IPv4 入力トラフィックに適用されるポリサーを示します。この例では、ポリサーは入力トラフィックにのみ適用されます。
意味
コマンドの出力は、指定されたポリサーによって各方向に評価されたパケットの数を表示します。