例:静的環境でのサービスレートを制限するための階層型ポリサーの設定
この例では、階層型ポリサーを設定し、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のナビゲーションについては、 設定モードでの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
interface-name変数ステートメントを、受信インターフェイスのインターフェイス名と一致させるために、ルーターで使用される内部$junos-interface-ifd-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
論理インターフェイスをユニット0として、そのIPv4(inet)プロトコルファミリーインターフェイスとして設定します。
[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優先度フィールドのcritical 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
TCP経由で受信したIPv4パケットをIP優先度フィールドinternet-control(0xc0)と一致させるように2番目の条件を設定し、階層ポリサーをフィルターアクションとして適用します。
[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
注:集約ポリサーの場合、不適合フロー内のパケットに対する設定可能なアクションは、パケットの破棄、損失優先度の変更、または転送クラスの変更です。
プレミアムポリサーを設定し、帯域幅制限を2Mbpsに、バーストサイズ制限を50KBに設定し、不適合アクションをパケットを破棄するように設定します。
[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入力トラフィックに適用されるポリサーを示します。この例では、ポリサーは入力トラフィックにのみ適用されています。
意味
コマンド出力には、各方向で指定されたポリサーによって評価されたパケット数が表示されます。