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)が有効になっていることを確認してください。

Copy
  1. R1#show mpls interfaces
  2. Interface IP Tunnel Operational
  3. FastEthernet0/0.12 Yes (ldp) No Yes

show mpls ldp neighbor

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

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

show mpls ldp bindings

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

Copy
  1. R1#show mpls ldp bindings
  2. tib entry: 1.1.1.1/32, rev 4
  3. local binding: tag: imp-null
  4. remote binding: tsr: 2.2.2.2:0, tag: 16
  5. tib entry: 2.2.2.2/32, rev 6
  6. local binding: tag: 16
  7. remote binding: tsr: 2.2.2.2:0, tag: imp-null
  8. tib entry: 3.3.3.3/32, rev 8
  9. local binding: tag: 17
  10. remote binding: tsr: 2.2.2.2:0, tag: 17
  11. tib entry: 4.4.4.4/32, rev 10
  12. local binding: tag: 18
  13. remote binding: tsr: 2.2.2.2:0, tag: 18
  14. tib entry: 192.168.12.0/24, rev 2
  15. local binding: tag: imp-null
  16. remote binding: tsr: 2.2.2.2:0, tag: imp-null
  17. tib entry: 192.168.23.0/24, rev 12
  18. local binding: tag: 19
  19. remote binding: tsr: 2.2.2.2:0, tag: imp-null
  20. tib entry: 192.168.34.0/24, rev 14
  21. local binding: tag: 20
  22. remote binding: tsr: 2.2.2.2:0, tag: 19

show mpls forwarding-table

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

Copy
  1. R1#show mpls forwarding-table
  2. Local Outgoing Prefix Bytes tag Outgoing Next Hop
  3. tag tag or VC or Tunnel Id switched interface
  4. 16 Pop tag 2.2.2.2/32 0 Fa0/0.12 192.168.12.2
  5. 17 17 3.3.3.3/32 0 Fa0/0.12 192.168.12.2
  6. 18 18 4.4.4.4/32 0 Fa0/0.12 192.168.12.2
  7. 19 Pop tag 192.168.23.0/24 0 Fa0/0.12 192.168.12.2
  8. 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をつけると、ラベルを付加する必要がある場合はラベル情報も表示されます。

Copy
  1. R1#show ip cef
  2. Prefix Next Hop Interface
  3. 0.0.0.0/32 receive
  4. 1.1.1.1/32 receive
  5. 2.2.2.2/32 192.168.12.2 FastEthernet0/0.12
  6. 3.3.3.3/32 192.168.12.2 FastEthernet0/0.12
  7. 4.4.4.4/32 192.168.12.2 FastEthernet0/0.12
  8. 192.168.12.0/24 attached FastEthernet0/0.12
  9. 192.168.12.0/32 receive
  10. 192.168.12.1/32 receive
  11. 192.168.12.2/32 192.168.12.2 FastEthernet0/0.12
  12. 192.168.12.255/32 receive
  13. 192.168.23.0/24 192.168.12.2 FastEthernet0/0.12
  14. 192.168.34.0/24 192.168.12.2 FastEthernet0/0.12
  15. 224.0.0.0/4 drop
  16. 224.0.0.0/24 receive
  17. 255.255.255.255/32 receive
  18. R1#show ip cef detail
  19. IP CEF with switching (Table Version 12), flags=0x0
  20. 12 routes, 0 reresolve, 0 unresolved (0 old, 0 new), peak 0
  21. 15 leaves, 23 nodes, 25720 bytes, 15 inserts, 0 invalidations
  22. 0 load sharing elements, 0 bytes, 0 references
  23. universal per-destination load sharing algorithm, id BCB9E1FF
  24. 2(0) CEF resets, 0 revisions of existing leaves
  25. Resolution Timer: Exponential (currently 1s, peak 1s)
  26. 0 in-place/0 aborted modifications
  27. refcounts: 810 leaf, 813 node
  28.  
  29. Adjacency Table has 2 adjacencies
  30. 0.0.0.0/32, version 0, receive
  31. 1.1.1.1/32, version 4, connected, receive
  32. tag information set
  33. local tag: implicit-null
  34. 2.2.2.2/32, version 6, cached adjacency 192.168.12.2
  35. 0 packets, 0 bytes
  36. tag information set
  37. local tag: 16
  38. via 192.168.12.2, FastEthernet0/0.12, 0 dependencies
  39. next hop 192.168.12.2, FastEthernet0/0.12
  40. valid cached adjacency
  41. tag rewrite with Fa0/0.12, 192.168.12.2, tags imposed: {}
  42. 3.3.3.3/32, version 7, cached adjacency 192.168.12.2
  43. 0 packets, 0 bytes
  44. tag information set
  45. local tag: 17
  46. fast tag rewrite with Fa0/0.12, 192.168.12.2, tags imposed: {17}
  47. via 192.168.12.2, FastEthernet0/0.12, 0 dependencies
  48. next hop 192.168.12.2, FastEthernet0/0.12
  49. valid cached adjacency
  50. tag rewrite with Fa0/0.12, 192.168.12.2, tags imposed: {17}
  51. 4.4.4.4/32, version 8, cached adjacency 192.168.12.2
  52. 0 packets, 0 bytes
  53. tag information set
  54. local tag: 18
  55. fast tag rewrite with Fa0/0.12, 192.168.12.2, tags imposed: {18}
  56. via 192.168.12.2, FastEthernet0/0.12, 0 dependencies
  57. next hop 192.168.12.2, FastEthernet0/0.12
  58. valid cached adjacency
  59. tag rewrite with Fa0/0.12, 192.168.12.2, tags imposed: {18}
  60. ~省略~