MPLS ××× 网络中的OSPF Sham-Link


wKioL1R6wm3xH5FcAAGDht21YLQ719.jpg


实验拓扑图redis

     实验描述:如上图所示,现PE-R一、P-R二、PE-R3为MPLS ×××网络,两CE客户须要经过MPLS ×××骨干网络进行通讯,而且CE-R4与CE-R6之间有一条链路做为备份链路,正常状况要,R4至R6的流量经过MPLS ×××网络走,当MPLS ×××网络存在故障时,经过R4与R6之间的互联链路走,下面配置OSPF Sham-Link实现上述要求。网络


一、首先配置MP-BGP,MPLS,VRF,PE与CE的OSPF路由协议ide

PE-R1的配置:oop

R1#show runn测试

ip vrf Maoui

 rd 100:10spa

 route-target export 100:10router

 route-target import 100:11blog

!接口

ip cef

mpls label range 100 199

interface Loopback0

 ip address 1.1.1.1 255.255.255.255

!

interface FastEthernet0/0

 ip vrf forwarding Mao

 ip address 14.1.1.1 255.255.255.252

interface FastEthernet1/0

 ip address 12.1.1.1 255.255.255.252

  mpls ip    

router ospf 2 vrf Mao

 redistribute bgp 100 subnets

 network 14.1.1.0 0.0.0.3 area 1

!

router ospf 1

 router-id 1.1.1.1

 network 1.1.1.1 0.0.0.0 area 0

 network 12.1.1.0 0.0.0.3 area 0

!

router bgp 100

 bgp log-neighbor-changes

 no bgp default ipv4-unicast

 neighbor 3.3.3.3 remote-as 100

 neighbor 3.3.3.3 update-source Loopback0

 !

 address-family ***v4

  neighbor 3.3.3.3 activate

  neighbor 3.3.3.3 send-community extended

 exit-address-family

 !

 address-family ipv4 vrf Mao

  redistribute ospf 2 match internal external 1 external 2

 exit-address-family

 

P-R2配置:

ip cef    

mpls label range 200 299

interface Loopback0

 ip address 2.2.2.2 255.255.255.255

interface FastEthernet0/0

 ip address 12.1.1.2 255.255.255.252

 mpls ip

interface FastEthernet0/1

 ip address 23.1.1.1 255.255.255.252

  mpls ip  

router ospf 1

 router-id 2.2.2.2

 network 2.2.2.2 0.0.0.0 area 0

 network 12.1.1.0 0.0.0.3 area 0

 network 23.1.1.0 0.0.0.3 area 0

 

PE-R3配置:

R3#show runn

ip vrf Mao

 rd 100:10

 route-target export 100:11

 route-target import 100:10    

ip cef

mpls label range 300 399

!

interface Loopback0

 ip address 3.3.3.3 255.255.255.255

!

interface FastEthernet0/0

 ip address 23.1.1.2 255.255.255.252

 mpls ip

!

interface FastEthernet0/1

 ip vrf forwarding Mao

 ip address 36.1.1.1 255.255.255.252

!

router ospf 2 vrf Mao

 redistribute bgp 100 subnets

 network 36.1.1.0 0.0.0.3 area 1

!

router ospf 1

 router-id 3.3.3.3

 network 3.3.3.3 0.0.0.0 area 0

 network 23.1.1.0 0.0.0.3 area 0

!

router bgp 100

 bgp log-neighbor-changes

 no bgp default ipv4-unicast

 neighbor 1.1.1.1 remote-as 100

 neighbor 1.1.1.1 update-source Loopback0

 !

 address-family ***v4

  neighbor 1.1.1.1 activate

  neighbor 1.1.1.1 send-community extended

 exit-address-family

 !

 address-family ipv4 vrf Mao

  redistribute ospf 2 match internal external 1 external 2

 exit-address-family

 

CE-R4的配置:

interface Loopback0

 ip address 4.4.4.4 255.255.255.255

!

interface FastEthernet0/0

 ip address 14.1.1.2 255.255.255.252

interface FastEthernet0/1

 ip address 46.1.1.1 255.255.255.252

 !         

router ospf 10

 router-id 4.4.4.4

 network 4.4.4.4 0.0.0.0 area 1

 network 14.1.1.0 0.0.0.3 area 1

 network 46.1.1.0 0.0.0.3 area 1

 

CE-R6的配置:

interface Loopback0

 ip address 6.6.6.6 255.255.255.255

!

interface FastEthernet0/0

 ip address 36.1.1.2 255.255.255.252

interface FastEthernet0/1

 ip address 46.1.1.2 255.255.255.252

router ospf 2

 router-id 6.6.6.6

 network 6.6.6.6 0.0.0.0 area 1

 network 36.1.1.0 0.0.0.3 area 1

 network 46.1.1.0 0.0.0.3 area 1

 

二、CE端路由状况分析

查看CE端路由状况

R4#show ip route 

      4.0.0.0/32 is subnetted, 1 subnets

C        4.4.4.4 is directly connected, Loopback0

      6.0.0.0/32 is subnetted, 1 subnets

O        6.6.6.6 [110/2] via 46.1.1.2, 00:10:24, FastEthernet0/1

      14.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        14.1.1.0/30 is directly connected, FastEthernet0/0

L        14.1.1.2/32 is directly connected, FastEthernet0/0

      36.0.0.0/30 is subnetted, 1 subnets

O        36.1.1.0 [110/2] via 46.1.1.2, 00:10:24, FastEthernet0/1

      46.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        46.1.1.0/30 is directly connected, FastEthernet0/1

L        46.1.1.1/32 is directly connected, FastEthernet0/1

 

  从CE-R4看到6.6.6.6路由为区域内路由,是因为CE-R4与CE-R6之间互联的线路运行OSPF,而且在区域1中,而从MPLS ×××骨干网络中传过来的6.6.6.6路由为区域间路由;而OSPF的选路原则是区域内路由优于区域间路由;

 

在PE-R1上查看×××V4路由,也能够看到6.6.6.6的路由,下一跳指向的是CE-R4,以下:

R1#show ip bgp ***v4 all

     Network          Next Hop            Metric LocPrf Weight Path

Route Distinguisher: 100:10 (default for vrf Mao)

 * i 4.4.4.4/32       3.3.3.3                  3    100      0 ?

 *>                   14.1.1.2                 2         32768 ?

 *>  6.6.6.6/32       14.1.1.2                 3         32768 ?

 * i                  3.3.3.3                  2    100      0 ?

 * i 14.1.1.0/30      3.3.3.3                  3    100      0 ?

 *>                   0.0.0.0                  0         32768 ?

 *>  36.1.1.0/30      14.1.1.2                 3         32768 ?

 * i                  3.3.3.3                  0    100      0 ?

 *>  46.1.1.0/30      14.1.1.2                 2         32768 ?

 * i                  3.3.3.3                  2    100      0 ?

 

R1#show ip route vrf Mao

 

      4.0.0.0/32 is subnetted, 1 subnets

O        4.4.4.4 [110/2] via 14.1.1.2, 00:40:39, FastEthernet0/0

      6.0.0.0/32 is subnetted, 1 subnets

O        6.6.6.6 [110/3] via 14.1.1.2, 00:23:00, FastEthernet0/0

      14.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        14.1.1.0/30 is directly connected, FastEthernet0/0

L        14.1.1.1/32 is directly connected, FastEthernet0/0

      36.0.0.0/30 is subnetted, 1 subnets

O        36.1.1.0 [110/3] via 14.1.1.2, 00:23:00, FastEthernet0/0

      46.0.0.0/30 is subnetted, 1 subnets

O        46.1.1.0 [110/2] via 14.1.1.2, 00:23:00, FastEthernet0/0

 

当将CE-R4与CE-R6互联的线路shutdown后,查看R4的路由以下:

R4(config)#int fa0/1

R4(config-if)#shutdown

R4#show ip route 

      4.0.0.0/32 is subnetted, 1 subnets

C        4.4.4.4 is directly connected, Loopback0

      6.0.0.0/32 is subnetted, 1 subnets

O IA     6.6.6.6 [110/3] via 14.1.1.1, 00:00:52, FastEthernet0/0

      14.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        14.1.1.0/30 is directly connected, FastEthernet0/0

L        14.1.1.2/32 is directly connected, FastEthernet0/0

      36.0.0.0/30 is subnetted, 1 subnets

O IA     36.1.1.0 [110/2] via 14.1.1.1, 00:00:52, FastEthernet0/0

      46.0.0.0/30 is subnetted, 1 subnets

O IA     46.1.1.0 [110/3] via 14.1.1.1, 00:00:52, FastEthernet0/0

 

    如今看到的路由是区域间路由,是PE-R1传过来的,为实现网络的可靠性,正常状况下,R4与R6之间的链路是备份线路,平时数据经过MPLS ×××传递,为实现上述R4路由输出状况,如今在PE路由器之间配置Sham-Link实现两CE端平常数据经过MPLS ×××网络传递,当MPLS ×××网络出现故障时,数据流量切换至R4与R6的互联线路,以便不影响两CE端的互访。

 

三、Sham-Link配置

R1(config)#int loo 11   //用于创建OSPF Sham-Link

R1(config-if)#ip vrf forwarding Mao 

R1(config-if)#ip add 11.1.1.1 255.255.255.255

R1(config)#router bgp 100

R1(config-router)#address-family ipv4 vrf Mao

R1(config-router-af)#network 11.1.1.1 mask 255.255.255.255   //将其发布至MP-BGP中

R1(config)#router ospf 2 vrf Mao

R1(config-router)#area 1 sham-link 11.1.1.1 33.1.1.1 cost 5  //建立sham-link

 

R3(config)#int loo 33

R3(config-if)#ip vrf forwarding Mao

R3(config-if)#ip add 33.1.1.1 255.255.255.255

R3(config)#router bgp 100

R3(config-router)#address-family ipv4 vrf Mao

R3(config-router-af)#network 33.1.1.1 mask 255.255.255.255

R3(config)#router ospf 2 vrf Mao

R3(config-router)#area 1 sham-link 33.1.1.1 11.1.1.1 cost 5

 

查看其邻居是否创建成功,可用show ip ospf neighbor或者show ip ospf sham-link

R3#show ip ospf neighbor 

Neighbor ID     Pri   State           Dead Time   Address         Interface

2.2.2.2           1   FULL/BDR        00:00:36    23.1.1.1        FastEthernet0/0

14.1.1.1          0   FULL/  -        00:00:30    11.1.1.1        OSPF_SL0

6.6.6.6           1   FULL/DR         00:00:36    36.1.1.2        FastEthernet0/1

R3#show ip ospf sham-links 

Sham Link OSPF_SL0 to address 11.1.1.1 is up

Area 1 source address 33.1.1.1

  Run as demand circuit

  DoNotAge LSA allowed. Cost of using 5 State POINT_TO_POINT,

  Timer intervals configured, Hello 10, Dead 40, Wait 40,

    Hello due in 00:00:04

    Adjacency State FULL (Hello suppressed)

    Index 2/2, retransmission queue length 0, number of retransmission 0

    First 0x0(0)/0x0(0) Next 0x0(0)/0x0(0)

    Last retransmission scan length is 0, maximum is 0

Last retransmission scan time is 0 msec, maximum is 0 msec

 

 

四、Sham-link配置分析及结果分析

   上面sham-link的配置设置了cost值为5,那么PE-PE之间这条sham-link的开销值就为5,此时查看R4上的路由,6.6.6.6的路由下一跳仍是直接指向R6,并无走MPLS ×××网络。

R4#show ip route 

      4.0.0.0/32 is subnetted, 1 subnets

C        4.4.4.4 is directly connected, Loopback0

      6.0.0.0/32 is subnetted, 1 subnets

O        6.6.6.6 [110/2] via 46.1.1.2, 00:13:09, FastEthernet0/1

      11.0.0.0/32 is subnetted, 1 subnets

O E2     11.1.1.1 [110/1] via 14.1.1.1, 00:10:07, FastEthernet0/0

      14.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        14.1.1.0/30 is directly connected, FastEthernet0/0

L        14.1.1.2/32 is directly connected, FastEthernet0/0

      33.0.0.0/32 is subnetted, 1 subnets

O E2     33.1.1.1 [110/1] via 14.1.1.1, 00:09:31, FastEthernet0/0

      36.0.0.0/30 is subnetted, 1 subnets

O        36.1.1.0 [110/2] via 46.1.1.2, 00:13:09, FastEthernet0/1

      46.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        46.1.1.0/30 is directly connected, FastEthernet0/1

L        46.1.1.1/32 is directly connected, FastEthernet0/1

 

查看R1上的bgp ***v4 6.6.6.6的路由状况

R1#show ip bgp ***v4 all 6.6.6.6 

BGP routing table entry for 100:10:6.6.6.6/32, version 43

Paths: (2 available, best #1, table Mao)

  Advertised to update-groups:

     1         

  Refresh Epoch 1

  Local

    14.1.1.2 from 0.0.0.0 (1.1.1.1)  //来至CE-R4,而且是最优

      Origin incomplete, metric 3, localpref 100, weight 32768, valid, sourced, best

      Extended Community: RT:100:10 OSPF DOMAIN ID:0x0005:0x000000020200 

        OSPF RT:0.0.0.1:2:0 OSPF ROUTER ID:14.1.1.1:0

      mpls labels in/out 108/nolabel

      rx pathid: 0, tx pathid: 0x0

  Refresh Epoch 1

  Local

    3.3.3.3 (metric 3) from 3.3.3.3 (3.3.3.3)  //来至PE-R3,不是最优的

      Origin incomplete, metric 2, localpref 100, valid, internal  //metric 为2

      Extended Community: RT:100:11 OSPF DOMAIN ID:0x0005:0x000000020200 

        OSPF RT:0.0.0.1:2:0 OSPF ROUTER ID:36.1.1.1:0

      mpls labels in/out 108/307

      rx pathid: 0, tx pathid: 0

 

    从上述路由输出分析可知,R6直接传给R4(之间互联线路)的6.6.6.6的路由,其OSPF开销值为2;而从MPLS ×××网络经PE-R3传至PE-R1的6.6.6.6路由的开销值为2,若是传递至R4,那么开销值为8(5+2+1),其值大于R6直接传给R4的开销值,所以R6直接传给R4的6.6.6.6的路由将会加入路由表项,所以在R4的路由表中将会看到6.6.6.6的下一跳仍是指向46.1.1.2。

 

    要想实现两CE端互访经过MPLS ×××网络,能够修改COST值来实现,现修改R4与R6互联接口的ospf cost值;

R4(config)#int fa0/1

R4(config-if)#ip ospf cost 10 将其cost值设置大于经过MPLS ×××的cost值

 

R6(config)#int fa0/1

R6(config-if)#ip ospf cost 10

 

如今R4上查看路由表状况

R4#show ip route 

      4.0.0.0/32 is subnetted, 1 subnets

C        4.4.4.4 is directly connected, Loopback0

      6.0.0.0/32 is subnetted, 1 subnets

O        6.6.6.6 [110/8] via 14.1.1.1, 00:25:30, FastEthernet0/0  //下一跳指向PE-R1

      11.0.0.0/32 is subnetted, 1 subnets

O E2     11.1.1.1 [110/1] via 14.1.1.1, 00:44:40, FastEthernet0/0

      14.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        14.1.1.0/30 is directly connected, FastEthernet0/0

L        14.1.1.2/32 is directly connected, FastEthernet0/0

      33.0.0.0/32 is subnetted, 1 subnets

O E2     33.1.1.1 [110/1] via 14.1.1.1, 00:44:04, FastEthernet0/0

      36.0.0.0/30 is subnetted, 1 subnets

O        36.1.1.0 [110/7] via 14.1.1.1, 00:25:30, FastEthernet0/0

      46.0.0.0/8 is variably subnetted, 2 subnets, 2 masks

C        46.1.1.0/30 is directly connected, FastEthernet0/1

L        46.1.1.1/32 is directly connected, FastEthernet0/1

 

测试:

R4#traceroute 6.6.6.6

Type escape sequence to abort.

Tracing the route to 6.6.6.6

VRF info: (vrf in name/id, vrf out name/id)

  1 14.1.1.1 136 msec 84 msec 92 msec

  2 12.1.1.2 [MPLS: Labels 201/307 Exp 0] 140 msec 124 msec 144 msec

  3 36.1.1.1 [MPLS: Label 307 Exp 0] 120 msec 112 msec 60 msec 

  4 36.1.1.2 156 msec 168 msec 112 msec

//307为MP-BGP分配的内层标签

 

五、总结

配置sham-link时要根据CE端备份链路所在区域来配置所属区域,若是配置其它区域,该PE发布的至CE端路由将会变成区域间路由,优先级低于区域内路由,所以须要将sham-link配置与备份链路所属区域在同一区域中。若是两CE端没有备份链路,也就不须要配置sham-link链路了。

在调整CE端的选路时,须要根据sham-link配置的COST值及备份链路的接口cost值来完成。

相关文章
相关标签/搜索