一、拓扑图如下
R1 Loop0:11.11.1.1/32 测试路由:R1 loopback100:11.11.100.0/24
R2 Loop0:11.11.2.2/32
R3 Loop0:11.11.3.3/32
R6 Loop0:22.22.6.6/32

R2、R6模拟地市城域网出口路由器。R2为R1、R3的RR。
二、需求
R1在OSPF和BGP发布11.11.100.0/24的路由,由于OSPF的AD(华为优先级)小于BGP(IBGP),R2路由表使用OSPF传递过来的路由。
测试:在11.11.100.0/20进入RIB表失败时R2是否传递给R3(IBGP邻居),R6(EBGP邻居)
软件软件版本:ISO-12.4T、WVRP5.5
华为设备测试:
情景a
11.11.100.0/24不在IGP中通告
sysname R1
#
interface Serial0/0/2
link-protocol ppp
ip address 11.11.12.1 255.255.255.252
#
interface LoopBack0
ip address 11.11.1.1 255.255.255.255
#
interface LoopBack100
ip address 11.11.100.1 255.255.255.0
ospf network-type p2p
#
bgp 11
peer 11.11.2.2 as-number 11
peer 11.11.2.2 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
network 11.11.100.0 255.255.255.0
peer 11.11.2.2 enable
#
#
ospf 1
area 0.0.0.0
network 11.11.1.1 0.0.0.0
network 11.11.12.0 0.0.0.255
//R1不在OSPF宣告11.11.100.0/24网段
sysname R2
#
router id 11.11.2.2
#
interface Serial0/0/0
link-protocol ppp
ppp peer hostroute-suppress
ip address 26.26.26.2 255.255.255.252
#
interface Serial0/0/2
link-protocol ppp
ip address 11.11.12.2 255.255.255.252
#
interface Serial0/0/3
link-protocol ppp
ip address 11.11.23.2 255.255.255.252
#
interface LoopBack0
ip address 11.11.2.2 255.255.255.255
#
bgp 11
peer 11.11.1.1 as-number 11
peer 11.11.1.1 connect-interface LoopBack0
peer 11.11.3.3 as-number 11
peer 11.11.3.3 connect-interface LoopBack0
peer 22.22.6.6 as-number 22
peer 22.22.6.6 ebgp-max-hop 255
peer 22.22.6.6 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 11.11.1.1 enable
peer 11.11.1.1 reflect-client /R2作为RR,否则R2不会传递R1的BGP路由
peer 11.11.3.3 enable
peer 22.22.6.6 enable
#
ospf 1
area 0.0.0.0
network 11.11.2.2 0.0.0.0
network 11.11.12.0 0.0.0.255
#
ip route-static 11.11.3.3 255.255.255.255 11.11.23.1 //R2 没有与R3建立OSPF邻居,故需要使用静态路由指点R3 的BGP跟新源地址
ip route-static 22.22.6.6 255.255.255.255 26.26.26.1 //R2 没有与R6建立OSPF邻居,故需要使用静态路由指点R6 的BGP跟新源地址
sysname R3
#
interface Serial0/0/3
link-protocol ppp
ip address 11.11.23.1 255.255.255.252
#
interface LoopBack0
ip address 11.11.3.3 255.255.255.255
#
bgp 11
peer 11.11.2.2 as-number 11
peer 11.11.2.2 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 11.11.2.2 enable
#
ip route-static 11.11.2.2 255.255.255.255 11.11.23.2
sysname R6
#
router id 22.22.6.6
#
interface Serial0/0/2
link-protocol ppp
ppp peer hostroute-suppress
ip address 26.26.26.1 255.255.255.252
#
interface LoopBack0
ip address 22.22.6.6 255.255.255.255
#
bgp 22
peer 11.11.2.2 as-number 11
peer 11.11.2.2 ebgp-max-hop 255
peer 11.11.2.2 connect-interface LoopBack0
#
ipv4-family unicast
undo synchronization
peer 11.11.2.2 enable
#
ip route-static 11.11.2.2 255.255.255.255 26.26.26.2
查看路由表
[R2]display bgp routing-table
Total Number of Routes: 2
BGP Local router ID is 11.11.2.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
*>i 11.11.100.0/24 11.11.1.1 0 100 0 i
R2能正常发布BGP路由
[R3]display bgp routing-table
Total Number of Routes: 2
BGP Local router ID is 11.11.3.3
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
i 11.11.100.0/24 11.11.1.1 0 100 0 I
R3与R2为IBGP邻居,传递的BGP路由更新源不变(R1),对于R3来说R1更新源不可达,所以11.11.100.0不是最优路由,不能进入RIB
[R6]dis bgp routing-table
Total Number of Routes: 2
BGP Local router ID is 22.22.6.6
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
*> 11.11.100.0/24 11.11.2.2 0 11i
R6与R2为EBGP邻居,11.11.100.0下一跳地址变为R2跟新源,所以可达。
情景b
11.11.100.0/24在IGP中通告
R1配置:
Ospf 1
Area 0
Network 11.11.100.0 0.0.0.255
查看路由
[R2]display bgp routing-table
Total Number of Routes: 1
BGP Local router ID is 11.11.2.2
Status codes: * - valid, > - best, d - damped,
h - history, i - internal, s - suppressed, S - Stale
Origin : i - IGP, e - EGP, ? - incomplete
Network NextHop MED LocPrf PrefVal Path/Ogn
* i 11.11.100.0/24 11.11.1.1 0 100 0 i
[R2]display bgp routing-table 11.11.100.0
BGP local router ID : 11.11.2.2
Local AS number : 11
Paths: 1 available, 0 best
BGP routing table entry information of 11.11.100.0/24:
RR-client route.
From: 11.11.1.1 (11.11.100.1)
Relay Nexthop: 11.11.12.1
Original nexthop: 11.11.1.1
Convergence Priority: 0
AS-path Nil, origin igp, MED 0, localpref 100, pref-val 0, valid, internal, pre 255
Not advertised to any peer yet
因为路由协议进程优先级(思科:管理距离)的缘故R2使用11.11.100.0/24的ospf路由,所以BGP表中11.11.100.0/24不能假如路由表
所以R2不再把此路由通告给任何peer。
思科设备的测试:
情景a
不在IGP宣告11.11.100.0的路由
!
hostname R1
!
interface Loopback0
ip address 11.11.1.1 255.255.255.255
ip ospf network point-to-point
!
interface Loopback100
ip address 11.11.100.1 255.255.255.0
!
interface Serial2/2
ip address 11.11.12.1 255.255.255.252
serial restart-delay 0
!
router ospf 1
log-adjacency-changes
network 11.11.1.1 0.0.0.0 area 0
network 11.11.12.0 0.0.0.255 area 0
!
router bgp 11
no synchronization
bgp log-neighbor-changes
network 11.11.100.0 mask 255.255.255.0
neighbor 11.11.2.2 remote-as 11
neighbor 11.11.2.2 update-source Loopback0
no auto-summary
!
//R1没有在OSPF宣告11.11.100.0/24
hostname R2
!
interface Loopback0
ip address 11.11.2.2 255.255.255.255
!
interface Ethernet1/1
ip address 11.11.26.1 255.255.255.252
!
interface Serial2/2
ip address 11.11.12.2 255.255.255.252
serial restart-delay 0
!
interface Serial2/3
ip address 11.11.23.1 255.255.255.252
serial restart-delay 0
!
router ospf 1
log-adjacency-changes
network 11.11.2.2 0.0.0.0 area 0
network 11.11.12.0 0.0.0.255 area 0
!
router bgp 11
no synchronization
bgp log-neighbor-changes
neighbor 11.11.1.1 remote-as 11
neighbor 11.11.1.1 update-source Loopback0
neighbor 11.11.1.1 route-reflector-client
neighbor 11.11.3.3 remote-as 11
neighbor 11.11.3.3 update-source Loopback0
neighbor 11.11.6.6 remote-as 22
neighbor 11.11.6.6 ebgp-multihop 255
neighbor 11.11.6.6 update-source Loopback0
no auto-summary
ip route 11.11.3.3 255.255.255.255 11.11.23.2
ip route 11.11.6.6 255.255.255.255 11.11.26.2
!
hostname R3
!
interface Loopback0
ip address 11.11.3.3 255.255.255.255
!
interface Serial2/3
ip address 11.11.23.2 255.255.255.252
serial restart-delay 0
!
router bgp 11
no synchronization
bgp log-neighbor-changes
neighbor 11.11.2.2 remote-as 11
neighbor 11.11.2.2 update-source Loopback0
no auto-summary
!
ip route 11.11.2.2 255.255.255.255 11.11.23.1
hostname R6
!
interface Loopback0
ip address 11.11.6.6 255.255.255.255
!
interface Ethernet1/1
ip address 11.11.26.2 255.255.255.252
!
router bgp 22
no synchronization
bgp log-neighbor-changes
neighbor 11.11.2.2 remote-as 11
neighbor 11.11.2.2 ebgp-multihop 255
neighbor 11.11.2.2 update-source Loopback0
no auto-summary
!
ip route 11.11.2.2 255.255.255.255 11.11.26.1
查看路由表:
R2# sh ip bgp
BGP table version is 2, local router ID is 11.11.2.2
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
*>i11.11.100.0/24 11.11.1.1 0 100 0 i
R3# sh ip bgp
BGP table version is 2, local router ID is 11.11.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
* i11.11.100.0/24 11.11.1.1 0 100 0 i
//R3已经收到R2传递的路由,在R3上11.11.1.1不可达,所以11.11.100.0/24不是最优(>),不能进入RIB
R6#show ip bgp
BGP table version is 2, local router ID is 11.11.6.6
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
*> 11.11.100.0/24 11.11.2.2 0 11 I
R6能正常学习EBGP邻居R2传递的路由。
情况b
11.11.100.0/24在IGP中通告
R1配置:
Router Ospf 1
Network 11.11.100.0 0.0.0.255 a 0
查看路由表项:
R2#show ip bgp
BGP table version is 4, local router ID is 11.11.2.2
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
r>i11.11.100.0/24 11.11.1.1 0 100 0 i
R2#show ip bgp 11.11.100.0
BGP routing table entry for 11.11.100.0/24, version 4
Paths: (1 available, best #1, table default, RIB-failure(17))
Advertised to update-groups:
3 4
Local, (Received from a RR-client)
11.11.1.1 (metric 65) from 11.11.1.1 (11.11.1.1)
Origin IGP, metric 0, localpref 100, valid, internal, best
思科设备和华为设备的差异
R3#sh ip bgp
BGP table version is 2, local router ID is 11.11.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
* i11.11.100.0/24 11.11.1.1 0 100 0 I
R2正常传递加入RIB失败的路由(11.11.100.0/24)并且R3能正常学习。
R6#show ip bgp
BGP table version is 2, local router ID is 11.11.6.6
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
*> 11.11.100.0/24 11.11.2.2 0 11 i
R2正常传递加入RIB失败的路由(11.11.100.0/24)并且R6能正常学习。
总结:思科设备会传递BGP加入RIB失败的路由,华为设备则相反。
建议:
使用思科设备做为城域网核心路由器(如:12000系列、CRS系列)不需要在核心出口路由器做静态路由汇总
使用华为设备做为城域网核心路由器(NE80E、NE5000E)需要先在核心出口路由器做静态汇总路由,否则路由不会传递








发表评论 评论 (3 个评论)