1. 一些基本概念
FIB:转发信息库,这是开启CEF后形成的一个表,这个表结合了路由表,ARP表,它使得数据包转发的时候不需要再查询路由表,不再需要递归路由查询,直接根据FIB转发即可。注意:由于Cisco CEF是唯一使用FIB表的第三层交换机制,运行MPLS首先就要开启ip cef。
LIB:标签信息库,这张表里面保存了FEC对应的所有标签信息,使用show mpls ip binding查看
LFIB:标签转发信息库,这张表是当前正在使用的标签信息,使用show mpls forward查看
LSR:标签交换路由器,就是启用了标签交换的路由器。
2. 实验演示
1) 拓扑
2) 基础配置
R1#sh ip int brief
R1#sh run | b router eigrp 10
3) 验证网络建立情况
R2#sh ip eigrp 10 nei
IP-EIGRP neighbors for process 10
H Address Interface Hold Uptime SRTT RTO Q Seq
(sec) (ms) Cnt Num
1 23.1.1.3 Se0/1 12 00:08:34 82 492 0 10
0 12.1.1.1 Se0/0 10 00:09:01 101 606 0 3
R2#sh ip route eigrp 10
D 34.1.1.0 [90/2681856] via 23.1.1.3, 00:08:40, Serial0/1
D 1.1.1.1 [90/2297856] via 12.1.1.1, 00:09:08, Serial0/0
D 3.3.3.3 [90/2297856] via 23.1.1.3, 00:08:37, Serial0/1
D 4.4.4.4 [90/2809856] via 23.1.1.3, 00:08:21, Serial0/1
R2(tcl)#foreach address {
+>(tcl)#1.1.1.1
+>(tcl)#2.2.2.2
+>(tcl)#} {
+>(tcl)#ping $address source loopback 0
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/41/52 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 3.3.3.3, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/36/64 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 4.4.4.4, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/68/80 ms
4) 建立MPSL网络
1. 首先启用CEF,这个是必须的。
2. 定义标签交换使用的协议。
3. 定义标签的范围。
4. 定义建立LDP对等体使用的接口(TDP/LDP都是基于TCP来建立对等体的,与BGP一样,安全可靠,建议使用loopback接口,因为永远不会当掉)。
5. 在接口下启用mpls。
6. 验证邻居建立情况。
7. 查看FIB,LFIB。
8. 测试标签交换。
mpls label protocol ldp
mpls label range 100 199
mpls ldp router-id Loopback0 force
interface Serial0/0
Peer LDP Ident: 1.1.1.1:0; Local LDP Ident 2.2.2.2:0
TCP connection: 1.1.1.1.646 - 2.2.2.2.39114
State: Oper; Msgs sent/rcvd: 23/23; Downstream
Peer LDP Ident: 3.3.3.3:0; Local LDP Ident 2.2.2.2:0
TCP connection: 3.3.3.3.24687 - 2.2.2.2.646
State: Oper; Msgs sent/rcvd: 22/23; Downstream
TCP connection: 1.1.1.1.646 - 2.2.2.2.39114
Addresses bound to peer LDP Ident:
12.1.1.1 1.1.1.1
R1#sh mpls ldp bindings
remote binding: tsr: 2.2.2.2:0, tag: 201
remote binding: tsr: 2.2.2.2:0, tag: imp-null
remote binding: tsr: 2.2.2.2:0, tag: 202
remote binding: tsr: 2.2.2.2:0, tag: 203
remote binding: tsr: 2.2.2.2:0, tag: imp-null
remote binding: tsr: 2.2.2.2:0, tag: imp-null
remote binding: tsr: 2.2.2.2:0, tag: 200
local binding: tag: imp-null
remote binding: tsr: 2.2.2.2:0, tag: 201
Local bingding:tag: imp-null本地绑定为空
*Mar 1 01:18:20.291: tagcon: peer 1.1.1.1:0 (pp 0x64962BDC): advertise 2.2.2.2/32(Default-IP-Routing-Table), label 3 (imp-null) (#6)
这个标签值是3.这个标签代表一个空标签,pop tag就是根据这个标签值来实现的。详细的内容会在后面的有讲述。
Remote binding:tsr: 2.2.2.2:0, tag: 201 远程绑定:标签交换路由器(tsr):2.2.2.2,打标签201
R2#sh mpls ip bind
in label: 201
out label: imp-null lsr: 1.1.1.1:0 inuse
out label: 30 lsr: 3.3.3.3:0
tib entry: 2.2.2.2/32, rev 6
local binding: tag: 101
remote binding: tsr: 2.2.2.2:0, tag: imp-null
local binding: tag: 102
remote binding: tsr: 2.2.2.2:0, tag: 202
R2#sh mpls forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
200 Pop tag 34.1.1.0/24 0 Se0/1 point2point
201 Pop tag 1.1.1.1/32 0 Se0/0 point2point
202 Pop tag 3.3.3.3/32 0 Se0/1 point2point
203 32 4.4.4.4/32 0 Se0/1 point2point
*Mar 1 01:18:20.291: tagcon: peer 1.1.1.1:0 (pp 0x64962BDC): advertise 2.2.2.2/32(Default-IP-Routing-Table), label 3 (imp-null) (#6)
4.4.4.4/32, version 21, epoch 0, cached adjacency to Serial0/1
tag information set
local tag: 203
fast tag rewrite with Se0/1, point2point, tags imposed: {32}
via 23.1.1.3, Serial0/1, 0 dependencies
next hop 23.1.1.3, Serial0/1
valid cached adjacency
tag rewrite with Se0/1, point2point, tags imposed: {32}
1 12.1.1.2 [MPLS: Label 203 Exp 0] 148 msec 72 msec 112 msec
2 23.1.1.3 [MPLS: Label 32 Exp 0] 140 msec 72 msec 112 msec
108 203 4.4.4.4/32 0 Se0/0 point2point
203 32 4.4.4.4/32 432 Se0/1 point2point
32 Pop tag 4.4.4.4/32 1224 Se0/2 point2point