MPLSによるラベルスイッチングの設定手順

MPLSのラベルをLDPで配布して、IPパケットをラベルスイッチングするための設定の手順は以下の2つです。

  1. CEFの有効化
  2. インタフェースでラベルスイッチングを有効化

基本的な設定はこの2つだけでOKです。

MPLSの設定コマンド

CEFの有効化

Ciscoルータでは、MPLSのラベルスイッチングを行うにはCEFが有効化されていることが前提です。CEFを有効にするには、グローバルコンフィグレーションモードで次のコマンドを入力します。

CEFの有効化(config)#ip cef

なお、デフォルトでCEFは有効になっているのでこのコマンドをあらためて入力する必要はありません。CEFを有効にすると、FIBテーブルを作成してCEFスイッチングが有効になります。

インタフェースでラベルスイッチングを有効化

ラベルスイッチングを行うインタフェースでラベルスイッチングを有効にします。インタフェースコンフィグレーションモードで次のコマンドを入力します。

インタフェースでラベルスイッチングを有効化(config)#interface <interface-name>
(config-if)#mpls ip

<interface-name> : インタフェース名

この設定によって、インタフェースでLDP(Label Distribution Protocol)が有効化されます。そして、LDPネイバーを確立してルーティングテーブルのエントリに対するラベルを割り当て、LDPネイバー間で配布します。

MPLSの確認コマンド

MPLSによるラベルスイッチングを確認するための主なshowコマンドを以下の表にまとめています。

コマンド内容
#show mpls interfaceMPLSが有効化されているインタフェースを表示します。
#show mpls ldp neighborLDPネイバーを表示します。
#show mpls ldp bindingsLDPで割り当てているラベル情報を表示します。
#show mpls forwarding-tableラベル付きパケットを転送するためのLFIBテーブルを表示します。
#show ip cef [detail]IPパケットを転送するためのFIBテーブルを表示します。

show mpls interface

show mpls interfaceコマンドで、MPLSが有効になっているインタフェースを表示します。ラベルスイッチングを行うインタフェースすべてでMPLS(LDP)が有効になっていることを確認してください。

R1#show mpls interfaces
Interface              IP            Tunnel   Operational
FastEthernet0/0.12     Yes (ldp)     No       Yes

show mpls ldp neighbor

show mpls ldp neighborコマンドでLDPネイバーを表示します。ラベルスイッチングを行うLSRとの間で正しくネイバーを確立できていることを確認します。

R1#show mpls ldp neighbor
    Peer LDP Ident: 2.2.2.2:0; Local LDP Ident 1.1.1.1:0
        TCP connection: 2.2.2.2.43869 - 1.1.1.1.646
        State: Oper; Msgs sent/rcvd: 12/11; Downstream
        Up time: 00:01:31
        LDP discovery sources:
          FastEthernet0/0.12, Src IP addr: 192.168.12.2
        Addresses bound to peer LDP Ident:
          192.168.12.2    192.168.23.2    2.2.2.2

show mpls ldp bindings

show mpls ldp bindingsコマンドでLDPで割り当て配布したラベル情報を表示します。

R1#show mpls ldp bindings
  tib entry: 1.1.1.1/32, rev 4
	local binding:  tag: imp-null
	remote binding: tsr: 2.2.2.2:0, tag: 16
  tib entry: 2.2.2.2/32, rev 6
	local binding:  tag: 16
	remote binding: tsr: 2.2.2.2:0, tag: imp-null
  tib entry: 3.3.3.3/32, rev 8
	local binding:  tag: 17
	remote binding: tsr: 2.2.2.2:0, tag: 17
  tib entry: 4.4.4.4/32, rev 10
	local binding:  tag: 18
	remote binding: tsr: 2.2.2.2:0, tag: 18
  tib entry: 192.168.12.0/24, rev 2
	local binding:  tag: imp-null
	remote binding: tsr: 2.2.2.2:0, tag: imp-null
  tib entry: 192.168.23.0/24, rev 12
	local binding:  tag: 19
	remote binding: tsr: 2.2.2.2:0, tag: imp-null
  tib entry: 192.168.34.0/24, rev 14
	local binding:  tag: 20
	remote binding: tsr: 2.2.2.2:0, tag: 19

show mpls forwarding-table

show mpls forwarding-tableコマンドでMPLSラベル付きパケットを転送するためのLFIBテーブルを表示します。

R1#show mpls forwarding-table 
Local  Outgoing    Prefix            Bytes tag  Outgoing   Next Hop    
tag    tag or VC   or Tunnel Id      switched   interface              
16     Pop tag     2.2.2.2/32        0          Fa0/0.12   192.168.12.2 
17     17          3.3.3.3/32        0          Fa0/0.12   192.168.12.2 
18     18          4.4.4.4/32        0          Fa0/0.12   192.168.12.2 
19     Pop tag     192.168.23.0/24   0          Fa0/0.12   192.168.12.2 
20     19          192.168.34.0/24   0          Fa0/0.12   192.168.12.2

show ip cef [detail]

show ip cefコマンドは、通常のIPパケットを転送するためのFIBテーブルを表示します。detailをつけると、ラベルを付加する必要がある場合はラベル情報も表示されます。

R1#show ip cef 
Prefix              Next Hop             Interface
0.0.0.0/32          receive
1.1.1.1/32          receive
2.2.2.2/32          192.168.12.2         FastEthernet0/0.12
3.3.3.3/32          192.168.12.2         FastEthernet0/0.12
4.4.4.4/32          192.168.12.2         FastEthernet0/0.12
192.168.12.0/24     attached             FastEthernet0/0.12
192.168.12.0/32     receive
192.168.12.1/32     receive
192.168.12.2/32     192.168.12.2         FastEthernet0/0.12
192.168.12.255/32   receive
192.168.23.0/24     192.168.12.2         FastEthernet0/0.12
192.168.34.0/24     192.168.12.2         FastEthernet0/0.12
224.0.0.0/4         drop
224.0.0.0/24        receive
255.255.255.255/32  receive
R1#show ip cef detail 
IP CEF with switching (Table Version 12), flags=0x0
  12 routes, 0 reresolve, 0 unresolved (0 old, 0 new), peak 0
  15 leaves, 23 nodes, 25720 bytes, 15 inserts, 0 invalidations
  0 load sharing elements, 0 bytes, 0 references
  universal per-destination load sharing algorithm, id BCB9E1FF
  2(0) CEF resets, 0 revisions of existing leaves
  Resolution Timer: Exponential (currently 1s, peak 1s)
  0 in-place/0 aborted modifications
  refcounts:  810 leaf, 813 node

Adjacency Table has 2 adjacencies
0.0.0.0/32, version 0, receive
1.1.1.1/32, version 4, connected, receive
  tag information set
    local tag: implicit-null
2.2.2.2/32, version 6, cached adjacency 192.168.12.2
0 packets, 0 bytes
  tag information set
    local tag: 16
  via 192.168.12.2, FastEthernet0/0.12, 0 dependencies
    next hop 192.168.12.2, FastEthernet0/0.12
    valid cached adjacency
    tag rewrite with Fa0/0.12, 192.168.12.2, tags imposed: {}
3.3.3.3/32, version 7, cached adjacency 192.168.12.2
0 packets, 0 bytes
  tag information set
    local tag: 17
    fast tag rewrite with Fa0/0.12, 192.168.12.2, tags imposed: {17}
  via 192.168.12.2, FastEthernet0/0.12, 0 dependencies
    next hop 192.168.12.2, FastEthernet0/0.12
    valid cached adjacency
    tag rewrite with Fa0/0.12, 192.168.12.2, tags imposed: {17}
4.4.4.4/32, version 8, cached adjacency 192.168.12.2
0 packets, 0 bytes
  tag information set
    local tag: 18
    fast tag rewrite with Fa0/0.12, 192.168.12.2, tags imposed: {18}
  via 192.168.12.2, FastEthernet0/0.12, 0 dependencies
    next hop 192.168.12.2, FastEthernet0/0.12
    valid cached adjacency
    tag rewrite with Fa0/0.12, 192.168.12.2, tags imposed: {18}
~省略~