例:VPNのBGPルートターゲットフィルタリングのエクスポートポリシーの設定
この例では、BGPルートターゲットフィルタリング(ルートターゲット制約、または RTCとも呼ばれます)にエクスポートルーティングポリシーを設定する方法を示します。
要件
この例では、以下のハードウェアとソフトウェアのコンポーネントを使用しています。
BGP ルート ターゲット フィルタリングをサポートする 4 台のジュニパーネットワークス デバイス。
プロキシBGPルートフィルタリング用に設定された1つ以上のデバイス上のJunos OSリリース12.2以降。この例では、ルートリフレクタにプロキシBGPルートフィルタリングを明示的に設定します。
BGP ルート ターゲット フィルタリングのエクスポート ポリシーを設定する前に、以下の概念に精通し、理解していることを確認してください。
概要
BGPルートターゲットフィルタリングでは、ネットワーク全体にルートターゲットメンバーシップ(RTメンバーシップ)アドバタイズメントを配信することで、ネットワークリソースの消費量を削減できます。BGPは、RTメンバーシップ情報を使用して、VPNルートをネットワークに必要なデバイスにのみ送信します。他のタイプの BGP 到達可能性と同様に、ルーティング ポリシーを適用して、ターゲット フィルタリング ルートをルーティングしてネットワークに影響を与えることができます。ルートターゲットフィルタリングが設定されている場合、ルートターゲットフィルタリングルートのフローを制限すると、このRTメンバーシップによって引き付けられる可能性のあるVPNルートも制限されます。このポリシーの設定には、以下が含まれます。
ルート ターゲット プレフィックスのリストを定義するフィルターを作成します。
BGPルート・ターゲット・フィルタリングに使用するルート・ターゲット・フィルターのサブセットを選択するポリシーの作成。
ルートターゲットプレフィックスのリストを定義するには:
階層レベルで ステートメントを
rtf-prefix-list[edit policy-options]設定して、ルートターゲットプレフィックスリストの名前と、使用する1つ以上のルートターゲットプレフィックスを指定します。この設定により、デバイスが使用する受信ルート ターゲット フィルタリング ルートを指定し、ネットワーク全体に配信できます。
ルーティングポリシーを設定し、ルートターゲットプレフィックスリストをそのポリシーに適用するには、以下のポリシーオプションを指定します。
-
family route-target—(オプション)ルートターゲットファミリーの一致条件は、一致するBGPルートターゲットフィルタリングルートを指定します。この基準は、 ステートメントでfrom定義します。この例では、 一致条件を使用してエクスポート・ポリシーを作成する方法をfamily route-target示しています。メモ:ジュニパーは、inet.3テーブルを使用して、設定時
family route-targetにネクストホップアドレスを解決します。 protocol route-target—(オプション)ルートターゲットプロトコルの一致条件は、受信ルートが一致する必要がある基準を定義します。この基準は、 ステートメントでfrom定義します。このステートメントは、主に、ポリシーをローカルで生成されたルート・ターゲット・フィルタリング・ルートに制限する場合に便利です。メモ:コマンドを
show route table bgp.rtarget.0使用してプロキシBGPルートターゲットフィルタリングルートを表示すると、受信ルートのBGPプロトコルと、ローカルルートターゲットフィルタリングルートのルートターゲットプロトコルルートが表示されます。rtf-prefix-list name- rtf-prefix-list ステートメントは、すでにポリシーに設定したルート ターゲット プレフィックスのリストを適用します。この基準は、 ステートメントでfrom定義します。
トポロジー図
図 1 は、この例で使用したトポロジーを示しています。
この例では、BGPルートターゲットフィルタリングは、ルートリフレクタ(デバイスRR1およびデバイスRR2)とプロバイダーエッジ(PE)デバイスPE2に設定されています。もう1つのPEであるデバイスPE1は、BGPルートターゲットフィルタリングをサポートしていません。プロキシBGPルートターゲットフィルタリングは、ルートリフレクタとデバイスPE1間のピアリングセッションでも設定され、デバイスPE1で処理されるVPNルート更新の数を最小限に抑えます。デバイスPE2には4つのVPN(vpn1、vpn2、vpn3、vpn4)が設定されており、デバイスPE1には2つのVPN(vpn1とvpn2)が設定されています。サンプルトポロジーでは、すべてのデバイスが自律システム(AS)203に参加し、OSPFは設定された内部ゲートウェイプロトコル(IGP)であり、LDPはVPNで使用されるシグナリングプロトコルです。この例では、VPNルーティングおよび転送(VRF)インスタンスで静的ルートを使用してVPNルートを生成します。これは、OSPFやBGPなどのPEからカスタマーエッジ(CE)プロトコルを使用する代わりに行われます。
この例では、vpn3ルートがデバイスRR1にアドバタイズされるのを防ぐために、デバイスPE2上でエクスポートポリシーを設定することで、デバイスPE2からデバイスPE1にアドバタイズされるルートをさらに制御します。一致条件を指定するポリシーを family route-target 作成し、ルートターゲットプレフィックスのリストを定義し、基準を定義することでルートターゲットプレフィックスのリストを rtf-prefix-list 適用します。
構成
CLI クイックコンフィギュレーション
この例を迅速に設定するには、以下のコマンドをコピーしてテキスト ファイルに貼り付け、改行を削除し、ネットワーク設定に合わせて必要な詳細を変更してから、 階層レベルの CLI にコマンドを [edit] コピー アンド ペーストします。
デバイスPE1
set interfaces ge-1/0/0 unit 0 description PE1-to-RR1 set interfaces ge-1/0/0 unit 0 family inet address 10.49.0.1/30 set interfaces ge-1/0/0 unit 0 family mpls set interfaces ge-1/0/1 unit 0 description PE1-to-RR2 set interfaces ge-1/0/1 unit 0 family inet address 10.49.10.1/30 set interfaces ge-1/0/1 unit 0 family mpls set protocols ldp interface ge-1/0/0 set protocols ldp interface ge-1/0/1 set protocols bgp group internal type internal set protocols bgp group internal local-address 10.255.163.58 set protocols bgp group internal neighbor 10.255.165.220 family inet-vpn unicast set protocols bgp group internal neighbor 10.255.165.28 family inet-vpn unicast set protocols ospf area 0.0.0.0 interface ge-1/0/0 set protocols ospf area 0.0.0.0 interface ge-1/0/1 set protocols ospf area 0.0.0.0 interface lo0.0 passive set routing-options route-distinguisher-id 10.255.163.58 set routing-options autonomous-system 203 set routing-instances vpn1 instance-type vrf set routing-instances vpn1 vrf-target target:203:100 set routing-instances vpn1 routing-options static route 203.0.113.1/24 discard set routing-instances vpn2 instance-type vrf set routing-instances vpn2 vrf-target target:203:101 set routing-instances vpn2 routing-options static route 203.0.113.2/24 discard
デバイスRR1
set interfaces ge-1/0/0 unit 0 description RR1-to-PE1 set interfaces ge-1/0/0 unit 0 family inet address 10.49.0.2/30 set interfaces ge-1/0/0 unit 0 family mpls set interfaces ge-1/0/1 unit 0 description RR1-to-PE2 set interfaces ge-1/0/1 unit 0 family inet address 10.50.0.2/30 set interfaces ge-1/0/1 unit 0 family mpls set protocols ldp interface ge-1/0/0 set protocols ldp interface ge-1/0/1 set protocols bgp group internal type internal set protocols bgp group internal local-address 198.51.100.0 set protocols bgp group internal cluster 198.51.100.1 set protocols bgp group internal neighbor 10.255.163.58 description vpn1-to-pe1 family inet-vpn unicast set protocols bgp group internal neighbor 10.255.163.58 family route-target proxy-generate set protocols bgp group internal neighbor 10.255.168.42 description vpn1-to-pe2 family inet-vpn unicast set protocols ospf area 0.0.0.0 interface ge-1/0/0 set protocols ospf area 0.0.0.0 interface ge-1/0/1 set protocols ospf area 0.0.0.0 interface lo0.0 passive set routing-options route-distinguisher-id 10.255.165.220 set routing-options autonomous-system 203
デバイスRR2
set interfaces ge-1/0/0 unit 0 description RR2-to-PE1 set interfaces ge-1/0/0 unit 0 family inet address 10.49.10.2/30 set interfaces ge-1/0/0 unit 0 family mpls set interfaces ge-1/0/1 unit 0 description RR2-to-PE2 set interfaces ge-1/0/1 unit 0 family inet address 10.50.10.2/30 set interfaces ge-1/0/1 unit 0 family mpls set protocols ldp interface ge-1/0/0 set protocols ldp interface ge-1/0/1 set protocols bgp group internal type internal set protocols bgp group internal local-address 10.255.165.28 set protocols bgp group internal cluster 198.51.100.1 set protocols bgp group internal neighbor 10.255.163.58 description vpn2-to-pe1 family inet-vpn unicast set protocols bgp group internal neighbor 10.255.163.58 family route-target proxy-generate set protocols bgp group internal neighbor 10.255.168.42 description vpn2-to-pe2 family inet-vpn unicast set protocols bgp group internal neighbor 10.255.163.58 family route-target set protocols ospf area 0.0.0.0 interface ge-1/0/0 set protocols ospf area 0.0.0.0 interface ge-1/0/1 set protocols ospf area 0.0.0.0 interface lo0.0 passive set routing-options route-distinguisher-id 10.255.165.28 set routing-options autonomous-system 203
デバイスPE2
set interfaces ge-1/0/0 unit 0 description PE2-to-RR1 set interfaces ge-1/0/0 unit 0 family inet address 10.50.0.1/30 set interfaces ge-1/0/0 unit 0 family mpls set interfaces ge-1/0/1 unit 0 description PE2-to-RR2 set interfaces ge-1/0/1 unit 0 family inet address 10.50.10.2/30 set interfaces ge-1/0/1 unit 0 family mpls set protocols ldp interface ge-1/0/0 set protocols ldp interface ge-1/0/1 set protocols bgp group internal type internal set protocols bgp group internal local-address 10.255.168.42 set protocols bgp group internal family inet-vpn unicast set protocols bgp group internal family route-target set protocols bgp group internal neighbor 10.255.165.220 export filter-rtc set protocols bgp group internal neighbor 10.255.165.28 set protocols ospf area 0.0.0.0 interface ge-1/0/0 set protocols ospf area 0.0.0.0 interface ge-1/0/1 set protocols ospf area 0.0.0.0 interface lo0.0 passive set policy-options rtf-prefix-list exclude-103 203:203:103/96 set policy-options policy-statement filter-rtc from family route-target set policy-options policy-statement filter-rtc from rtf-prefix-list exclude-103 set policy-options policy-statement filter-rtc then reject set routing-options route-distinguisher-id 10.255.168.42 set routing-options autonomous-system 203 set routing-instances vpn1 instance-type vrf set routing-instances vpn1 vrf-target target:203:100 set routing-instances vpn1 routing-options static route 203.0.113.1/24 discard set routing-instances vpn2 instance-type vrf set routing-instances vpn2 vrf-target target:203:101 set routing-instances vpn2 routing-options static route 203.0.113.2/24 discard set routing-instances vpn3 instance-type vrf set routing-instances vpn3 vrf-target target:203:103 set routing-instances vpn3 routing-options static route 203.0.113.3/24 discard set routing-instances vpn4 instance-type vrf set routing-instances vpn4 vrf-target target:203:104 set routing-instances vpn4 routing-options static route 203.0.113.4/24 discard
デバイスPE1の設定
手順
次の例では、設定階層内のさまざまなレベルに移動する必要があります。CLIのナビゲーションについては、 設定モードでのCLIエディターの使用を参照してください。
デバイスPE1を設定するには:
インターフェイスを設定します。
[edit interfaces] user@PE1# set ge-1/0/0 unit 0 description PE1-to-RR1 user@PE1# set ge-1/0/0 unit 0 family inet address 10.49.0.1/30 user@PE1# set ge-1/0/0 unit 0 family mpls user@PE1#set ge-1/0/1 unit 0 description PE1-to-RR2 user@PE1#set ge-1/0/1 unit 0 family inet address 10.49.10.1/30 user@PE1# set ge-1/0/1 unit 0 family mpls
ルート識別とAS番号を設定します。
[edit routing-options] user@PE1# set route-distinguisher-id 10.255.163.58 user@PE1# set autonomous-system 203
VPN で使用されるシグナリング プロトコルとして LDP を設定します。
[edit protocols ldp] user@PE1# set interface ge-1/0/0 user@PE1# set interface ge-1/0/1
BGPを設定します。
[edit protocols bgp group internal] user@PE1# set type internal user@PE1# set local-address 10.255.163.58 user@PE1# set neighbor 10.255.165.220 family inet-vpn unicast user@PE1# set neighbor 10.255.165.28 family inet-vpn unicast
OSPFを設定します。
[edit protocols ospf area 0.0.0.0] user@PE1# set interface ge-1/0/0 user@PE1# set interface ge-1/0/1 user@PE1# set interface lo0.0 passive
VPN ルーティング インスタンスを設定します。
[edit routing-instances vpn1] user@PE1# set instance-type vrf user@PE1# set vrf-target target:203:100 user@PE1# set routing-options static route 203.0.113.1/24 discard
[edit routing-instances vpn2] user@PE1# set instance-type vrf user@PE1# set vrf-target target:203:101 user@PE1# set routing-options static route 203.0.113.2/24 discard
デバイスの設定が完了したら、設定をコミットします。
[edit] user@PE1# commit
結果
設定モードから、 、show routing-optionsshow protocolsおよび のコマンドをshow interfaces入力して設定をshow routing-instances確認します。出力結果に意図した設定が表示されない場合は、この例の手順を繰り返して設定を修正します。
user@PE1# show interfaces
ge-1/0/0 {
unit 0 {
description PE1-to-RR1;
family inet {
address 10.49.0.1/30;
}
family mpls;
}
}
ge-1/0/1 {
unit 0 {
description PE1-to-RR2;
family inet {
address 10.49.10.1/30;
}
family mpls;
}
}
user@PE1# show protocols
bgp {
group internal {
type internal;
local-address 10.255.163.58;
neighbor 10.255.165.220 {
family inet-vpn {
unicast;
}
}
neighbor 10.255.165.28 {
family inet-vpn {
unicast;
}
}
}
}
ospf {
area 0.0.0.0 {
interface ge-1/0/0.0;
interface ge-1/0/1.0;
interface lo0.0 {
passive;
}
}
}
ldp {
interface ge-1/0/0.0;
interface ge-1/0/1.0;
}
user@PE1# show routing-options route-distinguisher-id 10.255.14.182; autonomous-system 203;
user@PE1# show routing-instances
vpn1 {
instance-type vrf;
vrf-target target:203:100;
routing-options {
static {
route 203.0.113.1/24 discard;
}
}
}
vpn2 {
instance-type vrf;
vrf-target target:203:101;
routing-options {
static {
route 203.0.113.2/24 discard;
}
}
}
デバイスRR1の設定
手順
次の例では、設定階層内のさまざまなレベルに移動する必要があります。CLIのナビゲーションについては、 設定モードでのCLIエディターの使用を参照してください。
デバイスRR1を設定するには:
インターフェイスを設定します。
[edit interfaces] user@RR1# set ge-1/0/0 unit 0 description RR1-to-PE1 user@RR1# set ge-1/0/0 unit 0 family inet address 10.49.0.2/30 user@RR1# set ge-1/0/0 unit 0 family mpls user@RR1# set ge-1/0/1 unit 0 description RR1-to-PE2 user@RR1# set ge-1/0/1 unit 0 family inet address 10.50.0.2/30 user@RR1# set ge-1/0/1 unit 0 family mpls
ルート識別とAS番号を設定します。
[edit routing-options] user@RR1# set route-distinguisher-id 10.255.165.220 user@RR1# set autonomous-system 203
VPN で使用されるシグナリング プロトコルとして LDP を設定します。
[edit protocols ldp] user@RR1# set interface ge-1/0/0 user@RR1# set interface ge-1/0/1
BGPを設定します。
[edit protocols bgp group internal] user@RR1# set type internal user@RR1# set local-address 10.255.165.220 user@RR1# set cluster 198.51.100.1 user@RR1# set neighbor 10.255.163.58 description vpn1-to-pe1 family inet-vpn unicast user@RR1# set neighbor 10.255.168.42 description vpn1-to-pe2 family inet-vpn unicast
デバイスPE2とのピアリングセッションでBGPルートターゲットフィルタリングを設定します。
[edit protocols bgp group internal] user@RR1# set neighbor 10.255.168.42 family route-target
デバイスPE1とのピアリングセッションでプロキシBGPルートターゲットフィルタリングを設定します。
[edit protocols bgp group internal] user@RR1# set neighbor 10.255.163.58 family route-target proxy-generate
OSPFを設定します。
[edit protocols ospf area 0.0.0.0] user@RR1# set interface ge-1/0/0 user@RR1# set interface ge-1/0/1 user@RR1# set interface lo0.0 passive
デバイスの設定が完了したら、設定をコミットします。
[edit] user@RR1# commit
結果
設定モードから、 、 、 show protocolsコマンドを入力して設定をshow interfacesshow routing-options確認します。出力結果に意図した設定が表示されない場合は、この例の手順を繰り返して設定を修正します。
user@RR1# show interfaces
ge-1/0/0 {
unit 0 {
description RR1-to-PE1;
family inet {
address 10.49.0.2/30;
}
family mpls;
}
}
ge-1/0/1 {
unit 0 {
description RR1-to-PE2;
family inet {
address 10.50.0.2/30;
}
family mpls;
}
}
user@RR1# show protocols
bgp {
group internal {
type internal;
local-address 198.51.100.0;
cluster 198.51.100.1;
neighbor 10.255.163.58 {
description vpn1-to-pe1;
family inet-vpn {
unicast;
}
family route-target {
proxy-generate;
}
}
neighbor 10.255.168.42 {
description vpn1-to-pe2;
family inet-vpn {
unicast;
}
family route-target;
}
}
}
ospf {
area 0.0.0.0 {
interface ge-1/0/0.0;
interface ge-1/0/1.0;
interface lo0.0 {
passive;
}
}
}
ldp {
interface ge-1/0/0.0;
interface ge-1/0/1.0;
}
ospf {
area 0.0.0.0 {
interface ge-1/0/0.0;
interface ge-1/0/1.0;
interface lo0.0 {
passive;
}
}
}
ldp {
interface ge-1/0/0.0;
interface ge-1/0/1.0;
}
user@RR1# show routing-options route-distinguisher-id 10.255.165.220; autonomous-system 203;
デバイスRR2の設定
手順
次の例では、設定階層内のさまざまなレベルに移動する必要があります。CLIのナビゲーションについては、 設定モードでのCLIエディターの使用を参照してください。
デバイスRR2を設定するには:
インターフェイスを設定します。
[edit interfaces] user@RR2# set ge-1/0/0 unit 0 description RR2-to-PE1 user@RR2# set ge-1/0/0 unit 0 family inet address 10.49.10.2/30 user@RR2# set ge-1/0/0 unit 0 family mpls user@RR2# set ge-1/0/1 unit 0 description RR2-to-PE2 user@RR2# set ge-1/0/1 unit 0 family inet address 10.50.10.2/30 user@RR2# set ge-1/0/1 unit 0 family mpls
ルート識別とAS番号を設定します。
[edit routing-options] user@RR2# set route-distinguisher-id 10.255.165.28 user@RR2# set autonomous-system 203
VPN で使用されるシグナリング プロトコルとして LDP を設定します。
[edit protocols ldp] user@RR2# set interface ge-1/0/0 user@RR2# set interface ge-1/0/1
BGPを設定します。
[edit protocols bgp group internal] user@RR2# set type internal user@RR2# set local-address 10.255.165.28 user@RR2# set cluster 198.51.100.1 user@RR2# set neighbor 10.255.163.58 description vpn2-to-pe1 family inet-vpn unicast user@RR2# set neighbor 10.255.168.42 description vpn2-to-pe2 family inet-vpn unicast
デバイスPE2とのピアリングセッションでBGPルートターゲットフィルタリングを設定します。
[edit protocols bgp group internal] user@RR2# set neighbor 10.255.168.42 family route-target
デバイスPE1とのピアリングセッションでプロキシBGPルートターゲットフィルタリングを設定します。
[edit protocols bgp group internal] user@RR2# set neighbor 10.255.163.58 family route-target proxy-generate
OSPFを設定します。
[edit protocols ospf area 0.0.0.0] user@RR2# set interface ge-1/0/0 user@RR2# set interface ge-1/0/1 user@RR2# set interface lo0.0 passive
デバイスの設定が完了したら、設定をコミットします。
[edit] user@RR2# commit
結果
設定モードから、 、 、 show protocolsコマンドを入力して設定をshow interfacesshow routing-options確認します。出力結果に意図した設定が表示されない場合は、この例の手順を繰り返して設定を修正します。
user@RR2# show interfaces
ge-1/0/0 {
unit 0 {
description RR2-to-PE1;
family inet {
address 10.49.10.2/30;
}
family mpls;
}
}
ge-1/0/1 {
unit 0 {
description RR2-to-PE2;
family inet {
address 10.50.10.2/30;
}
family mpls;
}
}
user@RR2# show protocols
bgp {
group internal {
local-address 10.255.165.28;
cluster 198.51.100.1;
neighbor 10.255.163.58 {
description vpn2-to-pe1;
family inet-vpn {
unicast;
}
family route-target {
proxy-generate;
}
}
neighbor 10.255.168.42 {
description vpn2-to-pe2;
family inet-vpn {
unicast;
}
family route-target;
}
}
}
ospf {
area 0.0.0.0 {
interface ge-1/0/0.0;
interface ge-1/0/1.0;
interface lo0.0 {
passive;
}
}
}
ldp {
interface ge-1/0/0.0;
interface ge-1/0/1.0;
}
user@RR2# show routing-options route-distinguisher-id 10.255.165.28; autonomous-system 203;
デバイスPE2の設定
手順
次の例では、設定階層内のさまざまなレベルに移動する必要があります。CLIのナビゲーションについては、 設定モードでのCLIエディターの使用を参照してください。
デバイスPE2を設定するには:
インターフェイスを設定します。
[edit interfaces] user@PE2# set ge-1/0/0 unit 0 description PE2-to-RR1 user@PE2# set ge-1/0/0 unit 0 family inet address 10.50.0.1/30 user@PE2# set ge-1/0/0 unit 0 family mpls user@PE2#set ge-1/0/1 unit 0 description PE2-to-RR2 user@PE2#set ge-1/0/1 unit 0 family inet address 10.50.10.2/30 user@PE2# set ge-1/0/1 unit 0 family mpls
ルート識別とAS番号を設定します。
[edit routing-options] user@PE2# set route-distinguisher-id 10.255.168.42 user@PE2# set autonomous-system 203
VPN で使用されるシグナリング プロトコルとして LDP を設定します。
[edit protocols ldp] user@PE2# set interface ge-1/0/0 user@PE2# set interface ge-1/0/1
BGPを設定します。
[edit protocols bgp group internal] user@PE2# set type internal user@PE2# set local-address 10.255.168.42 user@PE2# set family inet-vpn unicast user@PE2# set family route-target user@PE2# set neighbor 10.255.165.220 user@PE2# set neighbor 10.255.165.28
OSPFを設定します。
[edit protocols ospf area 0.0.0.0] user@PE2# set interface ge-1/0/0 user@PE2# set interface ge-1/0/1 user@PE2# set interface lo0.0 passive
VPN ルーティング インスタンスを設定します。
[edit routing-instances vpn1] user@PE2# set instance-type vrf user@PE2# set vrf-target target:203:100 user@PE2# set routing-options static route 203.0.113.1/24 discard
[edit routing-instances vpn2] user@PE2# set instance-type vrf user@PE2# set vrf-target target:203:101 user@PE2# set routing-options static route 203.0.113.2/24 discard
[edit routing-instances vpn3] user@PE2# set instance-type vrf user@PE2# set vrf-target target:203:103 user@PE2# set routing-options static route 203.0.113.3/24 discard
[edit routing-instances vpn4] user@PE2# set instance-type vrf user@PE2# set vrf-target target:203:104 user@PE2# set routing-options static route 203.0.113.4/24 discard
エクスポートルーティングポリシーを設定および適用します。
[edit policy-options] user@PE2# set rtf-prefix-list exclude-103 203:203:103/96 [edit policy-options policy-statement filter-rtc] user@PE2# set from family route-target user@PE2# set from rtf-prefix-list exclude-103 user@PE2# set then reject [edit protocols bgp group internal] user@PE2# set neighbor 10.255.165.220 export filter-rtc
デバイスの設定が完了したら、設定をコミットします。
[edit] user@PE2# commit
結果
設定モードから、 、show routing-optionsshow protocolsshow policy-optionsおよび のコマンドをshow interfaces入力して、設定をshow routing-instances確認します。出力結果に意図した設定が表示されない場合は、この例の手順を繰り返して設定を修正します。
user@PE2# show interfaces
ge-1/0/0 {
unit 0 {
description PE2-to-RR1;
family inet {
address 10.50.0.1/30;
}
family mpls;
}
}
ge-1/0/1 {
unit 0 {
description PE2-to-RR2;
family inet {
address 10.50.10.2/30;
}
family mpls;
}
}
user@PE2# show protocols
bgp {
group internal {
type internal;
local-address 10.255.168.42;
family inet-vpn {
unicast;
}
family route-target;
neighbor 10.255.165.220 {
export filter-rtc;
}
neighbor 10.255.165.28;
}
}
ospf {
area 0.0.0.0 {
interface ge-1/0/0.0;
interface ge-1/0/1.0;
interface lo0.0 {
passive;
}
}
}
ldp {
interface ge-1/0/0.0;
interface ge-1/0/1.0;
}
user@PE2# show routing-options route-distinguisher-id 10.255.168.42; autonomous-system 203;
user@PE2# show policy-options
policy-statement filter-rtc {
from {
family route-target;
rtf-prefix-list exclude-103;
}
then reject;
}
rtf-prefix-list exclude-103 {
203:203:103/96;
}
user@PE2# show routing-instances
vpn1 {
instance-type vrf;
vrf-target target:203:100;
routing-options {
static {
route 203.0.113.1/24 discard;
}
}
}
vpn2 {
instance-type vrf;
vrf-target target:203:101;
routing-options {
static {
route 203.0.113.2/24 discard;
}
}
}
vpn3 {
instance-type vrf;
vrf-target target:203:103;
routing-options {
static {
route 203.0.113.3/24 discard;
}
}
}
vpn4 {
instance-type vrf;
vrf-target target:203:104;
routing-options {
static {
route 203.0.113.4/24 discard;
}
}
}
検証
設定が正しく機能していることを確認します。
デバイスRR1のbgp.rtarget.0ルーティングテーブル内のルートターゲットフィルタリングルートの検証
目的
vpn3のルートプレフィックスがデバイスRR1のbgp.rtarget.0テーブルにないことを確認します。デバイスPE2のエクスポートポリシーは、デバイスRR1へのvpn3ルートのアドバタイズを防ぐために適用されたので、デバイスRR1はこれらのアドバタイズを受信しないでください。
アクション
動作モードから、 コマンドを show route advertising-protocol bgp 10.255.165.220 table bgp.rtarget.0 入力します。
user@PE2# show route advertising-protocol bgp 10.255.165.220 table bgp.rtarget.0
bgp.rtarget.0: 4 destinations, 11 routes
(4 active, 0 holddown, 0 hidden)
Prefix Nexthop MED Lclpref AS path
203:203:100/96 * Self 100 I
203:203:101/96 * Self 100 I
203:203:104/96 * Self 100 I
意味
bgp.rtartget.0 テーブルには、vpn3 のルート プレフィックスである 203:203:103/96 は表示されません。つまり、エクスポートポリシーが正しく適用されました。
デバイスRR2のbgp.rtarget.0ルーティングテーブル内のルートを検証する
目的
vpn3のルートプレフィックスがデバイスRR2のbgp.rtarget.0テーブルであることを確認します。デバイスRR2へのvpn3ルートのアドバタイズを防ぐために、エクスポートポリシーがデバイスPE2に適用されていないため、デバイスRR2はすべてのVPNからアドバタイズを受信する必要があります。
アクション
動作モードから、 コマンドを show route advertising-protocol bgp 10.255.165.28 table bgp.rtarget.0 入力します。
user@PE2# show route advertising-protocol bgp 10.255.165.28 table bgp.rtarget.0
bgp.rtarget.0: 4 destinations, 11 routes (4 active, 0 holddown, 0 hidden)
(4 active, 0 holddown, 0 hidden)
Prefix Nexthop MED Lclpref AS path
203:203:100/96 * Self 100 I
203:203:101/96 * Self 100 I
203:203:103/96 * Self 100 I
203:203:104/96 * Self 100 I
意味
bgp.rtartget.0 テーブルには、すべての VPN のルート プレフィックスが表示されます。