为什么需要路由反射器就是为了打破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全连接或二级路由反射解决路由反射问题。
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的:
*> 10.7.0.0/16 0.0.0.0 0 32768 i
首先由R7始发路由,所以下一跳为0.0.0.0,本地始发Weight为32768
然后传播到R6,其它的路由都是由RR反射过来的,