MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

说明

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

在Open C解决方案中提出了RR的概念,它跟IPV4 BGP的RR功能一样,也是解决水平分割的问题,可能这图并不明显,但是在现网中肯定存在多个IBGP邻居关系,所以RR是有必要的,Open C是利用RR之间建立一个MPBGP会话,RR负责传递客户的路由信息,这样ASBR的工作量就减轻了许多,如果这张网也存在internet的话,那么就只需要传递Intenet的路由,可以看出来分工很明确。

需要解决的问题,RR建立MPBGP EBGP邻居关系,那么肯定需要指定对方的地址信息,这里建议使用loopback口建立MPEBGP,是因为在内网中肯定是有冗余的,用接口建立的话,那么很有可能这个接口Down了就会话被终止了。

另外分析下,假设一条路由从AS1 RR传递给AS2 RR,那么肯定会分配一个内层标签给AS RR,因为下一跳改变了,那么外层标签怎么来,AS2 RR看到的下一跳是AS1 RR的更新源地址,那么就需要ASBR之间来完成了,可以使用IGP+LDP或者EBGP来完成,IGP+LDP,是让运行某个IGP把关于RR之间的更新源地址传递到地方,然后运行LDP分配关于标签信息。 这里的IGP是不可能与MPLS ***内部的IGP使用同一个的,因为不同ISP之间不会暴露自己内网的信息。 如果是EBGP的话,那么可以直接宣告这条路由传递给对方。主要是标签怎么来,在MPLS中LDP肯定是不行的,它是只为IGP分配标签信息,但是BGP作为更新路由的协议以外,还是一个标签分发协议,只是默认是关闭的,所以可以使用EBGP来分发标签,这也是推荐的。

可以看出来。当RR之间把路由更新完毕后,PE1到PE2之间形成了一条LSP的路径,从RR到对方RR中间一直是保持双层标签的转发,搜要比起Open A B来,这个模型合适的很多。 分工也很明确,对于设备性能消耗也减少了。

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

RR之间建立MPBGP邻居关系,那么下一跳就会被改变,如果PE1和ASBR之间还有条链路,它的路径比PE1—-RR1—-ASBR1更优,因为它之间PE1——ASBR1了,另外RR改变下一跳就会为每一条路由分配标签,这样对于大量客户路由的存在,RR的负担也是比较大的, 所以在最终的情况下就是PE1看到的下一跳就是关于对方PE1的更新源地址,这样无论是标签分分发还是最优路径都解决了。

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

实验环境 R-ISP1_PE运行底层OSPF, R-ISP2_PE运行ISIS, CE之间运行RIP v2。 ASBR之间先用IGP+LDP来实现效果,最后用EBGP来实现。

R-ISP1_PE(config)#int s1/2
R-ISP1_PE(config-if)#ip add 12.1.1.1 255.255.255.0
R-ISP1_PE(config-if)#no shut
R-ISP1_PE(config-if)#int lo 0
R-ISP1_PE(config-if)#ip add 1.1.1.1 255.255.255.255
R-ISP1_PE(config-if)#int s1/1
R-ISP1_PE(config-if)#ip add 13.1.1.1 255.255.255.0
R-ISP1_PE(config-if)#no shut

R-ISP1_PE(config)#ip vrf A
R-ISP1_PE(config-vrf)#rd 1:1
R-ISP1_PE(config-vrf)#route-target 1:1
R-ISP1_PE(config-vrf)#int s1/0
R-ISP1_PE(config-if)#ip vrf forwarding A
R-ISP1_PE(config-if)#ip add 192.168.1.2 255.255.255.0
R-ISP1_PE(config-if)#no shut

R-ISP1_PE(config)#router ospf 1
R-ISP1_PE(config-router)#router-id 1.1.1.1
R-ISP1_PE(config-router)#network 12.1.1.1 0.0.0.0 a 0
R-ISP1_PE(config-router)#network 13.1.1.1 0.0.0.0 a 0
R-ISP1_PE(config-router)#network 1.1.1.1 0.0.0.0 a 0
R-ISP1_PE(config)#mpls ldp router-id lo 0
R-ISP1_PE(config)#mpls label range 100 199
R-ISP1_PE(config)#int s1/1
R-ISP1_PE(config-if)#mpls ip
R-ISP1_PE(config-if)#int s1/2
R-ISP1_PE(config-if)#mpls ip

把接口基本信息配置,然后接口运行MPLS 最后在路由协议宣告,这些步骤相信已经很清晰了

R-ISP1_RR(config)#int s1/2
R-ISP1_RR(config-if)#ip add 12.1.1.2 255.255.255.0
R-ISP1_RR(config-if)#no shut
R-ISP1_RR(config-if)#int s1/3
R-ISP1_RR(config-if)#ip add 23.1.1.1 255.255.255.0
R-ISP1_RR(config-if)#no shut
R-ISP1_RR(config-if)#int lo 0
R-ISP1_RR(config-if)#ip add 2.2.2.2 255.255.255.255

R-ISP1_RR(config)#mpls ldp router lo 0
R-ISP1_RR(config)#mpls label range 200 299
R-ISP1_RR(config)#int s1/2
R-ISP1_RR(config-if)#mpls ip
R-ISP1_RR(config)#int s1/3
R-ISP1_RR(config-if)#mpls ip

R-ISP1_RR(config-if)#router ospf 1
R-ISP1_RR(config-router)#router-id 2.2.2.2
R-ISP1_RR(config-router)#network 2.2.2.2 0.0.0.0 a 0
R-ISP1_RR(config-router)#network 12.1.1.2 0.0.0.0 a 0
R-ISP1_RR(config-router)#network 23.1.1.1 0.0.0.0 a 0

———————————————————–

R-ISP1_ASBR(config)#int s1/1
R-ISP1_ASBR(config-if)#ip add 13.1.1.2 255.255.255.0
R-ISP1_ASBR(config-if)#no shut
R-ISP1_ASBR(config)#int s1/3
R-ISP1_ASBR(config-if)#ip add 23.1.1.2 255.255.255.0
R-ISP1_ASBR(config-if)#no shut
R-ISP1_ASBR(config-if)#int lo 0
R-ISP1_ASBR(config-if)#ip add 3.3.3.3 255.255.255.255

R-ISP1_ASBR(config-if)#router ospf 1
R-ISP1_ASBR(config-router)#router-id 3.3.3.3
R-ISP1_ASBR(config-router)#network 3.3.3.3 0.0.0.0 a 0
R-ISP1_ASBR(config-router)#network 23.1.1.2 0.0.0.0 a 0
R-ISP1_ASBR(config-router)#network 13.1.1.2 0.0.0.0 a 0

R-ISP1_ASBR(config)#mpls ldp router-id lo 0
R-ISP1_ASBR(config)#mpls label range 300 399
R-ISP1_ASBR(config)#int s1/3
R-ISP1_ASBR(config-if)#mpls ip
R-ISP1_ASBR(config-if)#int s1/1
R-ISP1_ASBR(config-if)#mpls ip

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

关于标签和路由表都负载均衡了,剩下MPBGP和客户的路由建立重分布了。

R-ISP1_PE(config)#router bgp 1
R-ISP1_PE(config-router)#no bgp default ipv4
R-ISP1_PE(config-router)#bgp router-id 1.1.1.1
R-ISP1_PE(config-router)#neighbor 2.2.2.2 remote 1
R-ISP1_PE(config-router)#neighbor 2.2.2.2 upda lo 0
R-ISP1_PE(config-router)#address-family ***v4
R-ISP1_PE(config-router-af)#neighbor 2.2.2.2 ac

R-ISP1_CE(config)#int s1/0
R-ISP1_CE(config-if)#ip add 192.168.1.1 255.255.255.0
R-ISP1_CE(config-if)#no shut
R-ISP1_CE(config-if)#int lo 0
R-ISP1_CE(config-if)#ip add 1.1.1.1 255.255.255.255

R-ISP1_RR(config)#router bgp 1
R-ISP1_RR(config-router)#bgp router-id 2.2.2.2
R-ISP1_RR(config-router)#no bgp default ipv4-unicast
R-ISP1_RR(config-router)#neighbor 1.1.1.1 remote 1
R-ISP1_RR(config-router)#neighbor 1.1.1.1 upda lo 0
R-ISP1_RR(config-router)#address-family ***v4
R-ISP1_RR(config-router-af)#neighbor 1.1.1.1 a

R-ISP1_CE(config-if)#router rip
R-ISP1_CE(config-router)#version 2
R-ISP1_CE(config-router)#no auto-summary
R-ISP1_CE(config-router)#network 1.0.0.0
R-ISP1_CE(config-router)#network 192.168.1.0

R-ISP1_PE(config)#router bgp 1
R-ISP1_PE(config-router)#add
R-ISP1_PE(config-router)#address-family ipv4 vr
R-ISP1_PE(config-router)#address-family ipv4 vrf A
R-ISP1_PE(config-router-af)#redistribute rip

R-ISP1_PE(config-router-af)#router rip
R-ISP1_PE(config-router)#address-family ipv4 vrf A
R-ISP1_PE(config-router-af)#redistribute bgp 1 metric transparent
R-ISP1_PE(config-router-af)#version 2
R-ISP1_PE(config-router-af)#no auto-summary
R-ISP1_PE(config-router-af)#network 192.168.1.0
看下RR能否收到客户的路由,默认情况下是拒绝的,因为本身没有RT的信息。

没有任何客户路由信息,被拒绝了,之前有个解决办法就是把RT保护功能给关闭了,这里有个更好的解决方便就是RR,MPBGP的RR,能打破这个规则。

R-ISP1_RR(config)#router bgp 1
R-ISP1_RR(config-router)#address-family ***v4
R-ISP1_RR(config-router-af)#neighbor 1.1.1.1 route-reflector-client

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

这下路由解决了。

把ISP2那边也搞定, ASBR之间最后在解决,因为它的问题最多。

R-ISP2_ASBR(config)#int s1/2
R-ISP2_ASBR(config-if)#ip add 45.1.1.1 255.255.255.0
R-ISP2_ASBR(config-if)#no shut
R-ISP2_ASBR(config-if)#ip router isis
R-ISP2_ASBR(config)#int s1/2
R-ISP2_ASBR(config-if)#ip add 46.1.1.1 255.255.255.0
R-ISP2_ASBR(config-if)#no shut
R-ISP2_ASBR(config-if)#ip router isis

R-ISP2_ASBR(config-if)#int lo 0
R-ISP2_ASBR(config-if)#ip add 4.4.4.4 255.255.255.255
R-ISP2_ASBR(config-if)#router isis
R-ISP2_ASBR(config-router)#log-adjacency-changes
R-ISP2_ASBR(config-router)#net 49.0000.0000.0000.0001.00
R-ISP2_ASBR(config-router)#passive-interface lo0
R-ISP2_ASBR(config-router)#is-type level-1

R-ISP2_ASBR(config)#mpls ldp router-id lo 0
R-ISP2_ASBR(config)#mpls label range 400 499
R-ISP2_ASBR(config)#int s1/2
R-ISP2_ASBR(config-if)#mpls ip
R-ISP2_ASBR(config-if)#int s1/1
R-ISP2_ASBR(config-if)#mpls ip

底层运行ISIS ,并且把MPLS 也应用了

R-ISP2_RR(config)#int s1/2
R-ISP2_RR(config-if)#ip add 45.1.1.2 255.255.255.0
R-ISP2_RR(config-if)#ip router isis
R-ISP2_RR(config-if)#no shut
R-ISP2_RR(config-if)#int lo 0
R-ISP2_RR(config-if)#ip add 5.5.5.5 255.255.255.255
R-ISP2_RR(config-if)#
R-ISP2_RR(config-if)#
R-ISP2_RR(config-if)#int s1/3
R-ISP2_RR(config-if)#ip add 56.1.1.1 255.255.255.0
R-ISP2_RR(config-if)#no shut
R-ISP2_RR(config-if)#ip router isis

R-ISP2_RR(config-if)#router isis
R-ISP2_RR(config-router)#log-adjacency-changes
R-ISP2_RR(config-router)#is-type level-1
R-ISP2_RR(config-router)#net 49.0000.0000.0000.0002.00
R-ISP2_RR(config-router)#passive-interface lo 0
R-ISP2_RR(config)#mpls ldp router-id lo 0
R-ISP2_RR(config)#mpls label range 500 599
R-ISP2_RR(config)#int s1/2
R-ISP2_RR(config-if)#mpls ip
R-ISP2_RR(config-if)#int s1/3
R-ISP2_RR(config-if)#mpls ip

R-ISP2_PE(config)#int s1/1
R-ISP2_PE(config-if)#ip add 46.1.1.2 255.255.255.0
R-ISP2_PE(config-if)#ip router isis
R-ISP2_PE(config-if)#no shut
R-ISP2_PE(config-if)#int s1/3
R-ISP2_PE(config-if)#ip router isis
R-ISP2_PE(config-if)#ip add 56.1.1.2 255.255.255.0
R-ISP2_PE(config-if)#no shut
R-ISP2_PE(config-if)#int lo 0
R-ISP2_PE(config-if)#ip add 6.6.6.6 255.255.255.255
R-ISP2_PE(config)#router isis
R-ISP2_PE(config-router)#log-adjacency-changes
R-ISP2_PE(config-router)#is-type level-1
R-ISP2_PE(config-router)#passive-interface lo 0
R-ISP2_PE(config-router)#net 49.0000.0000.0000.0003.00
R-ISP2_PE(config)#mpls ldp router-id lo 0
R-ISP2_PE(config)#mpls label range 600 699
R-ISP2_PE(config)#int s1/3
R-ISP2_PE(config-if)#mpls ip
R-ISP2_PE(config-if)#int s1/1
R-ISP2_PE(config-if)#mpls ip

底层和MPLS 都搞定了,把MPBGP和客户路由建立起来 然后双向重分布

R-ISP2_PE(config)#router bgp 2
R-ISP2_PE(config-router)#bgp router-id 6.6.6.6
R-ISP2_PE(config-router)#no bgp default ipv4
R-ISP2_PE(config-router)#neighbor 5.5.5.5 remote 2
R-ISP2_PE(config-router)#neighbor 5.5.5.5 upda lo 0
R-ISP2_PE(config-router)#address-family ***v4
R-ISP2_PE(config-router-af)#neighbor 5.5.5.5 ac
R-ISP2_RR(config)#router bgp 2
R-ISP2_RR(config-router)#no bgp default ipv4
R-ISP2_RR(config-router)#neighbor 6.6.6.6 remote 2
R-ISP2_RR(config-router)#neighbor 6.6.6.6 upda lo 0
R-ISP2_RR(config-router)#address-family ***v4
R-ISP2_RR(config-router-af)#neighbor 6.6.6.6 ac
R-ISP2_RR(config-router-af)#neighbor 6.6.6.6 route-reflector-client

R-ISP2_PE(config)#router rip
R-ISP2_PE(config-router)#address-family ipv4 vrf A
R-ISP2_PE(config-router-af)#version 2
R-ISP2_PE(config-router-af)#no auto-summary
R-ISP2_PE(config-router-af)#network 192.168.2.0
R-ISP2_PE(config-router-af)#redistribute bgp 2 metric transparen

R-ISP2_PE(config)#router bgp 2
R-ISP2_PE(config-router)#address-family ipv4 vrf A
R-ISP2_PE(config-router-af)#redistribute rip

R-ISP2_CE(config)#router rip
R-ISP2_CE(config-router)#version 2
R-ISP2_CE(config-router)#no auto-summary
R-ISP2_CE(config-router)#network 192.168.2.0
R-ISP2_CE(config-router)#network 2.0.0.0

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

RR收到客户的路由了。现在主要是分析ASBR之间怎么运行协议。 之前提到过 关于Open C的方案就是把RR之间建立MPBGP关系,实现方法就是IGP+LDP 或者是EBGP来建立。

第一种IGP+LDP 这里IGP使用简单的静态了 先把底层打通,运行MPLS
R-ISP2_ASBR(config)#int s1/0
R-ISP2_ASBR(config-if)#ip add 34.1.1.2 255.255.255.0
R-ISP2_ASBR(config-if)#no shut
R-ISP2_ASBR(config-if)#mpls ip

R-ISP1_ASBR(config)#int s1/0
R-ISP1_ASBR(config-if)#ip add 34.1.1.1 255.255.255.0
R-ISP1_ASBR(config-if)#no shut
R-ISP1_ASBR(config-if)#mpls ip

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

邻居建立不起来,因为LDP的RID是4.4.4.4和3.3.3 双方没有去对方的路由,所以需要改下或者写静态路由。

R-ISP1_ASBR(config-if)#mpls ldp discovery transport-address interface
R-ISP2_ASBR(config-if)#mpls ldp discovery transport-address interface
这里一定要clear mpls ldp neighbor * 两边都做
这样LDP建立就成功了,解决的是RR之间路由可达的问题,这里IGP使用静态来完成,其他IGP协议太麻烦了,也不建议使用。

R-ISP2_ASBR(config)#ip route 2.2.2.2 255.255.255.255 s1/0
R-ISP2_ASBR(config)#re
R-ISP2_ASBR(config)#router isis
R-ISP2_ASBR(config-router)#redistribute static level-1

R-ISP1_ASBR(config)#ip route 5.5.5.5 255.255.255.255 s1/0
R-ISP1_ASBR(config)#router ospf 1
R-ISP1_ASBR(config-router)#redistribute static subnets

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

RR之间通信没问题了 ,开始建立MPBGP关系。

R-ISP2_RR(config)#router bgp 2
R-ISP2_RR(config-router)#neighbor 2.2.2.2 remote 1
R-ISP2_RR(config-router)#neighbor 2.2.2.2 upda lo 0
R-ISP2_RR(config-router)#neighbor 2.2.2.2 ebgp-multihop
R-ISP2_RR(config-router)#address-family ***v4
R-ISP2_RR(config-router-af)#neighbor 2.2.2.2 activate

R-ISP1_RR(config)#router bgp 1
R-ISP1_RR(config-router)#neighbor 5.5.5.5 remote 2
R-ISP1_RR(config-router)#neighbor 5.5.5.5 upda lo 0
R-ISP1_RR(config-router)#address-family ***v4
R-ISP1_RR(config-router-af)#neighbor 5.5.5.5 activate
R-ISP1_RR(config-router)#neighbor 5.5.5.5 ebgp-multihop

这里注意是EBGP关系,有跳数限制,所以要把跳数改成合适的,这里255就行了

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案
MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

路由PE和CE都收到了,查看下连通性

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

这里通信是能够通信的,但是从PE上看到的下一跳不是关于对方PE的,而是对方RR的,这样造成的后果就是RR需要为每条客户路由分配标签,当大量客户存在的时候 就会很消耗性能。

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

可以发现RR 为1.1.1.1和192.168.1.0的路由本地产生了205和204,这是发送给RR用的,为104 和103是PE发送给RR下一跳改变了,这个是正确的。这时候我们因该把RR之间MPBGP下一跳为不改变,让PE看到的下一跳直接是PE的下一跳。

R-ISP1_RR(config)#router bgp 1
R-ISP1_RR(config-router)#address-family ***v4
R-ISP1_RR(config-router-af)#neighbor 5.5.5.5 next-hop-unchanged

R-ISP2_RR(config)#router bgp 2
R-ISP2_RR(config-router)#address-family ***v4
R-ISP2_RR(config-router-af)#neighbor 2.2.2.2 next-hop-unchanged

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

下一跳不可达,所以还需要写静态重分布进IGP中。

R-ISP1_ASBR(config)#ip route 6.6.6.6 255.255.255.255 s1/0
R-ISP2_ASBR(config)#ip route 1.1.1.1 255.255.255.255 s1/0

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

ok,这时候从R-ISP2_PE上看到下一跳地址是1.1.1.1,这个地址是关于对方PE的。 这样从R-ISP1_PE—– R-ISP2_PE之间形成了一条LSP的路径了,中间一直是双层标签转发着,内层标签一直不变。

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

通信没问题,查看下路径 R-ISP2_CE——R-ISP2_PE—-R-ISP2_ASBR——R-ISP1_ASBR——-R-ISP1_PE——–R-ISP1_CE。
发现这里并没有经过RR的设备,因为RR在这里并不是最优的路径,所以在这里 RR只作为客户路由更新的存在。

1、R-ISP2_CE发送一个去往1.1.1.1的数据包给PE

2、PE收到以后,查看VRF的FIB表。内层标签104,这个是对方PE分配的,中间经过的路由器都没有把下一跳给改变,所以标签也一直没有被替换。 404是关于去往1.1.1.1的标签信息。

404的标签压入出去是关于s1/1的接口,s1/1是连接ASBR的接口。

3、R-ISP2_ASBR收到以后,404———300,交给ISP1-ASBR

4、R-ISP1_ASBR收到以后,

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

直接Pop了,因为关于1.1.1.1 R-ISP1_ASBR是次莫跳,然后交给PE

5、PE收到以后执行untagged,把数据包交给CE。

这里标签的置换很简单,因为一直都是双层的,中间没有把底层的弹出也压入的过程。

第二种实现方法 就是EBGP了,IGP实现起来比较麻烦,EBGP的扩展性更好

把之前的静态 重分布 还有MPLS接口运行都no 掉

R-ISP1_ASBR(config)#no ip route 6.6.6.6 255.255.255.255
R-ISP1_ASBR(config)#no ip route 5.5.5.5 255.255.255.255
R-ISP1_ASBR(config)#int s1/0
R-ISP1_ASBR(config-if)#no mpls ip

R-ISP1_ASBR(config-if)#router ospf 1
R-ISP1_ASBR(config-router)#no redistribute static subnets

R-ISP2_ASBR(config)#no ip route 1.1.1.1 255.255.255.255
R-ISP2_ASBR(config)#no ip route 2.2.2.2 255.255.255.255
R-ISP2_ASBR(config)#int s1/0
R-ISP2_ASBR(config-if)#no mpls ip
R-ISP2_ASBR(config-if)#router isis
R-ISP2_ASBR(config-router)#no redistribute static level-1

分析下EBGP的建立,哪些需要建立EBGP邻居关系,这里ASBR之间是必须的,那么ASBR与RR之间要不要建立呢,不建立其实也没什么关系,只是需要多些重分布的动作,但是建议ASBR与RR之间建立邻居关系,这样的话RR就可以直接宣告自己的地址,让对方知道,这样双方建立MPBGP邻居关系,如果loopback口出现了问题,那么因为是直连 很快就会发现问题。

R-ISP2_ASBR(config)#router bgp 2
R-ISP2_ASBR(config-router)#bgp router-id 4.4.4.4
R-ISP2_ASBR(config-router)#neighbor 5.5.5.5 upda lo 0
R-ISP2_ASBR(config-router)#neighbor 34.1.1.1 remote 1
R-ISP2_ASBR(config-router)#neighbor 5.5.5.5 next-hop-self

R-ISP2_RR(config)#router bgp 2
R-ISP2_RR(config-router)#neighbor 4.4.4.4 remote 2
R-ISP2_RR(config-router)#neighbor 4.4.4.4 upda lo 0
R-ISP2_RR(config-router)#address-family ipv4
R-ISP2_RR(config-router-af)#neighbor 4.4.4.4 ac

RR与ASBR之间建立IBGP邻居,ASBR之间建立EBGP邻居关系,这里RR与ASBR之间不需要做RR,因为这里就3台路由器,如果是现网中肯定是要做的。

R-ISP1_ASBR(config)#router bgp 1
R-ISP1_ASBR(config-router)#bgp router-id 3.3.3.3
R-ISP1_ASBR(config-router)#neighbor 2.2.2.2 remote 1
R-ISP1_ASBR(config-router)#neighbor 2.2.2.2 upda lo 0
R-ISP1_ASBR(config-router)#neighbor 34.1.1.2 remote 2
R-ISP1_ASBR(config-router)#neighbor 2.2.2.2 next-hop-self

R-ISP1_RR(config)#router bgp 1
R-ISP1_RR(config-router)#neighbor 3.3.3.3 remote 1
R-ISP1_RR(config-router)#neighbor 3.3.3.3 upda lo 0
R-ISP1_RR(config-router)#address-family ipv4
R-ISP1_RR(config-router-af)#neighbor 3.3.3.3 ac

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

BGPv4建立起来了,开始把环回口地址宣告进IPv4中,让两个RR之间建立MPBGP

R-ISP1_RR(config)#router bgp 1
R-ISP1_RR(config-router)#address-family ipv4
R-ISP1_RR(config-router-af)#network 2.2.2.2 mask 255.255.255.255

R-ISP2_RR(config)#router bgp 2
R-ISP2_RR(config-router)#address-family ipv4
R-ISP2_RR(config-router-af)#network 5.5.5.5 mask 255.255.255.255

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

邻居是起来了,但是下一跳不优,这个还需要宣告PE的地址。
R-ISP1_RR(config)#router bgp 1
R-ISP1_RR(config-router)#address-family ipv4
R-ISP1_RR(config-router-af)#network 1.1.1.1 mask 255.255.255.

R-ISP2_RR(config)#router bgp 2
R-ISP2_RR(config-router)#address-family ipv4
R-ISP2_RR(config-router-af)#network 6.6.6.6 mask 255.255.255.255

这里还有两个问题,第一个是ASBR之间的标签必须连续,之前是因为运行了LDP才分配了标签,而这里是EBGP,LDP是不起作用的,所以需要依靠EBGP来分配标签,另外就是把EBGP重分布进IGP中,让PE的下一跳可达。 这里重分布,通常EBGP承载的Intenet的路由,如果全部重分布进IGP中肯定是不可能的,分发标签也是,所以这里我们要把需要的才分发标签,需要的下一跳才重分布进IGP中。这里需要分发标签的只需要各自PE的环回口就可以了,而RR的loopback完全没必要,因为它有EBGP来传递过去。而重分布进IGP的也只需要各自PE的loopback口。所以这里用列表先定义起来,后续如果增加了站点,完全只需要在列表中添加下就行了 。 比较方便

R-ISP1_ASBR(config)#ip prefix-list send-label permit 1.1.1.1/32
R-ISP1_ASBR(config)#route-map send-label permit 10
R-ISP1_ASBR(config-route-map)#match ip address prefix-list send-label
R-ISP1_ASBR(config-route-map)#set mpls-label
R-ISP1_ASBR(config)#route-map send-label permit 20
R-ISP1_ASBR(config)#router bgp 1
R-ISP1_ASBR(config-router)#neighbor 34.1.1.2 route-map send-label out
R-ISP1_ASBR(config-router)#end
R-ISP1_ASBR#clear ip bgp * soft

R-ISP2_ASBR(config)#ip prefix-list send-label permit 6.6.6.6/32
R-ISP2_ASBR(config)#route-map send-label permit 10
R-ISP2_ASBR(config-route-map)#match ip address prefix-list send-label
R-ISP2_ASBR(config-route-map)#set mpls-label
R-ISP2_ASBR(config-route-map)#exit
R-ISP2_ASBR(config)#route-map send-label permit 20
R-ISP2_ASBR(config)#router bgp 2
R-ISP2_ASBR(config-router)#neighbor 34.1.1.1 route-map send-label out
R-ISP2_ASBR(config-router)#exit
R-ISP2_ASBR#clear ip bgp * soft
这里是满足这个prefix的才分发标签,不满足的就用20过,什么都不操作。 另外用一个route-map匹配通过EBGP分发的MPLS LABEL这样下来没有标签的就不会分发进去。这里做过滤的话 一定要把route-map放空一个,否则就其他路由过不了。
R-ISP2_ASBR(config)#route-map isis permit 10
R-ISP2_ASBR(config-route-map)#match mpls-label
R-ISP2_ASBR(config-route-map)#exit

R-ISP2_ASBR(config)#router isis
R-ISP2_ASBR(config-router)#re
R-ISP2_ASBR(config-router)#redistribute bgp 2 le
R-ISP2_ASBR(config-router)#redistribute bgp 2 level-1 rou
R-ISP2_ASBR(config-router)#redistribute bgp 2 level-1 route-map isis
R-ISP1_ASBR(config)#route-map ospf permit 10
R-ISP1_ASBR(config-route-map)#match mpls-label
R-ISP1_ASBR(config-route-map)#router ospf 1
R-ISP1_ASBR(config-router)#redistribute bgp 1 subnets route-map ospf
做route-map把重分布进IGP的路由进行过滤,只允许EBGP分配的标签才能进来,其余的都过滤 掉.这里注意route-map的名字别调用错了。

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

这里对方只分配了关于6.6.6.6的标签信息,其余的都没分配

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

路由也收到了,测试下 分析下标签

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

1、R-ISP1_CE发送一个数据包 2.2.2.2到PE上。

2、PE收到以后查看FIB表,内层压入604的标签,这是对方R-ISP2_PE分配的,301是关于这下一跳的标签,出接口s1/1,给ASBR

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

3、R-ISP1_ASBR收到以后,301置换402从s1/0出去,给对方R-ISP2_ASBR

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

4、R-ISP2_ASBR,402执行Pop动作,因为它的路径是直接到R-ISP2_PE上。

MPLS系列之七:MPLS *** Open C(RR-To-RR)解决方案

5、R-ISP2_PE收到以后执行untagged,把数据包交给CE。

Open A B C的模型已经分析完毕了,Open C的优势最大,唯一的缺点就是当MPLS 域内的IP地址已经规划好了,可能有些ISP之间产生了冲突,这是重新规划很麻烦,所以在这个时候只能使用Open B的方案。

本文首发于公众号:网络之路博客

上一篇:BootStrap使用


下一篇:Bootstrap 创始人 Mark Otto 谈自己生病;替换 RHEL,SUSE 推出 Liberty Linux ; Linux 5.17 使用新调试功能 | 开源日报