V0.1
2012-6-25
| Author | 顾赟 | TEL | |
| PHONE | Organization | ||
| LastUpdate | 2013-6-22 | ||
2 拓扑与需求 3
2.2 需求概述 3
3.2 配置MPLS 4
3.3 结果测试 5
3.3.1 查看LDP邻居 5
3.3.2 查看LDP接口 6
3.3.3 查看LIB 6
3.3.4 查看LFIB 9
3.3.5 查看跟踪路由 9
3.4 手工指定LDP RID 10
3.5 修改LDP Transport-Address 11
3.6 修改LDP Hello Time 12
3.7 修改LDP Hold Time 13
1 实验目的
1、理解MPLS LDP的基本原理及运作机制。
2 拓扑与需求
2.1 网络拓扑及地址规划
| 设备名称 | IP地址 | 接口 | 备注 |
| R1 | 12.1.1.1/24 | F0/0 | |
| 1.1.1.1/32 | Lo0 | ||
| R2 | 12.1.1.2/24 | F0/0 | |
| 23.1.1.2/24 | F1/0 | ||
| 2.2.2.2/32 | Lo0 | ||
| R3 | 23.1.1.3/24 | F1/0 | |
| 3.3.3.3/32 | Lo0 |
1、全网配置静态路由,再配置MPLS协议,并查看其结果。
、手工指定LDP RID、修改LDP Transport-Address、修改LDP Hello time、修改LDP Hold time,并查看其结果。
3 配置与实现
3.1 实验步骤
1、搭建拓扑,配置IP。
2、配置静态路由,保证全网畅通。
3、启用MPLS LDP协议。
4、手工指定LDP RID。
5、修改LDP Transport-Address。
6、修改LDP Hello time。
7、修改LDP Hold time。
3.2 配置MPLS
R1(config)#mpls label protocol ldp //将MPLS标签协议设为LDP,默认为LDP
R1(config)#mpls label range 100 199 //指定本地分配标签的范围
R1(config)#interface f0/0
R1(config-if)#mpls ip //指定MPLS协议,默认是LDP
R2(config)#mpls label range 200 299
R2(config)#interface f0/0
R2(config-if)#mpls ip
R2(config)#interface f1/0
R2(config-if)#mpls ip
R3(config)#mpls label range 300 399
R3(config)#interface f1/0
R3(config-if)#mpls ip
首先必须在全局下启用CEF,然后才能够在接口下启MPLS LDP。
标签值有20个比特位,所以除了被保留的标签值0到15以外,标签值16到1048575都可以用来进行普通报文转发。在Cisco的IOS中,默认的范围是16到100000,可以通过mpls label range命令来修改标签范围。
3.3 结果测试
3.3.1 查看LDP邻居
R1# show mpls ldp neighbor
Peer LDP Ident: 2.2.2.2:0; Local LDP Ident 1.1.1.1:0 //本地LDP ID(RID + 标签空间)
TCP connection: 2.2.2.2.25590 - 1.1.1.1.6
State: Oper; Msgs sent/rcvd: 12/12; Downstream
Up time: 00:03:43
LDP discovery sources:
FastEthernet0/0, Src IP addr: 12.1.1.2
Addresses bound to peer LDP Ident:
12.1.1.2 2.2.2.2 23.1.1.2
R2#show mpls ldp neighbor
Peer LDP Ident: 1.1.1.1:0; Local LDP Ident 2.2.2.2:0
TCP connection: 1.1.1.1.6 - 2.2.2.2.25590
State: Oper; Msgs sent/rcvd: 14/14; Downstream
Up time: 00:05:49
LDP discovery sources:
FastEthernet0/0, Src IP addr: 12.1.1.1
Addresses bound to peer LDP Ident:
12.1.1.1 1.1.1.1
Peer LDP Ident: 3.3.3.3:0; Local LDP Ident 2.2.2.2:0
TCP connection: 3.3.3.3.44602 - 2.2.2.2.6
State: Oper; Msgs sent/rcvd: 13/13; Downstream
Up time: 00:04:34
LDP discovery sources:
FastEthernet1/0, Src IP addr: 23.1.1.3
Addresses bound to peer LDP Ident:
23.1.1.3 3.3.3.3
R3#show mpls ldp neighbor
Peer LDP Ident: 2.2.2.2:0; Local LDP Ident 3.3.3.3:0
TCP connection: 2.2.2.2.6 - 3.3.3.3.44602
State: Oper; Msgs sent/rcvd: 13/13; Downstream
Up time: 00:05:01
LDP discovery sources:
FastEthernet1/0, Src IP addr: 23.1.1.2
Addresses bound to peer LDP Ident:
12.1.1.2 2.2.2.2 23.1.1.2
通过Hello消息(UDP端口6)发现对方,然后通过建立一个TCP会话(TCP端口6)在对等体之间通告标签映射信息。
3.3.2 查看LDP接口
R1#show mpls interfaces //查看哪些接口运行了LDP
Interface IP Tunnel Operational
FastEthernet0/0 Yes (ldp) No Yes
R2#show mpls interfaces
Interface IP Tunnel Operational
FastEthernet0/0 Yes (ldp) No Yes
FastEthernet1/0 Yes (ldp) No Yes
R3#show mpls interfaces
Interface IP Tunnel Operational
FastEthernet1/0 Yes (ldp) No Yes
3.3.3 查看LIB
R1#show mpls ldp bindings
tib entry: 1.1.1.1/32, rev 2
local binding: tag: imp-null //隐式空标签,用于倒数第二跳弹出(PHP)
remote binding: tsr: 2.2.2.2:0, tag: 200
tib entry: 2.2.2.2/32, rev 4
local binding: tag: 100
remote binding: tsr: 2.2.2.2:0, tag: imp-null
tib entry: 3.3.3.3/32, rev 6
local binding: tag: 101
remote binding: tsr: 2.2.2.2:0, tag: 201
tib entry: 12.1.1.0/24, rev 10
local binding: tag: imp-null
remote binding: tsr: 2.2.2.2:0, tag: imp-null
tib entry: 23.1.1.0/24, rev 8
local binding: tag: 102
remote binding: tsr: 2.2.2.2:0, tag: imp-null
R2#show mpls ldp bindings
tib entry: 1.1.1.1/32, rev 8
local binding: tag: 200
remote binding: tsr: 1.1.1.1:0, tag: imp-null
remote binding: tsr: 3.3.3.3:0, tag: 300
tib entry: 2.2.2.2/32, rev 4
local binding: tag: imp-null
remote binding: tsr: 1.1.1.1:0, tag: 100
remote binding: tsr: 3.3.3.3:0, tag: 301
tib entry: 3.3.3.3/32, rev 10
local binding: tag: 201
remote binding: tsr: 1.1.1.1:0, tag: 101
remote binding: tsr: 3.3.3.3:0, tag: imp-null
tib entry: 12.1.1.0/24, rev 6
local binding: tag: imp-null
remote binding: tsr: 1.1.1.1:0, tag: imp-null
remote binding: tsr: 3.3.3.3:0, tag: 302
tib entry: 23.1.1.0/24, rev 5
local binding: tag: imp-null
remote binding: tsr: 1.1.1.1:0, tag: 102
remote binding: tsr: 3.3.3.3:0, tag: imp-null
R3#show mpls ldp bindings
tib entry: 1.1.1.1/32, rev 2
local binding: tag: 300
remote binding: tsr: 2.2.2.2:0, tag: 200
tib entry: 2.2.2.2/32, rev 4
local binding: tag: 301
remote binding: tsr: 2.2.2.2:0, tag: imp-null
tib entry: 3.3.3.3/32, rev 6
local binding: tag: imp-null
remote binding: tsr: 2.2.2.2:0, tag: 201
tib entry: 12.1.1.0/24, rev 10
local binding: tag: 302
remote binding: tsr: 2.2.2.2:0, tag: imp-null
tib entry: 23.1.1.0/24, rev 8
local binding: tag: imp-null
remote binding: tsr: 2.2.2.2:0, tag: imp-null
R1#show mpls ip binding //另一条查看LIB命令
1.1.1.1/32
in label: imp-null //本地捆绑的标签
out label: 200 lsr: 2.2.2.2:0 //远程捆绑的标签
2.2.2.2/32
in label: 100
out label: imp-null lsr: 2.2.2.2:0 inuse //正被LFIB所使用的标签
3.3.3.3/32
in label: 101
out label: 201 lsr: 2.2.2.2:0 inuse
12.1.1.0/24
in label: imp-null
out label: imp-null lsr: 2.2.2.2:0
23.1.1.0/24
in label: 102
out label: imp-null lsr: 2.2.2.2:0 inuse
R2#show mpls ip binding
1.1.1.1/32
in label: 200
out label: imp-null lsr: 1.1.1.1:0 inuse
out label: 300 lsr: 3.3.3.3:0
2.2.2.2/32
in label: imp-null
out label: 100 lsr: 1.1.1.1:0
out label: 301 lsr: 3.3.3.3:0
3.3.3.3/32
in label: 201
out label: 101 lsr: 1.1.1.1:0
out label: imp-null lsr: 3.3.3.3:0 inuse
12.1.1.0/24
in label: imp-null
out label: imp-null lsr: 1.1.1.1:0
out label: 302 lsr: 3.3.3.3:0
23.1.1.0/24
in label: imp-null
out label: 102 lsr: 1.1.1.1:0
out label: imp-null lsr: 3.3.3.3:0
R3#show mpls ip binding
1.1.1.1/32
in label: 300
out label: 200 lsr: 2.2.2.2:0 inuse
2.2.2.2/32
in label: 301
out label: imp-null lsr: 2.2.2.2:0 inuse
3.3.3.3/32
in label: imp-null
out label: 201 lsr: 2.2.2.2:0
12.1.1.0/24
in label: 302
out label: imp-null lsr: 2.2.2.2:0 inuse
23.1.1.0/24
in label: imp-null
out label: imp-null lsr: 2.2.2.2:0
3.3.4 查看LFIB
R1#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
100 Pop tag 2.2.2.2/32 0 Fa0/0 12.1.1.2
101 201 3.3.3.3/32 0 Fa0/0 12.1.1.2
102 Pop tag 23.1.1.0/24 0 Fa0/0 12.1.1.2
R2#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
200 Pop tag 1.1.1.1/32 0 Fa0/0 12.1.1.1
201 Pop tag 3.3.3.3/32 570 Fa1/0 23.1.1.3
R3#show mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
300 200 1.1.1.1/32 0 Fa1/0 23.1.1.2
301 Pop tag 2.2.2.2/32 0 Fa1/0 23.1.1.2
302 Pop tag 12.1.1.0/24 0 Fa1/0 23.1.1.2
3.3.5 查看跟踪路由
R1#traceroute 3.3.3.3 source 1.1.1.1
Type escape sequence to abort.
Tracing the route to 3.3.3.3
1 12.1.1.2 [MPLS: Label 201 Exp 0] 84 msec msec 56 msec
2 23.1.1.3 100 msec * msec
R3#traceroute 1.1.1.1 source 3.3.3.3
Type escape sequence to abort.
Tracing the route to 1.1.1.1
1 23.1.1.2 [MPLS: Label 200 Exp 0] 48 msec msec msec
2 12.1.1.1 60 msec * 68 msec
3.4 手工指定LDP RID
R3(config)#mpls ldp router-id f1/0 force //强制指定LDP RID
R3(config)#
*Mar 1 02:07:59.307: %TDP-5-INFO: Default-IP-Routing-Table: TDP ID removed
*Mar 1 02:07:59.311: %LDP-5-NBRCHG: LDP Neighbor 2.2.2.2:0 (1) is DOWN (LDP Router ID changed)
R3(config)#
*Mar 1 02:08:04.423: %LDP-5-NBRCHG: LDP Neighbor 2.2.2.2:0 (1) is UP
R3#show mpls ldp discovery detail //显示所有的MPLS-enabled接口以及它们的邻居
Local LDP Identifier:
23.1.1.3:0 //LDP RID已经强制更改为F1/0接口地址
Discovery Sources:
Interfaces:
FastEthernet1/0 (ldp): xmit/recv
Enabled: Interface config
Hello interval: 5000 ms; Transport IP addr: 23.1.1.3 //用于建立TCP连接,发送Hello包的地址
LDP Id: 2.2.2.2:0
Src IP addr: 23.1.1.2; Transport IP addr: 2.2.2.2
Hold time: 15 sec; Proposed local/peer: 15/15 sec
Reachable via 2.2.2.2/32
运行LDP的路由器(LSR)都有一个LDP 路由器标识符(RID)。这个LDP RID是一个6字节的字段,其中包含4字节用来唯一标识该LSR的标识符(IP地址)和2字节用于标识LSR的标签空间。最后2个字节若为0,则是基于每台设备的标签空间;如果不为0,则是基于每个接口的标签空间。基于每个接口的标签空间是使用在LC-ATM链路。
LDP RID的选举规则如下:
(1)如果由mpls ldp router-id命令指定了某个接口的地址作为RID,且该接口有IP地址、处于UP状态,则用该接口作为RID;
否则,如果有配了IP地址的Loopback接口,用所有Loopback 接口的IP地址中最大的IP地址作为RID;
再则,选取所有配了IP地址、处于UP状态的接口的IP地址中最大的IP地址作为RID。
(2)如果没有force可选参数,mpls ldp router-id命令指定的RID要到下一次路由器ID选举时才生效。路由器ID选举会发生在如下情况:
(A)LDP重启动;
(B)当前RID的接口关闭(shut down);
(C)当前RID的接口地址被删除。
(3)当带有force可选参数时,mpls ldp router-id命令的效果取决于所指定接口的当前状态:
如果指定的接口处UP于状态,而且其地址不是当前的RID,路由器强制将RID改变为指定值,同时中断所有当前的会话,释放由会话学习到的标签,中断与这些标签绑定有关的MPLS转发;
如果指定的接口处于Down状态,一旦其变为UP状态,路由器强制将RID改变为指定值,同时中断所有当前的会话,释放由会话学习到的标签,中断与这些标签绑定有关的MPLS转发。
注:LDP RID必须可达才能建立TCP会话。
3.5 修改LDP Transport-Address
R3(config-if)#mpls ldp discovery transport-address 3.3.3.3
R3(config-if)#
*Mar 1 02:17:50.571: %LDP-5-NBRCHG: LDP Neighbor 2.2.2.2:0 (1) is DOWN (Received error notification from peer: Holddown time expir)
R3(config-if)#
*Mar 1 02:17:57.619: %LDP-5-NBRCHG: LDP Neighbor 2.2.2.2:0 (1) is UP
R3#show mpls ldp discovery detail
Local LDP Identifier:
23.1.1.3:0
Discovery Sources:
Interfaces:
FastEthernet1/0 (ldp): xmit/recv
Enabled: Interface config
Hello interval: 5000 ms; Transport IP addr: 3.3.3.3
LDP Id: 2.2.2.2:0
Src IP addr: 23.1.1.2; Transport IP addr: 2.2.2.2
Hold time: 15 sec; Proposed local/peer: 15/15 sec
Reachable via 2.2.2.2/32
会话时在两台LSR的Transport IP地址之间建立起来的TCP连接,通常这些Transport IP地址都是LDP RID的IP地址。当然,可以在路由器接口上也可对其进行修改,这个Transport IP地址将包含在LDP的Hello消息中,并且从启用了LDP的接口发送出去。
3.6 修改LDP Hello Time
R1(config)#mpls ldp discovery hello interval 4 //修改LDP Hello间隔,默认为5秒
R1#show mpls ldp discovery detail
Local LDP Identifier:
23.1.1.3:0
Discovery Sources:
Interfaces:
FastEthernet1/0 (ldp): xmit/recv
Enabled: Interface config
Hello interval: 4000 ms; Transport IP addr: 3.3.3.3
LDP Id: 2.2.2.2:0
Src IP addr: 23.1.1.2; Transport IP addr: 2.2.2.2
Hold time: 15 sec; Proposed local/peer: 15/15 sec
Reachable via 2.2.2.2/32
R2#show mpls ldp discovery detail
Local LDP Identifier:
2.2.2.2:0
Discovery Sources:
Interfaces:
FastEthernet0/0 (ldp): xmit/recv
Enabled: Interface config
Hello interval: 5000 ms; Transport IP addr: 2.2.2.2
LDP Id: 1.1.1.1:0
Src IP addr: 12.1.1.1; Transport IP addr: 1.1.1.1
Hold time: 15 sec; Proposed local/peer: 15/15 sec
Reachable via 1.1.1.1/32
FastEthernet1/0 (ldp): xmit/recv
Enabled: Interface config
Hello interval: 5000 ms; Transport IP addr: 2.2.2.2
LDP Id: 3.3.3.3:0
Src IP addr: 23.1.1.3; Transport IP addr: 3.3.3.3
Hold time: 15 sec; Proposed local/peer: 15/15 sec
Reachable via 3.3.3.3/32
修改LDP Hello Time之后,Hold Time不会自动更改。同时,邻居的LDP Hello Time和Hold Time不会被更改。如果Hello Time修改超过5秒,将视为无效。
3.7 修改LDP Hold Time
R3(config)#mpls ldp discovery hello holdtime 9 //修改LDP Hold time,默认为15秒
R3#show mpls ldp discovery detail
Local LDP Identifier:
3.3.3.3:0
Discovery Sources:
Interfaces:
FastEthernet1/0 (ldp): xmit/recv
Enabled: Interface config
Hello interval: 3000 ms; Transport IP addr: 3.3.3.3
LDP Id: 2.2.2.2:0
Src IP addr: 23.1.1.2; Transport IP addr: 2.2.2.2
Hold time: 9 sec; Proposed local/peer: 9/15 sec
Reachable via 2.2.2.2/32
R2#show mpls ldp discovery detail
Local LDP Identifier:
2.2.2.2:0
Discovery Sources:
Interfaces:
FastEthernet0/0 (ldp): xmit/recv
Enabled: Interface config
Hello interval: 5000 ms; Transport IP addr: 2.2.2.2
LDP Id: 1.1.1.1:0
Src IP addr: 12.1.1.1; Transport IP addr: 1.1.1.1
Hold time: 15 sec; Proposed local/peer: 15/15 sec
Reachable via 1.1.1.1/32
FastEthernet1/0 (ldp): xmit/recv
Enabled: Interface config
Hello interval: 3000 ms; Transport IP addr: 2.2.2.2
LDP Id: 3.3.3.3:0
Src IP addr: 23.1.1.3; Transport IP addr: 3.3.3.3
Hold time: 9 sec; Proposed local/peer: 15/9 sec
Reachable via 3.3.3.3/32
修改LDP Hold Time之后,Hello Time会自动修改。同时,邻居的LDP Hello Time和Hold Time也会随之同步。即如果双方LDP计时器部不一致,则取小值。下载本文