メインコンテンツへスキップ
  1. ネットワーク 記事一覧/
  2. MPLS記事一覧/

MPLSラベルとラベルスタック

目次

MPLSラベルとラベルスタック

MPLSのラベルは、RFC 3032が定める4バイトのラベルスタックエントリとしてパケットに付きます。本記事では、この4バイトの中身、複数のラベルを積んだときの並び、値が予約されているラベルを解説し、最後にIOS XR(XRd)のラボでラベル付きパケットをキャプチャーして確かめます。ラベルの役割やLSR・LSPといった用語はMPLSとはで解説しています。

ラベルスタックエントリの形式

フィールドビット数内容
Label20ラベル値。0〜1048575のうち、0〜15は特別な用途に予約されている(後述)。
TC(Traffic Class)3QoSのクラスを運ぶ。RFC 3032では「実験用(EXP)」とだけ定められ、RFC 5462でTraffic Classに改名された。IOS XRのshowや設定コマンドでは今もEXPと表記され、既定ではラベルを付けるときにIPヘッダーのPrecedence(DSCPの上位3ビット)が写る。
S(Bottom of Stack)1スタックの最後(ボトム)のエントリだけ1。受信側はこのビットでラベルスタックの終わりを知る。
TTL(Time to Live)8IPヘッダーのTTLと同じ役割。最初にラベルを付けるときにIPのTTLを写し、LSRを通過するたびにラベル側のTTLだけが1減る。ラベルを外すときにIPのTTLへ書き戻す。0になったパケットは転送されない。

IOS XRが動的に割り当てるラベルは、既定では24000から始まります(show mpls label range)。

ラベルスタック

ラベルスタックエントリは、レイヤー2ヘッダーの直後、レイヤー3ヘッダーの直前に、必要な数だけ並びます。先頭をトップ、末尾をボトムと呼び、転送はトップのラベルだけを見て行います。

イーサネットでは、EtherType0x8847(ユニキャスト)または0x8848(マルチキャスト)で「この後ろにラベルスタックがある」ことを示します(RFC 3032 5節)。ラベルスタック自体には「ペイロードがIPv4かIPv6か」を示すフィールドがありません(同2.2)。最後のラベルを外したLSRは、ボトムのラベル値から、あるいはIPヘッダーの先頭(バージョン)からペイロードの種類を判断します。

スタックの深さは用途で決まります。IGPの経路をLDPで運ぶだけなら1段、MPLS VPNでは「出口PEまで届けるラベル」と「VPNを識別するラベル」の2段、トラフィックエンジニアリングの迂回路ではさらに1段積まれます。本記事のラボでは、グローバルの経路(1段)とMPLS VPNの経路(2段)の両方を観測します。

予約ラベル(0〜15)

ラベル値0〜15は特別な用途に予約されています。RFC 3032が0〜3を定め、4〜15はIANAが管理しています(Special-Purpose MPLS Label Values)。

名前意味
0IPv4 Explicit NULL受け取ったLSRはこのエントリを外し、下にラベルがあればそのラベルで、無ければIPv4ヘッダーで転送する。RFC 3032ではボトムにしか置けなかったが、RFC 4182で制限が外れた。
1Router Alertボトム以外に置ける。トップにあるとソフトウェア処理に回され、転送後に再び積み直される。
2IPv6 Explicit NULL0のIPv6版。
3Implicit NULLパケットには付かない。出口LSRがこの値を配ることで、1つ手前のLSRに「ラベルを外して送れ」と伝える(PHP)。
4MPLS Network ActionsRFC 9994。
7Entropy Label Indicator(ELI)RFC 6790。直後にロードバランス用のエントロピーラベルが続くことを示す。
13Generic Associated Channel Label(GAL)RFC 5586。OAMなどの制御チャネル。
14OAM AlertRFC 3429。
15Extension Label(XL)RFC 7274。拡張された特別用途ラベルが続くことを示す。

このうち日常的に目にするのは0と3です。既定はimplicit-null(3) で、出口LSRは自分に直結する経路(ループバックなど)に対して3を配り、1つ手前のLSRがラベルを外します。そのため出口LSRの手前のリンクではラベル無しのIPパケットが流れます。TCの値を出口LSRまで届けたいときは、出口LSRにexplicit-null(0) を配らせます。すると1つ手前のLSRはラベルを0に付け替えて送り、出口LSRはラベル0のTCを読んでから外します。IOS XRではmpls ldp配下のlabel local advertise explicit-nullで切り替えます。

出口LSRが配る値1つ手前のLSRの動作出口LSRの手前のリンク
3(implicit-null、既定)ラベルを外す(Pop)ラベル無し
0(explicit-null)ラベルを0に付け替えるラベル0付き

ラベル操作そのものは、MPLSのラベル操作(push / swap / pop)とPHPで解説します。

実機での検証

検証環境

CE1 — PE1 — P1 — P2 — PE2 — CE2 を直列につないでいます。AS 65001のPE1 / P1 / P2 / PE2がMPLSネットワークで、OSPF(area 0、全リンクnetwork point-to-point)で経路を、LDPでラベルを配っています。CE1とCE2はMPLSを動かさない顧客側のルータで、PEとeBGPで経路を交換します。PE1とPE2はLoopback0間のiBGPで、next-hop-selfにより外部経路のネクストホップを自分のLoopback0にします。P1とP2はBGPを持ちません。

これに加えて、PE1にCE3、PE2にCE4をVRF CUST-A(RD / RT 65001:1)で接続し、PE1 - PE2間のiBGPにVPNv4を足しています。CE3とCE4の間の通信はMPLS VPNの経路で運ばれ、ラベルが2段になります。VRFやVPNv4の仕組みはMPLS L3VPNのシリーズで解説し、本記事ではラベルスタックだけを見ます。

ルータ役割Lo0リンク
CE1顧客側(AS 65101)、192.168.1.0/24を広告1.1.1.1/32Gi0/0/0/0 10.1.2.1
PE1入口 / 出口LSR(AS 65001)2.2.2.2/32Gi0/0/0/0 10.1.2.2 / Gi0/0/0/1 10.2.3.2
P1中継LSR3.3.3.3/32Gi0/0/0/0 10.2.3.3 / Gi0/0/0/1 10.3.4.3
P2中継LSR4.4.4.4/32Gi0/0/0/0 10.3.4.4 / Gi0/0/0/1 10.4.5.4
PE2入口 / 出口LSR(AS 65001)5.5.5.5/32Gi0/0/0/0 10.4.5.5 / Gi0/0/0/1 10.5.6.5
CE2顧客側(AS 65102)、192.168.6.0/24を広告6.6.6.6/32Gi0/0/0/0 10.5.6.6
CE3VRF CUST-Aの顧客側(AS 65107)、192.168.7.0/24を広告7.7.7.7/32Gi0/0/0/0 10.2.7.7(PE1 Gi0/0/0/2)
CE4VRF CUST-Aの顧客側(AS 65108)、192.168.8.0/24を広告8.8.8.8/32Gi0/0/0/0 10.5.8.8(PE2 Gi0/0/0/2)

CE1から192.168.6.1(グローバル)、CE3から192.168.8.1(VPN)へpingを打ち、PE1 - P1間とP2 - PE2間でキャプチャーします。どちらもBGPネクストホップはPE2のLoopback0(5.5.5.5)なので、PE1が付けるトップのラベルは、5.5.5.5/32に対してP1が配ったラベルです。

検証のSTEP

STEP操作狙い
0初期状態(既定 = implicit-null)PE1 - P1間にラベル付きパケット(EtherType 0x8847)が流れ、グローバルは1段、VPNは2段になること。P2 - PE2間ではトップのラベルが外れること
1PE2にlabel local advertise explicit-nullP2 - PE2間にラベル0が現れること。VPNではラベル0がトップに積まれること
2STEP 1を削除(最終状態)STEP 0と同じに戻ること

ラベル付きパケットの中身(STEP 0)

PE1は192.168.6.0/24のBGPネクストホップ5.5.5.5に対して、P1から受け取ったラベル24003を付けます。show mpls forwardingのローカルラベル24004(PE1自身が5.5.5.5/32に割り当てた値)の行に、出方向ラベル24003が載っています。最終行の24005は、VRF CUST-Aの192.168.7.0/24にPE1が割り当てたVPNラベルです([V])。

PE1 show mpls forwarding(STEP 0)
RP/0/RP0/CPU0:PE1#show mpls forwarding
Wed Sep  9 22:23:28.677 UTC
Local  Outgoing    Prefix             Outgoing     Next Hop        Bytes       
Label  Label       or ID              Interface                    Switched    
------ ----------- ------------------ ------------ --------------- ------------
24000  Pop         3.3.3.3/32         Gi0/0/0/1    10.2.3.3        1021        
24001  Pop         10.3.4.0/24        Gi0/0/0/1    10.2.3.3        0           
24002  24001       4.4.4.4/32         Gi0/0/0/1    10.2.3.3        0           
24003  24002       10.4.5.0/24        Gi0/0/0/1    10.2.3.3        0           
24004  24003       5.5.5.5/32         Gi0/0/0/1    10.2.3.3        3779        
24005  Unlabelled  192.168.7.0/24[V]  Gi0/0/0/2    10.2.7.7        2528

動的ラベルが24000から始まっているのは、show mpls label rangeのとおりです。

P2 show mpls label range(STEP 0)
RP/0/RP0/CPU0:P2#show mpls label range
Wed Sep  9 22:23:08.987 UTC
Range for dynamic labels: Min/Max: 24000/1048575

CE1から192.168.6.1へpingを打ったときの、PE1 - P1間のキャプチャーのNo.11がラベル付きのecho requestです。EtherTypeが0x8847、ラベル24003、TC(tsharkの表示はExperimental Bits)0、S = 1、TTL 254で、4バイトのラベルスタックエントリの直後にIPv4ヘッダーが続いています。ラベルのTTL 254は、CE1が送ったTTL 255をPE1が1減らして写した値です。

No.11 Echo request(PE1 → P1)tshark -V
    Type: MPLS label switched packet (0x8847)
    [Stream index: 0]
MultiProtocol Label Switching Header, Label: 24003, Exp: 0, S: 1, TTL: 254
    0000 0101 1101 1100 0011 .... .... .... = MPLS Label: 24003 (0x05dc3)
    .... .... .... .... .... 000. .... .... = MPLS Experimental Bits: 0
    .... .... .... .... .... ...1 .... .... = MPLS Bottom Of Label Stack: 1
    .... .... .... .... .... .... 1111 1110 = MPLS TTL: 254
Internet Protocol Version 4, Src: 192.168.1.1, Dst: 192.168.6.1
    0100 .... = Version: 4
    .... 0101 = Header Length: 20 bytes (5)
    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
        0000 00.. = Differentiated Services Codepoint: Default (0)
        .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0)
    Total Length: 100
    Identification: 0x0000 (0)
    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: 254
上のtshark出力のパケット(No.11 Echo request)のpcapをダウンロード

STEP 1のPE1 - P1間のキャプチャーのNo.11は、PE1がPE2へ送ったBGPのKEEPALIVEです。IPヘッダーのDSCPがCS6なので、ラベルのTCも6になっています。TCの使い方はMPLSのQoSで解説します。

No.11 BGP KEEPALIVE(PE1 → P1、STEP 1)tshark -V
    Type: MPLS label switched packet (0x8847)
    [Stream index: 0]
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: 2.2.2.2, Dst: 5.5.5.5
    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)
上のtshark出力のパケット(No.11 BGP KEEPALIVE)のpcapをダウンロード

2段のラベルスタック(STEP 0)

CE3から192.168.8.1(CE4)へのpingは、VRF CUST-Aの経路で運ばれます。PE1はこの宛先に、PE2がVPNv4で配ったVPNラベル24005と、その上に出口PE2へ届けるための24003を積みます。show cef vrf CUST-Alabels imposed {24003 24005}がその2段です。

PE1 show bgp vrf CUST-A 192.168.8.0/24(STEP 0)
RP/0/RP0/CPU0:PE1#show bgp vrf CUST-A 192.168.8.0/24
Wed Sep  9 22:23:34.324 UTC
BGP routing table entry for 192.168.8.0/24, Route Distinguisher: 65001:1
Versions:
  Process           bRIB/RIB   SendTblVer
  Speaker                  7            7
Last Modified: Sep  9 22:18:42.774 for 00:04:51
Paths: (1 available, best #1)
  Advertised to CE peers (in unique update groups):
    10.2.7.7        
  Path #1: Received by speaker 0
  Advertised to CE peers (in unique update groups):
    10.2.7.7        
  65108, (received & used)
    5.5.5.5 (metric 4) from 5.5.5.5 (5.5.5.5)
      Received Label 24005 
      Origin IGP, metric 0, localpref 100, valid, internal, best, group-best, import-candidate, imported
      Received Path ID 0, Local Path ID 1, version 7
      Extended community: RT:65001:1 
      Source AFI: VPNv4 Unicast, Source VRF: CUST-A, Source Route Distinguisher: 65001:1
PE1 show cef vrf CUST-A 192.168.8.0/24 detail(STEP 0)
RP/0/RP0/CPU0:PE1#show cef vrf CUST-A 192.168.8.0/24 detail
Wed Sep  9 22:23:35.074 UTC
192.168.8.0/24, version 7, internal 0x5000001 0x30 (ptr 0x885197b0) [1], 0x0 (0x0), 0x208 (0x89a1a4b8)
 Updated Sep  9 22:18:42.823
 Prefix Len 24, traffic index 0, precedence n/a, priority 3
  gateway array (0x89726b60) reference count 1, flags 0x2038, source rib (7), 0 backups
                [1 type 1 flags 0x48441 (0x89a534b8) ext 0x0 (0x0)]
  LW-LDI[type=0, refc=0, ptr=0x0, sh-ldi=0x0]
  gateway array update type-time 1 Sep  9 22:18:42.823
 LDI Update time Sep  9 22:18:42.823
   via 5.5.5.5/32, 3 dependencies, recursive [flags 0x6000]
    path-idx 0 NHID 0x0 [0x8856f048 0x0]
    recursion-via-/32
    next hop VRF - 'default', table - 0xe0000000
    next hop 5.5.5.5/32 via 24004/0/21
     next hop 10.2.3.3/32 GigabitEthernet0/0/0/1 labels imposed {24003 24005}

    Load distribution: 0 (refcount 1)

    Hash  OK  Interface                 Address
    0     Y   recursive                 24004/0

PE1 - P1間のキャプチャーのNo.50が、その2段のラベルが付いたecho requestです。トップの24003はS = 0、ボトムの24005はS = 1で、S = 1のエントリの直後にIPv4ヘッダーが続きます。2つのラベルのTTLはどちらも254です。

No.50 Echo request(PE1 → P1、2段)tshark -V
    Type: MPLS label switched packet (0x8847)
    [Stream index: 0]
MultiProtocol Label Switching Header, Label: 24003, Exp: 0, S: 0, TTL: 254
    0000 0101 1101 1100 0011 .... .... .... = MPLS Label: 24003 (0x05dc3)
    .... .... .... .... .... 000. .... .... = MPLS Experimental Bits: 0
    .... .... .... .... .... ...0 .... .... = MPLS Bottom Of Label Stack: 0
    .... .... .... .... .... .... 1111 1110 = MPLS TTL: 254
MultiProtocol Label Switching Header, Label: 24005, Exp: 0, S: 1, TTL: 254
    0000 0101 1101 1100 0101 .... .... .... = MPLS Label: 24005 (0x05dc5)
    .... .... .... .... .... 000. .... .... = MPLS Experimental Bits: 0
    .... .... .... .... .... ...1 .... .... = MPLS Bottom Of Label Stack: 1
    .... .... .... .... .... .... 1111 1110 = MPLS TTL: 254
Internet Protocol Version 4, Src: 192.168.7.1, Dst: 192.168.8.1
    0100 .... = Version: 4
    .... 0101 = Header Length: 20 bytes (5)
    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
        0000 00.. = Differentiated Services Codepoint: Default (0)
        .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0)
    Total Length: 100
    Identification: 0x0000 (0)
    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: 254
上のtshark出力のパケット(No.50 Echo request、2段)のpcapをダウンロード

P2 - PE2間のキャプチャーのNo.45は、同じパケットがP2でトップのラベルを外された後の姿です。VPNラベル24005だけが残り、TTLは252になっています。P2はトップのラベルを外すとき、その時点のTTL(252)を新しくトップになったラベルに書き移しています(RFC 3032 2.4.2)。

No.45 Echo request(P2 → PE2、VPNラベルのみ)tshark -V
    Type: MPLS label switched packet (0x8847)
    [Stream index: 0]
MultiProtocol Label Switching Header, Label: 24005, Exp: 0, S: 1, TTL: 252
    0000 0101 1101 1100 0101 .... .... .... = MPLS Label: 24005 (0x05dc5)
    .... .... .... .... .... 000. .... .... = MPLS Experimental Bits: 0
    .... .... .... .... .... ...1 .... .... = MPLS Bottom Of Label Stack: 1
    .... .... .... .... .... .... 1111 1100 = MPLS TTL: 252
Internet Protocol Version 4, Src: 192.168.7.1, Dst: 192.168.8.1
    0100 .... = Version: 4
    .... 0101 = Header Length: 20 bytes (5)
    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
        0000 00.. = Differentiated Services Codepoint: Default (0)
        .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0)
    Total Length: 100
    Identification: 0x0000 (0)
    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: 254
上のtshark出力のパケット(No.45 Echo request)のpcapをダウンロード

PE2側では、ローカルラベル24005がVRF CUST-Aの192.168.8.0/24([V])に対応しており、このラベルでCE4向けのインタフェースに送り出されます。VPNラベルの配布や意味はMPLS L3VPNのシリーズで解説します。

PE2 show mpls forwarding(STEP 0)
RP/0/RP0/CPU0:PE2#show mpls forwarding
Wed Sep  9 22:23:55.678 UTC
Local  Outgoing    Prefix             Outgoing     Next Hop        Bytes       
Label  Label       or ID              Interface                    Switched    
------ ----------- ------------------ ------------ --------------- ------------
24000  24000       2.2.2.2/32         Gi0/0/0/0    10.4.5.4        6482        
24001  24001       3.3.3.3/32         Gi0/0/0/0    10.4.5.4        0           
24002  Pop         4.4.4.4/32         Gi0/0/0/0    10.4.5.4        742         
24003  24002       10.2.3.0/24        Gi0/0/0/0    10.4.5.4        0           
24004  Pop         10.3.4.0/24        Gi0/0/0/0    10.4.5.4        0           
24005  Unlabelled  192.168.8.0/24[V]  Gi0/0/0/2    10.5.8.8        2120

implicit-nullはパケットには付かない(STEP 0)

出口LSRのPE2は、自分のLoopback0(5.5.5.5/32)に対してimplicit-null(3)を配っています。P2のshow mpls ldp bindingsではPE2からの値がImpNullshow mpls forwardingでは出方向がPopです。

P2 show mpls ldp bindings 5.5.5.5/32(STEP 0)
RP/0/RP0/CPU0:P2#show mpls ldp bindings 5.5.5.5/32
Wed Sep  9 22:23:07.909 UTC
5.5.5.5/32, rev 14
	Local binding: label: 24003
	Remote bindings: (2 peers)
	    Peer                Label    
	    -----------------   ---------
	    3.3.3.3:0           24003   
	    5.5.5.5:0           ImpNull
P2 show mpls forwarding(STEP 0)
RP/0/RP0/CPU0:P2#show mpls forwarding
Wed Sep  9 22:23:08.525 UTC
Local  Outgoing    Prefix             Outgoing     Next Hop        Bytes       
Label  Label       or ID              Interface                    Switched    
------ ----------- ------------------ ------------ --------------- ------------
24000  24000       2.2.2.2/32         Gi0/0/0/0    10.3.4.3        6531        
24001  Pop         3.3.3.3/32         Gi0/0/0/0    10.3.4.3        762         
24002  Pop         10.2.3.0/24        Gi0/0/0/0    10.3.4.3        0           
24003  Pop         5.5.5.5/32         Gi0/0/0/1    10.4.5.5        5926

P2 - PE2間のキャプチャーのNo.9が、CE1からのecho request(1段)がP2でラベルを外された後の姿です。EtherTypeは0x0800で、ラベルはありません。IPヘッダーのTTLは252で、ラベル側で減った値がラベルを外すときにIPヘッダーへ書き戻されています。

No.9 Echo request(P2 → PE2)tshark -V
    Type: IPv4 (0x0800)
    [Stream index: 0]
Internet Protocol Version 4, Src: 192.168.1.1, Dst: 192.168.6.1
    0100 .... = Version: 4
    .... 0101 = Header Length: 20 bytes (5)
    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
        0000 00.. = Differentiated Services Codepoint: Default (0)
        .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0)
    Total Length: 100
    Identification: 0x0000 (0)
    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: 252
上のtshark出力のパケット(No.9 Echo request)のpcapをダウンロード

予約ラベルのうちルータが実際に確保しているものは、show mpls label table detailで見えます。LSD(Label Switching Database)が0(IPv4 Explicit NULL)、1(Router Alert)、2(IPv6 Explicit NULL)、13(GAL)を持ち、3はありません。implicit-nullはLDPで伝えるための値であって、ラベルテーブルにも、実際のパケットにも現れません。

P2 show mpls label table detail(STEP 0)
RP/0/RP0/CPU0:P2#show mpls label table detail
Wed Sep  9 22:23:09.108 UTC
Table Label   Owner                           State  Rewrite
----- ------- ------------------------------- ------ -------
0     0       LSD(A)                          InUse  Yes
0     1       LSD(A)                          InUse  Yes
0     2       LSD(A)                          InUse  Yes
0     13      LSD(A)                          InUse  Yes
0     24000   LDP(A)                          InUse  Yes
  (IPv4, vers:0, 'default':4U, 2.2.2.2/32)
0     24001   LDP(A)                          InUse  Yes
  (IPv4, vers:0, 'default':4U, 3.3.3.3/32)
0     24002   LDP(A)                          InUse  Yes
  (IPv4, vers:0, 'default':4U, 10.2.3.0/24)
0     24003   LDP(A)                          InUse  Yes
  (IPv4, vers:0, 'default':4U, 5.5.5.5/32)

explicit-nullはパケットに付いて流れる(STEP 1)

PE2にlabel local advertise explicit-nullを入れます。

PE2(STEP 1)
mpls ldp
 address-family ipv4
  label local advertise explicit-null

P2が受け取る値はExpNullv4に変わり、出方向はExp-Null-v4になります。

P2 show mpls ldp bindings 5.5.5.5/32(STEP 1)
RP/0/RP0/CPU0:P2#show mpls ldp bindings 5.5.5.5/32
Wed Sep  9 22:27:36.443 UTC
5.5.5.5/32, rev 14
	Local binding: label: 24003
	Remote bindings: (2 peers)
	    Peer                Label    
	    -----------------   ---------
	    3.3.3.3:0           24003   
	    5.5.5.5:0           ExpNullv4
P2 show mpls forwarding(STEP 1)
RP/0/RP0/CPU0:P2#show mpls forwarding
Wed Sep  9 22:27:37.093 UTC
Local  Outgoing    Prefix             Outgoing     Next Hop        Bytes       
Label  Label       or ID              Interface                    Switched    
------ ----------- ------------------ ------------ --------------- ------------
24000  24000       2.2.2.2/32         Gi0/0/0/0    10.3.4.3        11943       
24001  Pop         3.3.3.3/32         Gi0/0/0/0    10.3.4.3        1336        
24002  Pop         10.2.3.0/24        Gi0/0/0/0    10.3.4.3        0           
24003  Exp-Null-v4 5.5.5.5/32         Gi0/0/0/1    10.4.5.5        4526

P2 - PE2間のキャプチャーのNo.10では、CE1からのecho requestにラベル0が付いて届いています。TTLはラベル側が252、IPヘッダー側は254のままで、ラベルが残っている間はIPヘッダーのTTLが変わらないことも分かります。

No.10 Echo request(P2 → PE2、explicit-null)tshark -V
    Type: MPLS label switched packet (0x8847)
    [Stream index: 0]
MultiProtocol Label Switching Header, Label: 0 (IPv4 Explicit-Null), Exp: 0, S: 1, TTL: 252
    0000 0000 0000 0000 0000 .... .... .... = MPLS Label: IPv4 Explicit-Null (0)
    .... .... .... .... .... 000. .... .... = MPLS Experimental Bits: 0
    .... .... .... .... .... ...1 .... .... = MPLS Bottom Of Label Stack: 1
    .... .... .... .... .... .... 1111 1100 = MPLS TTL: 252
Internet Protocol Version 4, Src: 192.168.1.1, Dst: 192.168.6.1
    0100 .... = Version: 4
    .... 0101 = Header Length: 20 bytes (5)
    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
        0000 00.. = Differentiated Services Codepoint: Default (0)
        .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0)
    Total Length: 100
    Identification: 0x0000 (0)
    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: 254
上のtshark出力のパケット(No.10 Echo request)のpcapをダウンロード

VPNの経路では、No.52のようにラベル0がトップ(S = 0)、VPNラベル24005がボトム(S = 1)の2段になります。RFC 3032はexplicit-nullをボトムにしか置けないとしていましたが、RFC 4182がこの制限を外し、「トップにあればそのエントリを外し、下のラベルで処理する」に改めています。PE2はラベル0を外してから、24005でVRF CUST-Aへ転送します。

No.52 Echo request(P2 → PE2、explicit-null + VPNラベル)tshark -V
    Type: MPLS label switched packet (0x8847)
    [Stream index: 0]
MultiProtocol Label Switching Header, Label: 0 (IPv4 Explicit-Null), Exp: 0, S: 0, TTL: 252
    0000 0000 0000 0000 0000 .... .... .... = MPLS Label: IPv4 Explicit-Null (0)
    .... .... .... .... .... 000. .... .... = MPLS Experimental Bits: 0
    .... .... .... .... .... ...0 .... .... = MPLS Bottom Of Label Stack: 0
    .... .... .... .... .... .... 1111 1100 = MPLS TTL: 252
MultiProtocol Label Switching Header, Label: 24005, Exp: 0, S: 1, TTL: 254
    0000 0101 1101 1100 0101 .... .... .... = MPLS Label: 24005 (0x05dc5)
    .... .... .... .... .... 000. .... .... = MPLS Experimental Bits: 0
    .... .... .... .... .... ...1 .... .... = MPLS Bottom Of Label Stack: 1
    .... .... .... .... .... .... 1111 1110 = MPLS TTL: 254
Internet Protocol Version 4, Src: 192.168.7.1, Dst: 192.168.8.1
    0100 .... = Version: 4
    .... 0101 = Header Length: 20 bytes (5)
    Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
        0000 00.. = Differentiated Services Codepoint: Default (0)
        .... ..00 = Explicit Congestion Notification: Not ECN-Capable Transport (0)
    Total Length: 100
    Identification: 0x0000 (0)
    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: 254
上のtshark出力のパケット(No.52 Echo request、2段)のpcapをダウンロード

元に戻す(STEP 2)

PE2のlabel local advertise explicit-nullを削除すると、P2の値はImpNullに戻ります。P2のLDPのtraceを5.5.5.5/32で絞ると、PE2から受け取った値が 3 → 0 → 3 と変わった履歴が並びます。どちらの切り替えでも、古い値の取り消し(Remove)から新しい値の受信(Add)まで10秒空いており、その間はP2のshow mpls forwardingUnlabelledになります。

P2 show mpls ldp trace binding | include 5.5.5.5/32(STEP 2)
RP/0/RP0/CPU0:P2#show mpls ldp trace binding | include "5.5.5.5/32"
Wed Sep  9 22:33:16.133 UTC
Sep  9 22:17:00.924 mpls/ldp/bndg 0/RP0/CPU0 t4062  [BNDG]:161: VRF(0x60000000): Prefix(5.5.5.5/32): Created, reason 3
Sep  9 22:17:00.925 mpls/ldp/bndg 0/RP0/CPU0 t4062  [BNDG]:221: VRF(0x60000000): Prefix(5.5.5.5/32): label 24003 (rev#14) assigned
Sep  9 22:17:05.919 mpls/ldp/bndg 0/RP0/CPU0 t4062  [BNDG]:279: VRF(0x60000000): Prefix(5.5.5.5/32): Add label 3 from peer 5.5.5.5:0
Sep  9 22:17:07.056 mpls/ldp/bndg 0/RP0/CPU0 t4062  [BNDG]:279: VRF(0x60000000): Prefix(5.5.5.5/32): Add label 24003 from peer 3.3.3.3:0
Sep  9 22:25:46.049 mpls/ldp/bndg 0/RP0/CPU0 t4062  [BNDG]:339: VRF(0x60000000): Prefix(5.5.5.5/32): Remove label 3 from peer 5.5.5.5:0
Sep  9 22:25:56.056 mpls/ldp/bndg 0/RP0/CPU0 t4062  [BNDG]:279: VRF(0x60000000): Prefix(5.5.5.5/32): Add label 0 from peer 5.5.5.5:0
Sep  9 22:29:56.056 mpls/ldp/bndg 0/RP0/CPU0 t4062  [BNDG]:339: VRF(0x60000000): Prefix(5.5.5.5/32): Remove label 0 from peer 5.5.5.5:0
Sep  9 22:30:06.049 mpls/ldp/bndg 0/RP0/CPU0 t4062  [BNDG]:279: VRF(0x60000000): Prefix(5.5.5.5/32): Add label 3 from peer 5.5.5.5:0

STEP 0 PE1 - P1間のキャプチャー全体をダウンロード

STEP 0 P2 - PE2間のキャプチャー全体をダウンロード

STEP 1 PE1 - P1間のキャプチャー全体をダウンロード

STEP 1 P2 - PE2間のキャプチャー全体をダウンロード

検証Configおよびshow結果

各STEPで8台すべてから、次の種類をルータごとに分けて取得しています。検証Configはこの..._run.txtです(最終状態はSTEP 2のもの)。

ファイル内容
..._show.txtshow version / show interface description / show route / show route ospf / show ospf / show ospf interface brief / show ospf neighbor / show ospf database / show mpls interfaces / show mpls ldp neighbor / show mpls ldp neighbor detail / show mpls ldp discovery / show mpls ldp interface / show mpls ldp bindings / show mpls ldp forwarding / show mpls ldp parameters / show mpls ldp summary / show mpls ldp statistics msg-counters / show mpls forwarding / show mpls forwarding detail / show mpls label range / show mpls label table detail / show cef <プレフィックス> detail。PEはこれにshow bgp系(show bgp summary / show bgp / show bgp neighbors / ピアごとのadvertised-routes / routes / received routes)とVPN系(show vrf CUST-A detail / show route vrf CUST-A / show bgp vpnv4 unicast summary / show bgp vpnv4 unicast / show bgp vrf CUST-A summary / show bgp vrf CUST-A / show bgp vrf CUST-A <プレフィックス> / show bgp vrf CUST-A neighbors / show cef vrf CUST-A <プレフィックス> detail)を足し、CEはBGP系のみ
..._log.txtそのSTEPの範囲だけに絞ったshow logging(STEP 0のみ起動時からの全履歴)
..._run.txtそのSTEP時点のshow running-config(=そのSTEPの検証Config)
..._trace.txtコア4台のみ。show mpls ldp trace binding / peer / discovery / route / forwardingshow mpls lsd trace

STEP 0:初期状態(implicit-null)

ルータshow出力syslogrunning-configtrace
CE1showlogrun
PE1showlogruntrace
P1showlogruntrace
P2showlogruntrace
PE2showlogruntrace
CE2showlogrun
CE3showlogrun
CE4showlogrun

STEP 1:PE2にlabel local advertise explicit-null

ルータshow出力syslogrunning-configtrace
CE1showlogrun
PE1showlogruntrace
P1showlogruntrace
P2showlogruntrace
PE2showlogruntrace
CE2showlogrun
CE3showlogrun
CE4showlogrun

STEP 2:explicit-nullを削除(最終状態)

ルータshow出力syslogrunning-configtrace
CE1showlogrun
PE1showlogruntrace
P1showlogruntrace
P2showlogruntrace / 5.5.5.5/32のみ
PE2showlogruntrace
CE2showlogrun
CE3showlogrun
CE4showlogrun

参考

RFCタイトル概要
RFC 3032MPLS Label Stack Encodingラベルスタックエントリの形式、予約ラベル0〜3、TTLの処理、EtherType。
RFC 5462Multiprotocol Label Switching (MPLS) Label Stack Entry: “EXP” Field Renamed to “Traffic Class” FieldEXPフィールドをTraffic Classフィールドに改名。
RFC 4182Removing a Restriction on the use of MPLS Explicit NULLExplicit NULLをボトム以外にも置けるようにした改訂。
RFC 3031Multiprotocol Label Switching ArchitecturePHP(3.16節)。

予約ラベルの一覧: IANA Special-Purpose MPLS Label Values

書籍: Luc De Ghein『MPLS Fundamentals』(Cisco Press, 2006)Chapter 2〜3

関連記事