例:ルート フィルターのレイヤー 3 VPN プロトコル ファミリー修飾子の設定
この例では、BGPインポートポリシーのファミリー修飾子を設定することにより、BGPインポートポリシーの範囲を制御する方法を示しています。ファミリー修飾子は、タイプ inet、 inet6、 inet-vpn、または inet6-vpn のルートを指定します。
要件
この例では、Junos OS リリース 10.0 以降を使用しています。
始める前に:
デバイスインターフェイスを設定します。
内部ゲートウェイ プロトコルを設定します。Junos OSルーティングプロトコルライブラリをご覧ください。
複数のルートタイプに対してBGPセッションを設定します。例えば、ファミリー
inetルートとファミリーinet-vpnルートの両方にセッションを設定します。VPN での PE ルーター間の IBGP セッションの設定および IPv6 トラフィックを伝送するためのレイヤー 3 VPN の設定を参照してください。
概要
ファミリー修飾子により、ルート フィルターは特定の 1 つのファミリーのみに一致します。ここに示すように、ファミリー修飾子なしで IPv4 ルート フィルターを設定すると、ルート フィルターは inet ルートと inet-vpn ルートを照合します。
route-filter ipv4-address/mask;
同様に、ここに示すように、ファミリー修飾子なしで IPv6 ルート フィルターを設定すると、ルート フィルターは inet6 ルートと inet6-vpn ルートを照合します。
route-filter ipv6-address/mask;
BGPセッションがファミリー inet ルートとファミリー inet-vpn ルートの両方に対して設定され、このBGPセッションにインポートポリシーが設定されている場合を考えます。つまり、ファミリー inet ルートとファミリー inet-vpn ルートの両方が、受信時に同じインポート ポリシーを共有します。ポリシー条件は次のようになります。
from {
route-filter 0.0.0.0/0 exact;
}
then {
next-hop self;
accept;
}
このルート フィルター ロジックは、 inet ルートが 0.0.0.0 と、IPv4 アドレス部分が 0.0.0.0 の inet-vpn ルートを照合します。inet-vpnルートの8バイトのルート識別部分は、ルートフィルターマッチングでは考慮されません。これは、Junos OS リリース 10.0 で導入された Junos OS の動作の変更です。
ポリシーを両方のタイプのルートに一致させたくない場合は、ポリシーにファミリー修飾子を追加します。ルート フィルターが inet ルートのみを一致させるには、ファミリー inet ポリシー修飾子を追加します。ルート フィルターが inet-vpn ルートのみを一致させるには、ファミリー inet-vpn ポリシー修飾子を追加します。
ルート フィルタが評価される前に、ファミリー修飾子が評価されます。そのため、ファミリー マッチングが失敗した場合、ルート フィルターは評価されません。同じ論理が家族の inet6 と家族の inet6-vpnにも当てはまります。inet6例で使用するルート フィルターは、IPv6 アドレスを使用する必要があります。ファミリー修飾子は他のほとんどの修飾子よりも先にテストされ、望ましくないファミリーからのルートがすぐに排除されるため、ファミリー修飾子を使用すると効率が向上する可能性があります。
設定
手順
CLIクイック構成
この例をすばやく設定するには、次のコマンドをコピーしてテキストファイルに貼り付け、改行を削除して、ネットワーク構成に合わせて必要な詳細を変更し、[edit]階層レベルのCLIにコマンドをコピー&ペーストしてください。
inet の例
set policy-options policy-statement specific-family from family inet set policy-options policy-statement specific-family from route-filter 0.0.0.0/0 exact set policy-options policy-statement specific-family then next-hop self set policy-options policy-statement specific-family then accept set protocols bgp import specific-family
Inet-vpnの例
set policy-options policy-statement specific-family from family inet-vpn set policy-options policy-statement specific-family from route-filter 0.0.0.0/0 exact set policy-options policy-statement specific-family then next-hop self set policy-options policy-statement specific-family then accept set protocols bgp import specific-family
inet6 の例
set policy-options policy-statement specific-family from family inet6 set policy-options policy-statement specific-family from route-filter 0::0/0 exact set policy-options policy-statement specific-family then next-hop self set policy-options policy-statement specific-family then accept set protocols bgp import specific-family
Inet6-vpnの例
set policy-options policy-statement specific-family from family inet6-vpn set policy-options policy-statement specific-family from route-filter 0::0/0 exact set policy-options policy-statement specific-family then next-hop self set policy-options policy-statement specific-family then accept set protocols bgp import specific-family
ステップバイステップでの手順
次の例では、設定階層内のさまざまなレベルに移動する必要があります。CLI のナビゲーションについては、CLIユーザー・ガイド の コンフィギュレーション・モードでのCLIエディタの使用を参照してください。
フロー マップを設定するには:
ファミリー修飾子を設定します。
[edit policy-options] user@host# set policy-statement specific-family from family inet
ルート フィルターを構成します。
[edit policy-options] user@host# set policy-statement specific-family from route-filter 0.0.0.0/0 exact
ポリシーアクションを設定します。
[edit policy-options] user@host# set policy-statement specific-family then next-hop self user@host# set policy-statement specific-family then accept
ポリシーを適用します。
[edit protocols bgp] user@host# set import specific-family
結果
設定モードから、 show protocols and show policy-options コマンドを発行して設定を確認します。出力結果に意図した設定内容が表示されない場合は、この例の手順を繰り返して設定を修正します。
user@host# show protocols
bgp {
import specific-family;
}
user@host# show policy-options
policy-statement specific-family {
from {
family inet;
route-filter 0.0.0.0/0 exact;
}
then {
next-hop self;
accept;
}
}
デバイスの設定が完了したら、設定モードから commit を入力します。
特定のルート フィルター ポリシーが必要なすべてのプロトコル ファミリーについて、この手順を繰り返します。
検証
構成を確認するには、次のコマンドを実行します。
show route advertising-protocol bgp neighbor detailshow route instance instance-name detail