现网时不时会出现虚拟防火墙学习不到OSPF路由的情况,明明路由邻居建立起来了,状态也full了,
但是始终学习不到相关的路由。
从现网问题处理的经验来看,虚拟防火墙下OSPF学习不到路由经常是因为OSPF防环机制导致的。
可以尝试用vpn-instance-capability simple禁止OSPF防环检测。
一、 vpn-instance-capability simple命令含义
配置多实例CE上不进行路由环路检查
Multi-VPN-Instance CE可以看作一种通过路由隔离实现业务隔离的组网方案,配置上并没有特殊之处,但需要禁止路由环路检查。
背景信息
此配置在PE上进行操作。
操作步骤
- 执行命令system-view,进入系统视图。
- 执行命令ospf process-id [ router-id router-id ] vpn-instance vpn-instance-name,进入OSPF视图。
- 执行命令vpn-instance-capability simple,不进行路由环路检查。
二、现网实际案例
关闭防环检查前学习不到10.44网段的路由,业务不正常,关闭防环检查后问题解决。
[USG5500]dis ospf routing
11:48:04 2014/03/07
OSPF Process 201 with Router ID 10.32.240.5
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.36.6.0/27 1 Stub 10.36.6.1 10.32.240.5 0.0.0.1
10.32.241.16/30 1 Transit 10.32.241.18 10.32.240.29 0.0.0.1
10.32.241.20/30 1 Transit 10.32.241.22 10.32.240.30 0.0.0.1
Total Nets: 3
Intra Area: 3 Inter Area: 0 ASE: 0 NSSA: 0
[USG5500]ospf 201 router-id 10.32.240.5 vpn-instance vfw201
11:49:03 2014/03/07
[USG5500-ospf-201]vpn-instance-capability simple ?
<cr>
[USG5500-ospf-201]vpn-instance-capability simple
11:49:08 2014/03/07
[USG5500-ospf-201]
[USG5500-ospf-201]q
11:49:09 2014/03/07
[USG5500]dis ospf routing
11:49:11 2014/03/07
OSPF Process 201 with Router ID 10.32.240.5
Routing Tables
Routing for Network
Destination Cost Type NextHop AdvRouter Area
10.36.6.0/27 1 Stub 10.36.6.1 10.32.240.5 0.0.0.1
10.44.255.0/26 14 Inter-area 10.32.241.17 10.32.240.29 0.0.0.1
10.44.255.0/26 14 Inter-area 10.32.241.21 10.32.240.30 0.0.0.1
10.44.255.1/32 14 Inter-area 10.32.241.17 10.32.240.29 0.0.0.1
10.44.255.1/32 14 Inter-area 10.32.241.21 10.32.240.30 0.0.0.1
10.44.255.64/26 14 Inter-area 10.32.241.17 10.32.240.29 0.0.0.1
10.44.255.64/26 14 Inter-area 10.32.241.21 10.32.240.30 0.0.0.1
10.44.255.65/32 14 Inter-area 10.32.241.17 10.32.240.29 0.0.0.1
10.44.255.65/32 14 Inter-area 10.32.241.21 10.32.240.30 0.0.0.1
10.44.255.128/26 14 Inter-area 10.32.241.17 10.32.240.29 0.0.0.1
10.44.255.128/26 14 Inter-area 10.32.241.21 10.32.240.30 0.0.0.1
10.44.255.129/32 14 Inter-area 10.32.241.17 10.32.240.29 0.0.0.1
10.44.255.129/32 14 Inter-area 10.32.241.21 10.32.240.30 0.0.0.1
10.32.240.3/32 13 Inter-area 10.32.241.17 10.32.240.29 0.0.0.1
10.32.240.3/32 13 Inter-area 10.32.241.21 10.32.240.30 0.0.0.1
10.32.240.4/32 13 Inter-area 10.32.241.17 10.32.240.29 0.0.0.1
10.32.240.4/32 13 Inter-area 10.32.241.21 10.32.240.30 0.0.0.1
10.32.241.0/30 13 Inter-area 10.32.241.21 10.32.240.30 0.0.0.1
10.32.241.4/30 13 Inter-area 10.32.241.21 10.32.240.30 0.0.0.1
10.32.241.8/30 13 Inter-area 10.32.241.17 10.32.240.29 0.0.0.1
10.32.241.12/30 13 Inter-area 10.32.241.17 10.32.240.29 0.0.0.1
10.32.241.16/30 1 Transit 10.32.241.18 10.32.240.29 0.0.0.1
10.32.241.20/30 1 Transit 10.32.241.22 10.32.240.30 0.0.0.1
10.32.241.148/30 13 Inter-area 10.32.241.17 10.32.240.29 0.0.0.1
10.32.241.148/30 13 Inter-area 10.32.241.21 10.32.240.30 0.0.0.1
10.32.241.152/30 13 Inter-area 10.32.241.17 10.32.240.29 0.0.0.1
10.32.241.152/30 13 Inter-area 10.32.241.21 10.32.240.30 0.0.0.1
10.32.241.156/30 13 Inter-area 10.32.241.17 10.32.240.29 0.0.0.1
10.32.241.156/30 13 Inter-area 10.32.241.21 10.32.240.30 0.0.0.1
10.32.241.160/30 13 Inter-area 10.32.241.17 10.32.240.29 0.0.0.1
10.32.241.160/30 13 Inter-area 10.32.241.21 10.32.240.30 0.0.0.1
Routing for ASEs
Destination Cost Type Tag NextHop AdvRouter
124.47.3.0/26 11 Type2 3489726462 10.32.241.17 10.32.240.29
124.47.3.0/26 11 Type2 3489726462 10.32.241.21 10.32.240.30
1.1.0.0/23 11 Type2 3489726462 10.32.241.17 10.32.240.29
1.1.0.0/23 11 Type2 3489726462 10.32.241.21 10.32.240.30
1.1.1.1/32 11 Type2 3489726462 10.32.241.17 10.32.240.29
1.1.1.1/32 11 Type2 3489726462 10.32.241.21 10.32.240.30
Total Nets: 37
Intra Area: 3 Inter Area: 28 ASE: 6 NSSA: 0
[USG5500]
三、OSPF防环机制
1 防环路检测
1.1 防环检测原理
防环路检测有两种方式,这两种方式是或的关系,即只要满足其中一个条件这个LSA就不参与路由计算:
1)使用DN-BIT标志位防环
根据RFC4577的要求,在PE上将BGP路由(包括IBGP和EBGP路由)引入到OSPF域中后,所产生的type3、type5、type7类LSA需要设置DN-BIT标志位。 其它PE对学习到的LSA会检查是否设置了DN-BIT标志位,如果设置了则对应的LSA不会参与到路由计算中,从而防止出现路由环路。
2)使用Tag防环
对于type5、type7类LSA除了通过上面的DN-BIT可以防止路由环路外,还可以根据Tag值进行防环,即如果LSA的Tag值与本地(PE上)OSPF进程的Route tag相同,则这个LSA不参与到路由计算中。
由于防环检测的存在,所以我们在PE经常会发现存在LSA但路由计算不出来。
1.2 需要进行防环检测的前提条件
OSPF进程绑定了私网VPN,且没有在OSPF进程下配置命令vpn-instance-capability simple,此时OSPF可以引IBGP路由,路由计算时会进行防环路检测。
如果在OSPF私网进程下配置了命令vpn-instance-capability simple后,OSPF就不再能够引IBGP路由,同时引入的EBGP路由生成LSA时也不会再置DN-BIT,在进行路由计算时也不会在进行路由防环检测。
1.3 置DN-BIT的条件
OSPF私网进程引入BGP路由时(import from bgp)生成的3、5、7类LSA都会置DN-BIT。
1.4 LSA Tag的计算方法
OSPF引入外部路由都会置Tag,但不同的情况下Tag值不同。
1)公网OSPF或者配置了vpn-instance-capability simple的私网OSPF生成的5、7类LSA的Tag值为1。
2)私网OSPF生成的5、7类LSA的tag值计算方法比较复杂:
1、 如果配置了route-tag X,则LSA的tag值为X。
2、 如果没有配置route-tag X,且路由器上没有配置BGP,则LSA的tag值默认为0.
3、 如果没有配置route-tag X和route-tag disable,但配置了BGP,则LSA的tag值为0xd0000000|BGP AS NUM。
2 命令控制防环检测
在某些特殊的应用场景中(比如跨域Option A使用OSPF打通ASBR)存在需要忽略防环检测的需求,为了使用的方便性增加了一些命令行控制防环检测。
2.1 vpn-instance-capability simple命令取消防环检测
在私网OSPF进程下配置vpn-instance-capability simple命令后可以取消防环检测功能,此时路由计算时会忽略DN-BIT和tag值检测。
但这个命令只建议配置在MCE设备上,因为配置这个命令后OSPF将不再能够引入IBGP路由(import from IBGP)。
2.2 忽略Tag防环检测
由上面的介绍可以知道,当LSA的tag值与本地OSPF的Route-tag相同时,则不计算这个LSA。当然我们可以通过命令route-tag X强制修改本地的tag值,同时还可以通过命令route-tag disable来取消根据tag值防环检测。
2.3 忽略DN-BIT防环检测
dn-bit-check disble命令可以控制在路由计算时是否忽略DN-BIT检测。
2.4 生成LSA时不置DN-BIT
Dn-bit-set disable命令可以控制在引入BGP路由时是否置DN-BIT。
Cisco描述
THE DOWN BIT
___________________
consider / \
/ \
CE------\-PE1---------------PE2------------/--CE2 |
| | ospf domain |
| | /
PE 2.1---------/--CE2.1 /
\__________________/
when the router CE advertise a route to PE1, the route gets redistributed into mpbgp, and
when PE2 receives it, its redistributed into ospf domain, and at PE2.1 the same ospf route
is again redistributed into mpbgp, and this causes a loop
>> to save this problem, a DOWN BIT is defined in the OSPF LSA, and this bit is set whenever a MPBGP route is redistributed into ospf domain, and the PE router never redistributes a OSPF route with DOWN bit set to MPBGP, therefore essentially preventing the loop.
>> THE ROUTING BIT IS NOT SET ON ROUTES WITH DOWN BIT SET. AND THIS ROUTING BIT IS USED INTERNALLY AND IS NOT PROPAGATED IN UPDATES AND THESE ROUTES NEVER ENTER THE ROUTING TABLE.
>> Also the DOWN bit is cleared when the route is adverised out a ospf domain to different ospf domain. so, there are chances this same route gets redistributed into the mpbgp and CAUSING A LOOP , at somewhere else, so, therefore to prevent this ROUTE-TAGS are used.
>>how tags work
when the PE router redistributes the mpbgp route into ospf, in addition to setting the down bit, it also adds a TAG value equal to the BGP AS no, to that route, now after the route has been redistributed into the ospf domain, with down bit set and the tag value put, and if this route now is advertised to a different ospf domain, as en external route ofcourse, the down bit will be removed but the tag is carried along, and when this route comes to the PE in that domain to get redistributed into the mPbgp the PE router checks the tag, value, if the tag value is same as the BgpAS no then the route is no redistributed.