为什么需要路由反射器就是为了打破BGP中从IBGP学到的路由不能再传给IBGP(防止环路),那用什么来防止环路呢?利用Originator_ID和Cluster_List,收到Originator_ID和本地的Router ID,如果两个ID相同,BGP 路由器会忽略掉这条路由,不做处理。更详细的内容请见前面http://tangfangxiao.blog.51cto.com/2116646/646077
组网需求:
1.R1、R2、R3、R4、R5、R6、R7处于同一AS 10
2.R8处于AS30,R9处于AS20,它们之间通过EBGP与AS10进行通信。
3.在R1发布汇总静态路由10.0.0.0/16至BGP、在R5发布汇总静态路由10.5.0.0/16至BGP、
在R7发布汇总静态路由10.7.0.0/16至BGP、在R8发布汇总静态路由10.8.0.0/16至BGP、
在R9发布汇总静态路由10.9.0.0/16至BGP。
4.运用RR全连接或二级路由反射解决路由反射问题。
AS10 IGP配置如下:
R1:
router ospf 1
router-id 10.0.0.1
passive-interface Ethernet0/0
network 10.0.14.0 0.0.0.3 area 0
network 10.0.16.0 0.0.0.3 area 0
network 10.0.12.0 0.0.0.3 area 0
network 10.0.13.0 0.0.0.3 area 0
network 10.0.18.0 0.0.0.3 area 0(上面拓扑写错了,是10.0.18.0/30)
network 10.0.0.1 0.0.0.0 area 0
R2:
router ospf 1
router-id 10.0.0.2
passive-interface Ethernet0/1
network 10.0.0.2 0.0.0.0 area 0
network 10.0.12.0 0.0.0.3 area 0
network 10.0.29.0 0.0.0.3 area 0
R3:
router ospf 1
router-id 10.0.0.3
network 10.0.0.3 0.0.0.0 area 0
network 10.0.13.0 0.0.0.3 area 0
R4:
router ospf 1
router-id 10.0.0.4
network 10.0.0.4 0.0.0.0 area 0
network 10.0.14.0 0.0.0.3 area 0
network 10.0.45.0 0.0.0.3 area 0
R5:
router ospf 1
router-id 10.0.0.5
network 10.0.0.5 0.0.0.0 area 0
network 10.0.45.0 0.0.0.3 area 0
R6:
router ospf 1
router-id 10.0.0.6
network 10.0.0.6 0.0.0.0 area 0
network 10.0.16.0 0.0.0.3 area 0
network 10.0.67.0 0.0.0.3 area 0
R7:
router ospf 1
router-id 10.0.0.7
network 10.0.0.7 0.0.0.0 area 0
network 10.0.67.0 0.0.0.3 area 0
现在AS内可以连通了,开始配置BGP:
在R1、R4、R6上配置成RR,R2、R3为R1的客户端,R5为R4的客户端,R7为R6的客户端,R1与R8建立EBGP,R2与R9建立EBGP。
R1:
router bgp 10
no synchronization //关闭同步
network 10.0.0.0 //静态发布BGP路由汇总
neighbor rrc peer-group //创建一个名为rrc对等组(共享同一BGP策略)
neighbor rrc remote-as 10 //指定邻居AS为10
neighbor rrc update-source Loopback0 //指定更新源为LOOP 0
neighbor rrc route-reflector-client //指定为RR的客户端RRC
neighbor rrc next-hop-self //将下一条改变为自己
neighbor 10.0.0.2 peer-group rrc //指定邻居使用对等组策略
neighbor 10.0.0.3 peer-group rrc //指定邻居使用对等组策略
neighbor 10.0.0.4 remote-as 10
neighbor 10.0.0.4 update-source Loopback0
neighbor 10.0.0.4 next-hop-self
neighbor 10.0.0.6 remote-as 10
neighbor 10.0.0.6 update-source Loopback0
neighbor 10.0.0.6 next-hop-self
neighbor 10.0.18.2 remote-as 30
no auto-summary //关闭自动汇总
ip route 10.0.0.0 255.0.0.0 Null0 //添加汇总静态路由
R2:
router bgp 10 //RRC只需在RR上配置,RRC只要配置IGBP
no synchronization
neighbor 10.0.0.1 remote-as 10
neighbor 10.0.0.1 update-source Loopback0
neighbor 10.0.0.1 next-hop-self
neighbor 10.0.29.2 remote-as 20 //配置EBGP邻居
no auto-summary
R3:
router bgp 10 //RRC只需在RR上配置,RRC只要配置IGBP
no synchronization
neighbor 10.0.0.1 remote-as 10
neighbor 10.0.0.1 update-source Loopback0
neighbor 10.0.0.1 next-hop-self
no auto-summary
R4:
router bgp 10 //配置成RR,客户端为R5
no synchronization
neighbor rrc peer-group
neighbor rrc remote-as 10
neighbor rrc update-source Loopback0
neighbor rrc route-reflector-client
neighbor rrc next-hop-self
neighbor 10.0.0.1 remote-as 10
neighbor 10.0.0.1 update-source Loopback0
neighbor 10.0.0.1 next-hop-self
neighbor 10.0.0.5 peer-group rrc
no auto-summary
R5:
router bgp 10
no synchronization
network 10.5.0.0 mask 255.255.0.0 //发布路由到BGP
neighbor 10.0.0.4 remote-as 10
neighbor 10.0.0.4 update-source Loopback0
neighbor 10.0.0.4 next-hop-self
no auto-summary
ip route 10.5.0.0 255.255.0.0 Null0 //添加汇总静态路由
R6:
router bgp 10 //配置成RR,RRC为R7
no synchronization
neighbor rrc peer-group
neighbor rrc remote-as 10
neighbor rrc update-source Loopback0
neighbor rrc route-reflector-client
neighbor rrc next-hop-self
neighbor 10.0.0.1 remote-as 10
neighbor 10.0.0.1 update-source Loopback0
neighbor 10.0.0.1 next-hop-self
neighbor 10.0.0.7 peer-group rrc
no auto-summary
R7:
router bgp 10
no synchronization
network 10.7.0.0 mask 255.255.0.0 //发布到BGP
neighbor 10.0.0.6 remote-as 10
neighbor 10.0.0.6 update-source Loopback0
neighbor 10.0.0.6 next-hop-self
no auto-summary
ip route 10.7.0.0 255.255.0.0 Null0 //添加汇总静态路由
R8:
router bgp 30 //配置EBGP
no synchronization
network 10.8.0.0 mask 255.255.0.0
neighbor 10.0.18.1 remote-as 10 //发布到BGP中
no auto-summary
ip route 10.8.0.0 255.255.0.0 Null0 //添加汇总静态路由
R9:
router bgp 20
no synchronization
network 10.9.0.0 mask 255.255.0.0 //发布到BGP中
neighbor 10.0.29.1 remote-as 10
no auto-summary
ip route 10.9.0.0 255.255.0.0 Null0 //添加汇总静态路由
现在我们可以看到R9能够学习到所有路由,R8也一样:
Network Next Hop Metric LocPrf Weight Path
*> 10.0.0.0 10.0.29.1 0 10 i
*> 10.5.0.0/16 10.0.29.1 0 10 i
*> 10.7.0.0/16 10.0.29.1 0 10 i
*> 10.8.0.0/16 10.0.29.1 0 10 30 i
*> 10.9.0.0/16 0.0.0.0 0 32768 i
我们来分析一下10.7.0.0/16路由是怎么传播到R9的:
R7: Network Next Hop Metric LocPrf Weight Path
*>i10.0.0.0 10.0.0.1 0 100 0 i
*> 10.7.0.0/16 0.0.0.0 0 32768 i
*>i10.8.0.0/16 10.0.0.1 0 100 0 30 i
*>i10.9.0.0/16 10.0.0.2 0 100 0 20 i
首先由R7始发路由,所以下一跳为0.0.0.0,本地始发Weight为32768
然后传播到R6,其它的路由都是由RR反射过来的,
这里显示从RRC10.0.0.7学习到的路由,下一跳开销为101跟OSPF里的值一样,Origin为IGP,由静态发布IGP到BGP中的,MED值默认为0,本地优先级(localpref)默认为100,此路由是有效的,域内的,最优的
从RRC学习到的路由,传播给它的非客户端R1,
由RR反射过来的路由,不会改变下一跳等信息,起源ID为AS始发路由器ID 10.0.0.7,簇列表为RR的ROUTER-ID10.0.0.6,只经过了一个RR反射!
现在我们看一下R4的路由表:
Network Next Hop Metric LocPrf Weight Path
*>i10.0.0.0 10.0.0.1 0 100 0 i
*>i10.5.0.0/16 10.0.0.5 0 100 0 i
*>i10.8.0.0/16 10.0.0.1 0 100 0 30 i
*>i10.9.0.0/16 10.0.0.2 0 100 0 20 i
很显然没有10.7.0.0/16这条路由。因为从非客户端学习到的路由只会传给RRC,同理RR、R7没有10.5.0.0/16这条路由。
解决方法:1.统一由R1做RR,AS内其它路由器都作为R1的客户端
2.RR之间全连接
3.二级路由反射,R4,R6作为R1的客户端
4.用联盟
方法-:容易造成单点故障,当核心节点失效后,整个网络将不能互访
配置如下(R2、R3配置不变):
R1:
no router bgp 10 //清除前面的配置
router bgp 10
no synchronization
network 10.0.0.0
neighbor rrc peer-group
neighbor rrc remote-as 10
neighbor rrc update-source Loopback0
neighbor rrc route-reflector-client
neighbor rrc next-hop-self
neighbor 10.0.0.2 peer-group rrc
neighbor 10.0.0.4 peer-group rrc
neighbor 10.0.0.3 peer-group rrc
neighbor 10.0.0.5 peer-group rrc
neighbor 10.0.0.6 peer-group rrc
neighbor 10.0.0.7 peer-group rrc
neighbor 10.0.18.2 remote-as 30
no auto-summary
R4:
no router bgp 10 //清除前面的配置
router bgp 10
no synchronization
neighbor 10.0.0.1 remote-as 10
neighbor 10.0.0.1 update-source Loopback0
neighbor 10.0.0.1 next-hop-self
no auto-summary
R5:
no router bgp 10 //清除前面的配置
router bgp 10
no synchronization
bgp log-neighbor-changes
network 10.5.0.0 mask 255.255.0.0
neighbor 10.0.0.1 remote-as 10
neighbor 10.0.0.1 update-source Loopback0
neighbor 10.0.0.1 next-hop-self
no auto-summary
R6:
no router bgp 10 //清除前面的配置
router bgp 10
neighbor 10.0.0.1 remote-as 10
neighbor 10.0.0.1 update-source Loopback0
neighbor 10.0.0.1 next-hop-self
no auto-summary
R7:
no router bgp 10 //清除前面的配置
router bgp 10
no synchronization
network 10.7.0.0 mask 255.255.0.0
neighbor 10.0.0.1 remote-as 10
neighbor 10.0.0.1 update-source Loopback0
neighbor 10.0.0.1 next-hop-self
no auto-summary
Network Next Hop Metric LocPrf Weight Path
*>i10.0.0.0 10.0.0.1 0 100 0 i
*>i10.5.0.0/16 10.0.0.5 0 100 0 i
*> 10.7.0.0/16 0.0.0.0 0 32768 i
*>i10.8.0.0/16 10.0.0.1 0 100 0 30 i
*>i10.9.0.0/16 10.0.0.2 0 100 0 20 i
现在在R7上看有整个网络的路由了!
方法二:很简单,在R4和R6之间再建立一个IBGP,路由器多的时候就有得忙了
在原来的配置上再加入以下配置:
R4:
neighbor 10.0.0.6 remote-as 10
neighbor 10.0.0.6 update-source loop 0
neighbor 10.0.0.6 next-hop-self
R6:
neighbor 10.0.0.4 remote-as 10
neighbor 10.0.0.4 update-source loop 0
neighbor 10.0.0.4 next-hop-self
这个方法简单吧
方法三:也很简单,用得也比较多
neighbor 10.0.0.4 remote-as 10 //也可以直接加在前面那个对等组里,就更简单了
neighbor 10.0.0.4 update-source Loopback0 //方便大家理解就写多点
neighbor 10.0.0.4 route-reflector-client
neighbor 10.0.0.4 next-hop-self
neighbor 10.0.0.6 remote-as 10
neighbor 10.0.0.6 update-source Loopback0
neighbor 10.0.0.6 route-reflector-client
neighbor 10.0.0.6 next-hop-self
就这么简单没了
由于字数限制,所以只能发在下一篇
转载于:https://blog.51cto.com/tangfangxiao/647833