MPLS经典问题利用MPLS解决和避免bgp路由黑洞问题
R1---(R2---R3---R4)--R5
|__EBGP__|_____IBGP______|__EBGP_|
12.0/24 23.0/24 34.0/24 45.0/24
R2-R4是MPLS域
在R2和R4上重分布直连面向EBGP邻居的接口
使用R1和R5上的loopback1做为internet路由
r1#sh ip b
BGP table version is 7, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 11.11.11.11/32 0.0.0.0 0 32768 i
*> 55.55.55.55/32 192.168.12.2 0 1 3 i
*> 192.168.12.0 192.168.12.2 0 0 1 ?
*> 192.168.45.0 192.168.12.2 0 1 ?
r5#sh ip b
BGP table version is 7, local router ID is 5.5.5.5
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 11.11.11.11/32 192.168.45.4 0 1 2 i
*> 55.55.55.55/32 0.0.0.0 0 32768 i
*> 192.168.12.0 192.168.45.4 0 1 ?
*> 192.168.45.0 192.168.45.4 0 0 1 ?
-------------------------------
r2# sh ip b
BGP table version is 5, local router ID is 2.2.2.2
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
r RIB-failure
Origin codes: i - IGP, e - EGP, ? - incomplete
Network Next Hop Metric LocPrf Weight Path
*> 11.11.11.11/32 192.168.12.1 0 0 2 i
*>i55.55.55.55/32 192.168.45.5 0 100 0 3 i
*> 192.168.12.0 0.0.0.0 0 32768 ?
*>i192.168.45.0 4.4.4.4 0 100 0 ?
r2#sh ip route
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/129] via 192.168.23.3, 01:26:32, Serial2/0
r2查找路由表,发现i55.55.55.55/32是一条bgp路由,而mpls不会为从bgp收到的路由分配标签,它再次查找,发现 i55.55.55.55/32的下一跳地址是192.168.45.5,同理,再次查找路由表,终于发现4.4.4.4是一条IGP路由,正好R3给4.4.4.4分配了一个301的标签给R2,这时候,最无耻的事情发生了,R2将这个标签copy到CEF表里面关于到55.55.55.55和192.168.45.0/24,的压入标签里面,也就是所有从192.168.45.5收到的bgp路由都有这种行为,如下所示:
r2#show ip cef detail
4.4.4.4/32, version 10, epoch 0, cached adjacency to Serial2/0
0 packets, 0 bytes
tag informationset, shared
local tag: 201
fast tag rewrite with Se2/0, point2point, tags imposed: {301}
via 192.168.23.3, Serial2/0, 1 dependency
next hop 192.168.23.3, Serial2/0
valid cached adjacency
tag rewrite with Se2/0, point2point, tags imposed: {301}
55.55.55.55/32, version 19, epoch 0, cached adjacency to Serial2/0
0 packets, 0 bytes
tag information from 4.4.4.4/32, shared
local tag: 201
fast tag rewrite with Se2/0, point2point, tags imposed: {301}
via 192.168.45.5, 0 dependencies, recursive
next hop 192.168.23.3, Serial2/0 via 192.168.45.0/24
valid cached adjacency
tag rewrite with Se2/0, point2point, tags imposed: {301}
192.168.45.0/24, version 18, epoch 0, cached adjacency to Serial2/0
0 packets, 0 bytes
tag information from 4.4.4.4/32, shared
local tag: 201
fast tag rewrite with Se2/0, point2point, tags imposed: {301}
via 4.4.4.4, 1 dependency, recursive
next hop 192.168.23.3, Serial2/0 via 4.4.4.4/32
valid cached adjacency
tag rewrite with Se2/0, point2point, tags imposed: {301}
------------------------------------
路由器不会对从bgp收到的路由分配标签,所以在这里看不到55.55.55.55/32的标签绑定
r2#sho tag tdp bind
tib entry: 2.2.2.2/32, rev 4
local binding: tag: imp-null
remote binding: tsr: 3.3.3.3:0, tag: 300
tib entry: 3.3.3.3/32, rev 6
local binding: tag: 200
remote binding: tsr: 3.3.3.3:0, tag: imp-null
tib entry: 4.4.4.4/32, rev 8
local binding: tag: 201
remote binding: tsr: 3.3.3.3:0, tag: 301
tib entry: 192.168.12.0/24, rev 2
local binding: tag: imp-null
tib entry: 192.168.23.0/24, rev 10
local binding: tag: imp-null
remote binding: tsr: 3.3.3.3:0, tag: imp-null
tib entry: 192.168.34.0/24, rev 12
local binding: tag: 202
remote binding: tsr: 3.3.3.3:0, tag: imp-null
当R3收到带有301标签的mpls packet的时候,根据自己的标签转发表,进行次末跳弹出,下一跳是4.4.4.4/32,而4.4.4.4/32已经具有internet路由,所以它可以正常转发
r3#show tag-switching forwarding-table
Local Outgoing Prefix Bytes tag Outgoing Next Hop
tag tag or VC or Tunnel Id switched interface
300 Pop tag 2.2.2.2/32 4061 Se2/0 point2point
301 Pop tag 4.4.4.4/32 4457 Se1/0 point2point
而这时候,在R3上不存在55.55.55.55/32路由
r3#sh ip rou
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
2.0.0.0/32 is subnetted, 1 subnets
O 2.2.2.2 [110/65] via 192.168.23.2, 00:28:23, Serial2/0
3.0.0.0/32 is subnetted, 1 subnets
C 3.3.3.3 is directly connected, Loopback0
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/65] via 192.168.34.4, 00:28:23, Serial1/0
C 192.168.23.0/24 is directly connected, Serial2/0
C 192.168.34.0/24 is directly connected, Serial1/0
这就是利用mpls来避免bgp的路由黑洞问题,应该是说清楚了吧?^_^
文章录入:csh 责任编辑:csh