MPLS VPNのSham Link(バックドアリンク対策)
2つのサイトがMPLS VPNでつながっていて、さらにサイト同士が直結のリンクでもつながっていることがあります。バックアップ用に引いた専用線や、以前から使っている回線です。これをバックドアリンクと呼びます。
PE-CE間でOSPFを使っている場合、この構成ではサイト間の通信がバックドアリンクを通ります。VPN経由の経路がどれだけ速くても変わりません。
intra-areaはinter-areaに無条件で勝つ
理由はOSPFの経路選択にあります。OSPFはintra-areaの経路をinter-areaの経路より常に優先し、コストは比較しません。
バックドアリンクは2つのサイトを直接つなぐOSPFのリンクなので、そこを通る経路はintra-areaです。一方、VPN経由の経路はPEがType 3のLSAとして広告するのでinter-areaになります(MPLS VPNのPE-CEルーティング(OSPF))。コストを100にしてもバックドアが勝ちます。
RFC 4577の4.2.7.1は、この状況をまずこう整理しています。
It is possible to treat these two sites as a single VPN site that just happens to be multihomed to the backbone. This is in fact the simplest thing to do and is perfectly adequate, provided that the preferred route between the two sites is via the intra-area OSPF link (a “backdoor link”), rather than via the VPN backbone.
バックドアを使いたいならそれでよい、と言っています。問題になるのは逆の場合です。
If it is desired to have OSPF prefer the routes through the backbone over the routes through the backdoor link, then the routes through the backbone must be appear to be intra-area routes. To make a route through the backbone appear to be an intra-area route, it is necessary to make it appear as if there is an intra-area link connecting the two PE routers. This is what we refer to as a “sham link”.
VPN経由をintra-areaに見せるために、PE間にintra-areaのリンクがあることにする。 それがSham Linkです。RFC 4577ではOPTIONALな機能と位置づけられています。
端点アドレスの決まり
Sham Linkは2つのVRFの間の関係として作ります。それぞれのVRFに、端点アドレス(Sham Link Endpoint Address)を1つ持たせます。
The Sham Link Endpoint Address is an address in the VPN’s address space, not the SP’s address space.
このアドレスには、守るべき決まりが2つあります。
The Sham Link Endpoint Address MUST be distributed by BGP as a VPN-IPv4 address whose IPv4 address prefix part is 32 bits long. The Sham Link Endpoint Address MUST NOT be advertised by OSPF; if there is no BGP route to the Sham Link Endpoint Address, that address is to appear unreachable, so that the sham link appears to be down.
| 決まり | 理由 |
|---|---|
| BGPで/32として配る | 相手の端点に届くことがSham Linkが上がる条件(4.2.7.2) |
| OSPFで広告しない | OSPFで届いてしまうと、Sham Linkのパケットがバックドア側へ流れる |
設定は両端で行います。片側だけの設定でSham Linkを張る手順は定められていません(4.2.7.2)。
Sham Link上のOSPFはMPLSで流れる
Sham Linkは論理的なリンクで、実体はVPNバックボーンです。
An OSPF protocol packet sent on a Sham Link from one PE to another must have as its IP source address the Sham Link Endpoint Address of the sender, and as its IP destination address the Sham Link Endpoint Address of the receiver. The packet will travel from one PE router to the other over the VPN backbone, which means that it can be expected to traverse multiple hops.
つまり、端点アドレス同士のOSPFパケットが、ラベルを付けてコアを通ります。転送についても決まりがあります(4.2.7.4)。経路としてはOSPFが優先されますが、ネクストホップがSham Linkの経路は、対応するBGP経路に従って転送されます。
Sham Linkの性質も同じ節が定めています。番号なしのポイントツーポイントのintra-areaリンクとして扱い、Type 1 LSAのType 1リンクとして広告します。メトリックについては次のとおりです。
The OSPF metric associated with a sham link MUST be configurable (and there MUST be a configurable default). Whether traffic between the sites flows via a backdoor link or via the VPN backbone (i.e., via the sham link) depends on the settings of the OSPF link metrics.
どちらを通るかはメトリック次第になる、というのがSham Linkを張ったあとの状態です。
Sham Linkはデマンドサーキットとして扱う
同じ4.2.7.3に、もう1つ決まりがあります。
Sham links SHOULD be treated by OSPF as OSPF Demand Circuits. This means that LSAs will be flooded over them, but periodic refresh traffic is avoided.
デマンドサーキットはRFC 1793が定める仕組みで、LSAのフラッディングは行うが、定期的なリフレッシュは流さないようにします。両端がHelloとDB DescriptionにDCビットを立てて合意すると、Helloの送信も抑制されます(RFC 1793の3.2.1)。DCビットはOptionsフィールドの1つで、ビットの位置はOSPF Optionsフィールドで解説しています。LSAにはDoNotAgeビットが付き、データベースの中でエージングされません。
無駄に見えるフラッディングをなぜ残すのか、その理由も書かれています。
Note that, as long as the backdoor link is up, flooding the LSAs over the sham link serves no purpose. However, if the backdoor link goes down, OSPF does not have mechanisms enabling the routers in one site to rapidly flush the LSAs from the other site. Therefore, it is still necessary to maintain synchronization among the LSA databases at the two sites, hence the flooding over the sham link.
バックドアが上がっている間は意味が無くても、落ちたときに相手サイトのLSAを素早く消す仕組みがOSPFに無い。 だからデータベースの同期だけは保っておく、ということです。
検証構成
2つのサイトは PE1・PE2 を通して MPLS VPN でつながり、さらに CE-A1 と CE-A2 が直結のバックドアリンクでもつながっています。PE-CE もバックドアも OSPF の area 1 です。バックドアのコストは 100 にしてあります。Sham Link の端点は、各 PE の VRF に置いた Loopback の /32(10.0.101.1 と 10.0.102.1)です。
| STEP | 操作 | 確かめること |
|---|---|---|
| 0 | 初期状態(Sham Link なし) | コスト 100 のバックドアが勝つ。 VPN 経由は inter-area なので比較されない |
| 1 | PE1・PE2 に Sham Link(コスト 1) | VPN 経由に変わる。 Sham Link で intra-area になり、コストで決まるようになった |
| 2 | Sham Link のコストを 200 に(バックドアの 100 より高く) | バックドアに戻る。 同じ種別なのでコストの低いほうが勝つ |
| 3 | Sham Link のコストを 1 に戻す | VPN 経由に戻る |
| 4 | Sham Link を外す(最終状態) | バックドアに戻る |
コストを上げてもバックドアが勝つ
CE-A1 から相手サイトの 10.1.2.1/32 を見ると、次ホップが 10.1.9.2(バックドア)になっています。コストは 100 です。
RP/0/RP0/CPU0:CE-A1#show route 10.1.2.1/32
Mon Oct 12 09:58:04.552 UTC
Routing entry for 10.1.2.1/32
Known via "ospf 1", distance 110, metric 101, type intra area
Installed Oct 12 09:53:04.175 for 00:05:00
Routing Descriptor Blocks
10.1.9.2, from 12.12.12.12, via GigabitEthernet0/0/0/1
Route metric is 101
No advertising protos. traceroute も直結を1ホップで抜けます。
RP/0/RP0/CPU0:CE-A1#traceroute 10.1.2.1 source 10.1.1.1 timeout 1 probe 2 maxttl 6
Mon Oct 12 09:55:40.242 UTC
Type escape sequence to abort.
Tracing the route to 10.1.2.1
1 10.1.9.2 6 msec * 端点アドレスの持たせ方
Sham Link を張る前に、端点アドレスが決まりどおりになっているかを見ます。相手の端点 10.0.102.1/32 は BGP で届いています。
RP/0/RP0/CPU0:PE1#show route vrf CUST-A 10.0.102.1/32
Mon Oct 12 09:56:25.044 UTC
Routing entry for 10.0.102.1/32
Known via "bgp 65001", distance 200, metric 0, type internal
Installed Oct 12 09:54:15.829 for 00:02:09
Routing Descriptor Blocks
2.2.2.2, from 2.2.2.2
Nexthop in Vrf: "default", Table: "default", IPv4 Unicast, Table Id: 0xe0000000
Route metric is 0, Wt is 1
No advertising protos. 一方、VRF の OSPF 経路には端点アドレスがありません。OSPF で広告していないからです。
RP/0/RP0/CPU0:PE1#show route vrf CUST-A ospf
Mon Oct 12 09:56:25.251 UTC
O 10.1.1.1/32 [110/2] via 172.16.1.2, 00:03:30, GigabitEthernet0/0/0/0
O 10.1.2.1/32 [110/102] via 172.16.1.2, 00:03:16, GigabitEthernet0/0/0/0
O 10.1.9.0/24 [110/101] via 172.16.1.2, 00:03:30, GigabitEthernet0/0/0/0
O 172.16.2.0/24 [110/102] via 172.16.1.2, 00:03:16, GigabitEthernet0/0/0/0Sham Linkを張る
両方の PE に、自分の端点と相手の端点を指定して設定します。
router ospf 100
vrf CUST-A
area 1
sham-link 10.0.101.1 10.0.102.1
cost 1
!
!
!
!
endSham Link が上がりました。State POINT_TO_POINT、Adjacency State FULL で、普通の OSPF のリンクと同じように隣接が張られています。
RP/0/RP0/CPU0:PE1#show ospf 100 vrf CUST-A sham-links
Mon Oct 12 10:01:26.797 UTC
Sham Links for OSPF 100, VRF CUST-A
Sham Link OSPF_SL0 to address 10.0.102.1 is up
Area 1, source address 10.0.101.1
IfIndex = 2
Run as demand circuit
DoNotAge LSA allowed., Cost of using 1
Transmit Delay is 1 sec, State POINT_TO_POINT,
Timer intervals configured, Hello 10, Dead 40, Wait 40, Retransmit 5
Hello due in 00:00:03:693
Adjacency State FULL (Hello suppressed)
Number of DBD retrans during last exchange 0
Index 2/2, retransmission queue length 0, number of retransmission 0
First 0(0)/0(0) Next 0(0)/0(0)
Last retransmission scan length is 0, maximum is 0
Last retransmission scan time is 0 msec, maximum is 0 msec出力は RFC 4577 の規定どおりです。 Run as demand circuit と DoNotAge LSA allowed が出ていて、隣接が張れたあとは Hello が抑制されます(Hello suppressed)。Hello が見えないのに FULL のままなのは異常ではありません。
CE-A1 から見た経路が VPN 経由に変わりました。次ホップが PE1(172.16.1.1)です。
RP/0/RP0/CPU0:CE-A1#show route 10.1.2.1/32
Mon Oct 12 10:03:11.048 UTC
Routing entry for 10.1.2.1/32
Known via "ospf 1", distance 110, metric 4, type intra area
Installed Oct 12 09:59:08.780 for 00:04:02
Routing Descriptor Blocks
172.16.1.1, from 12.12.12.12, via GigabitEthernet0/0/0/0
Route metric is 4
No advertising protos. traceroute もプロバイダ網を通るようになりました。
RP/0/RP0/CPU0:CE-A1#traceroute 10.1.2.1 source 10.1.1.1 timeout 1 probe 2 maxttl 6
Mon Oct 12 10:00:44.280 UTC
Type escape sequence to abort.
Tracing the route to 10.1.2.1
1 172.16.1.1 7 msec 4 msec
2 10.0.13.3 [MPLS: Labels 24001/24005 Exp 0] 14 msec 11 msec
3 10.0.23.2 [MPLS: Label 24005 Exp 0] 12 msec 23 msec
4 172.16.2.2 20 msec * Sham LinkのOSPFはラベル付きで流れる
コア(PE1-P1 間)のキャプチャーを見ると、端点アドレス同士の OSPF パケットが2段のラベルを付けて流れています。添付の STEP 1 のキャプチャーの No.3 です。
MultiProtocol Label Switching Header, Label: 24001, Exp: 6, S: 0, TTL: 255
0000 0101 1101 1100 0001 .... .... .... = MPLS Label: 24001 (0x05dc1)
.... .... .... .... .... 110. .... .... = MPLS Experimental Bits: 6
.... .... .... .... .... ...0 .... .... = MPLS Bottom Of Label Stack: 0
.... .... .... .... .... .... 1111 1111 = MPLS TTL: 255
MultiProtocol Label Switching Header, Label: 24003, Exp: 6, S: 1, TTL: 255
0000 0101 1101 1100 0011 .... .... .... = MPLS Label: 24003 (0x05dc3)
.... .... .... .... .... 110. .... .... = MPLS Experimental Bits: 6
.... .... .... .... .... ...1 .... .... = MPLS Bottom Of Label Stack: 1
.... .... .... .... .... .... 1111 1111 = MPLS TTL: 255
Internet Protocol Version 4, Src: 10.0.101.1, Dst: 10.0.102.1
0100 .... = Version: 4
.... 0101 = Header Length: 20 bytes (5)
Differentiated Services Field: 0xc0 (DSCP: CS6, ECN: Not-ECT)
1100 00.. = Differentiated Services Codepoint: Class Selector 6 (48)
.... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0)
Total Length: 76
Identification: 0x0033 (51)
000. .... = Flags: 0x0
0... .... = Reserved bit: Not set
.0.. .... = Don't fragment: Not set
..0. .... = More fragments: Not set
...0 0000 0000 0000 = Fragment Offset: 0
Time to Live: 255
Protocol: OSPF IGP (89)
Header Checksum: 0xdb63 [validation disabled]
[Header checksum status: Unverified]
Source Address: 10.0.101.1
Destination Address: 10.0.102.1
[Stream index: 2]
Open Shortest Path First
OSPF Header
Version: 2
Message Type: Hello Packet (1)同じ Hello の Options に (DC) Demand Circuits が立っています。両端がこのビットで合意すると Hello の送信が抑制される、という RFC 1793 の 3.2.1 の交渉です。添付のキャプチャーでは、隣接を張るときの DB Description にも同じビットが立っています。
OSPF Hello Packet
Network Mask: 0.0.0.0
Hello Interval [sec]: 10
Options: 0x32, (DC) Demand Circuits, (L) LLS Data block, (E) External Routing以後はコストで決まる
Sham Link のコストをバックドアより高い 200 にします。
router ospf 100
vrf CUST-A
area 1
sham-link 10.0.101.1 10.0.102.1
cost 200
!
!
!
!
endバックドアに戻りました。どちらも intra-area になったので、コストの低いほうが選ばれています。
RP/0/RP0/CPU0:CE-A1#show route 10.1.2.1/32
Mon Oct 12 10:08:17.309 UTC
Routing entry for 10.1.2.1/32
Known via "ospf 1", distance 110, metric 101, type intra area
Installed Oct 12 10:04:05.788 for 00:04:11
Routing Descriptor Blocks
10.1.9.2, from 12.12.12.12, via GigabitEthernet0/0/0/1
Route metric is 101
No advertising protos. コストを 1 に戻すと、また VPN 経由になります。
RP/0/RP0/CPU0:CE-A1#show route 10.1.2.1/32
Mon Oct 12 10:13:25.079 UTC
Routing entry for 10.1.2.1/32
Known via "ospf 1", distance 110, metric 4, type intra area
Installed Oct 12 10:09:09.989 for 00:04:15
Routing Descriptor Blocks
172.16.1.1, from 12.12.12.12, via GigabitEthernet0/0/0/0
Route metric is 4
No advertising protos. 検証Configおよびshow結果
各STEPで5台すべてから、次の種類をルータごとに分けて取得しています。検証Configはこの..._run.txtです(最終状態は最後のSTEPのもの)。
| ファイル | 内容 |
|---|---|
..._show.txt | show version / show interface description / OSPF・LDP・BGP・VRFの各showなど |
..._log.txt | そのSTEPの範囲だけに絞ったshow logging |
..._run.txt | そのSTEP時点のshow running-config(=そのSTEPの検証Config) |
..._ping.txt | そのSTEPのpingとtraceroute |
..._trace.txt | show bgp trace(PEのみ) |
..._commit.cfg | そのSTEPで実際にcommitされた設定(変更したルータのみ) |
STEP 0:初期状態(Sham Link なし)
| ルータ | show出力 | syslog | running-config | ping | trace | 投入した設定 |
|---|---|---|---|---|---|---|
| CE-A1 | show | log | run | ping | - | - |
| PE1 | show | log | run | ping | trace | - |
| P1 | show | log | run | ping | - | - |
| PE2 | show | log | run | ping | trace | - |
| CE-A2 | show | log | run | ping | - | - |
STEP 1:PE1・PE2 に Sham Link(コスト 1)
| ルータ | show出力 | syslog | running-config | ping | trace | 投入した設定 |
|---|---|---|---|---|---|---|
| CE-A1 | show | log | run | ping | - | - |
| PE1 | show | log | run | ping | trace | commit |
| P1 | show | log | run | ping | - | - |
| PE2 | show | log | run | ping | trace | commit |
| CE-A2 | show | log | run | ping | - | - |
STEP 2:Sham Link のコストを 200 に(バックドアの 100 より高く)
| ルータ | show出力 | syslog | running-config | ping | trace | 投入した設定 |
|---|---|---|---|---|---|---|
| CE-A1 | show | log | run | ping | - | - |
| PE1 | show | log | run | ping | trace | commit |
| P1 | show | log | run | ping | - | - |
| PE2 | show | log | run | ping | trace | commit |
| CE-A2 | show | log | run | ping | - | - |
STEP 3:Sham Link のコストを 1 に戻す
| ルータ | show出力 | syslog | running-config | ping | trace | 投入した設定 |
|---|---|---|---|---|---|---|
| CE-A1 | show | log | run | ping | - | - |
| PE1 | show | log | run | ping | trace | commit |
| P1 | show | log | run | ping | - | - |
| PE2 | show | log | run | ping | trace | commit |
| CE-A2 | show | log | run | ping | - | - |
STEP 4:Sham Link を外す(最終状態)
| ルータ | show出力 | syslog | running-config | ping | trace | 投入した設定 |
|---|---|---|---|---|---|---|
| CE-A1 | show | log | run | ping | - | - |
| PE1 | show | log | run | ping | trace | commit |
| P1 | show | log | run | ping | - | - |
| PE2 | show | log | run | ping | trace | commit |
| CE-A2 | show | log | run | ping | - | - |
パケットキャプチャーはSTEPごとに取得しています。
| STEP | PE1-P1間 | バックドア |
|---|---|---|
| 0 | pcap | pcap |
| 1 | pcap | pcap |
| 2 | pcap | pcap |
| 3 | pcap | pcap |
| 4 | pcap | pcap |
まとめ
- MPLS VPN(L3VPN)とは
- MPLS VPNのVRF(Virtual Routing and Forwarding)
- MPLS VPNのRD(Route Distinguisher)
- MPLS VPNのRT(Route Target)
- MPLS VPNのMP-BGP(VPNv4経路の伝搬)
- MPLS VPNのVPNラベルの割り当て(per-prefix / per-CE / per-VRF)
- MPLS VPNの2段ラベルの転送(トランスポートラベルとVPNラベル)
- MPLS VPNのPE-CEルーティング(スタティック)
- MPLS VPNのPE-CEルーティング(eBGP)
- MPLS VPNで複数拠点が同じAS番号を使う場合(as-override)
- MPLS VPNのSoO(Site of Origin)
- MPLS VPNのPE-CEルーティング(OSPF)
- MPLS VPNのOSPFのDNビットとDomain Tag
- MPLS VPNのSham Link(バックドアリンク対策)
- MPLS VPNのRTによる経路制御(extranet / import・export map)
- MPLS VPNのハブアンドスポーク