今天做了很久的mpls ***的hub and spoke 模型的实验,做到最后老发现,在R5上即使把bgp的路由导入到ospf的vrf a 中在ospf vrf中仍然无法看见远端***的路由,但是lsa是可达的。在hub  R6中可以获取***的路由。

R5#show ip route vrf b ospf 

 

Routing Table: b

 

O    192.168.3.0/24 [110/128] via 192.168.4.2, 00:01:16, Serial0/2

R5#show ip route vrf a ospf

 

Routing Table: a

 

O    192.168.4.0/24 [110/128] via 192.168.3.2, 00:01:11, Serial0/1

R5#

 

R5#show ip bgp ***v4 vrf a

BGP table version is 9, local router ID is 3.3.3.3

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

              r RIB-failure, S Stale

Origin codes: i - IGP, e - EGP, ? - incomplete

 

   Network          Next Hop            Metric LocPrf Weight Path

Route Distinguisher: 3:3 (default for vrf a)

*>i11.11.11.11/32   1.1.1.1                 65    100      0 ?

*>i22.22.22.22/32   1.1.1.1                 65    100      0 ?

*>i192.168.1.0      1.1.1.1                  0    100      0 ?

*>i192.168.2.0      1.1.1.1                  0    100      0 ?

R5#show ip bgp ***v4 vrf b

为空

 

R5#show ip ospf 3 database 

 

            OSPF Router with ID (192.168.4.1) (Process ID 3)

 

                Router Link States (Area 0)

 

Link ID         ADV Router      Age         Seq#       Checksum Link count

192.168.3.1     192.168.3.1     1229        0x80000004 0x002852 2

192.168.4.1     192.168.4.1     1209        0x80000004 0x003246 2

192.168.4.2     192.168.4.2     1206        0x80000003 0x00DEB2 4

 

                Summary Net Link States (Area 0)

 

Link ID         ADV Router      Age         Seq#       Checksum

11.11.11.11     192.168.3.1     940         0x80000001 0x006B76

192.168.1.0     192.168.3.1     940         0x80000001 0x0028BB

 

                Type-5 AS External Link States

 

Link ID         ADV Router      Age         Seq#       Checksum Tag

22.22.22.22     192.168.3.1     925         0x80000001 0x00DA01 3489660929

192.168.2.0     192.168.3.1     925         0x80000001 0x008880 3489660929

 

R5#show ip ospf 2 database 

 

            OSPF Router with ID (192.168.3.1) (Process ID 2)

 

                Router Link States (Area 0)

 

Link ID         ADV Router      Age         Seq#       Checksum Link count

192.168.3.1     192.168.3.1     1393        0x80000004 0x002852 2

192.168.4.1     192.168.4.1     1375        0x80000004 0x003246 2

192.168.4.2     192.168.4.2     1371        0x80000003 0x00DEB2 4

 

                Summary Net Link States (Area 0)

 

Link ID         ADV Router      Age         Seq#       Checksum

11.11.11.11     192.168.3.1     1104        0x80000001 0x006B76

192.168.1.0     192.168.3.1     1104        0x80000001 0x0028BB

 

                Type-5 AS External Link States

 

Link ID         ADV Router      Age         Seq#       Checksum Tag

22.22.22.22     192.168.3.1     1089        0x80000001 0x00DA01 3489660929

192.168.2.0     192.168.3.1     1089        0x80000001 0x008880 3489660929

R5#show ip route vrf a ospf

 

Routing Table: a

 

O    192.168.4.0/24 [110/128] via 192.168.3.2, 00:23:14, Serial0/1

R5#

R5#show ip route vrf a

 

Routing Table: a

Codes: C - connected, S - static, 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

       i - IS-IS, su - IS-IS summary, 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

 

     22.0.0.0/32 is subnetted, 1 subnets

B       22.22.22.22 [200/65] via 1.1.1.1, 00:19:28

O    192.168.4.0/24 [110/128] via 192.168.3.2, 00:24:00, Serial0/1

     11.0.0.0/32 is subnetted, 1 subnets

B       11.11.11.11 [200/65] via 1.1.1.1, 00:19:43

B    192.168.1.0/24 [200/0] via 1.1.1.1, 00:19:43

B    192.168.2.0/24 [200/0] via 1.1.1.1, 00:19:28

C    192.168.3.0/24 is directly connected, Serial0/1

 

后面发现是少注意了一点技术要点

由于OSPF的防环机制下游比特位和域标,需要在R6配置

router ospf 200 vrf r6in
 log-adjacency-changes
 capability vrf-lite
 redistribute bgp 100 subnets
 network 192.168.100.0 0.0.0.255 area 0
!
router ospf 300 vrf r6out
 log-adjacency-changes
 capability vrf-lite
 redistribute bgp 100 subnets
 network 192.168.200.0 0.0.0.255 area 0
 
router bgp 1
address-family ipv4 vrf r6out
redistribute ospf 300 vrf r6out match internal external 1 external 2 nssa-external 1 nssa-external 2
 no synchronization
 exit-address-family

这是摘自高手的解释:

支持多VRF的OSPF增加了防止路由环路的功能:如果一条路由曾被从MP-BGP往OSPF中分发的,则PE不允许该路由再从OSPF分发到MP-BGP中。有时如果某个PE与其他PE互联的P-NETWORK端口都当掉了,唯一可用的是通过某台CE连接到另外一台PE的一条×××内线路,这时就必须要在这两台PE上关闭环路检测功能,以便OSPF路由顺利传递,连通整个×××。配置命令(OSPF 进程配置模式):capability vrf-lite