部署RR
应用环境
在运行BGP的网络中,根据BGP发布路由的策略,BGP Speaker从IBGP对等体获得的路由不向它的IBGP对等体发布。因此,为了保证同一AS的各路由器之间的BGP连通性,这些路由器两两之间需要建立IBGP连接。假设在一个AS内部有n台路由器,那么应该建立的IBGP连接数就为n(n-1)/2。当IBGP连接数目很多时,对网络资源和CPU资源的消耗都很大。
利用路由反射可以解决这一问题。在一个AS内,其中一台路由器作为路由反射器RR(Route Reflector),其它路由器做为客户机(Client)。客户机与路由反射器之间建立IBGP连接。路由反射器和它的客户机组成一个集群(Cluster)。路由反射器在客户机之间传递(反射)路由信息,而客户机之间不需要建立BGP连接。
根据网络的结构和BGP路由器的数目,可对路由反射器进行分级。例如,可在核心层部署专用的一级RR,用于Internet和本ISP网络之间传递路由,并在核心层的BGP节点之间反射路由。在汇聚层部署二级RR,作为一级RR的Client,并在汇聚层各BGP节点之间反射路由。如果汇聚层或接入层网络结构明显,还可以继续部署三级、四级RR。
为增加网络的可靠性,防止单点故障,通常在一个Cluster中配置两个RR,互为备份。这两个RR同时作为上一级RR的Client。Cluster内的所有Client同时与这两个RR建立IBGP连接。若其中一台与某非客户机连接,另一台也与该客户机连接。同一个Cluster的RR一般不建立连接。
配置思路
在同一个Cluster内运行同一进程的IGP,使RR有到所有Client的路由。不同Cluster应使用不同IGP或相同IGP的不同的进程。
配置Client与RR之间,非Client与RR之间建立IBGP连接。
在RR上配置路由反射功能,指定其Client。
配置注意事项
同一Cluster的路由反射器配置相同的Cluster_ID,以避免路由环路。
组网需求
如下图,RR11和RR12为核心层设备,RR21、RR22、RT1、RT2、RT3及RT4为汇聚层设备。要求使用RR11和RR12作为一级反射器,在Internet和本ISP网络之间传递路由。使用RR21和RR22作为二级反射器,在一级反射器和汇聚层之间传递路由,并且RT1和RT2作为RR21的Client,RT3和RT4作为RR22的Client。一级RR及其Client属于Cluster11;RR21及其Client属于Cluster21;RR22及其Client属于Cluster22。
说明
实际组网中,二级反射器也通常有备份的RR。此例为了简化,只对一级RR做备份。
本例组网示意图中,每一台路由器上都需要创建环回接口(Loopback1)用于BGP会话。
BGP RR组网示意图
| 路由器 | 接口 | IP地址 |
| RR11 | LOOPBACK1 | 1.1.1.1/32 |
| POS1/0/0 | 100.11.1.1/30 | |
| POS1/0/1 | 100.12.1.1/30 | |
| GE2/0/0 | 200.1.1.1/30 | |
| RR12 | Loopback1 | 2.2.2.2/32 |
| POS1/0/0 | 100.13.1.1/30 | |
| POS1/0/1 | 100.14.1.1/30 | |
| GE2/0/0 | 200.2.1.1/30 | |
| RR21 | Loopback1 | 3.3.3.3/32 |
| POS2/0/0 | 100.11.1.2/30 | |
| POS2/0/1 | 100.13.1.2/30 | |
| GE1/0/0 | 100.21.1.1/30 | |
| GE1/0/1 | 100.21.2.1/30 | |
| RR22 | Loopback1 | 4.4.4.4/32 |
| POS2/0/0 | 100.12.1.2/30 | |
| POS2/0/1 | 100.14.1.2/30 | |
| GE1/0/0 | 100.22.1.1/30 | |
| GE1/0/1 | 100.22.2.1/30 | |
| RT1 | Loopback1 | 5.5.5.5/32 |
| GE1/0/0 | 100.21.1.2/30 | |
| RT2 | Loopback1 | 6.6.6.6/32 |
| GE1/0/0 | 100.21.2.2/30 | |
| RT3 | Loopback1 | 7.7.7.7/32 |
| GE1/0/0 | 100.22.1.2/30 | |
| RT4 | Loopback1 | 8.8.8.8/32 |
| GE1/0/0 | 100.22.2.2/30 |
适用产品和版本
采用NE系列路由器,版本为(VRP5.30)及后续版本。
说明
一级反射器推荐采用NE5000E、NE80E或NE40E;
二级反射器推荐采用NE80E、NE40E、NE80、NE40、NE20E、NE20、NE16E或NE08E;
RT1、RT2、RT3和RT4推荐采用NE80、NE40、NE20E、NE20、NE16E、NE08E或NE05。
配置步骤
步骤 1 在各路由器上配置接口的IP地址
# 在上图中的所有路由器上分别配置各接口的IP地址,Loopback接口的IP地址需要使用32位掩码。配置过程略。
步骤 2 在各路由器上配置IGP协议(以OSPF为例)
# 启动OSPF路由协议,发布各接口的路由。 # 配置RR11。 [RR11] ospf 1 [RR11-ospf-1] area 0 [RR11-ospf-1-area-0.0.0.0] network 1.1.1.1 0.0.0.0 [RR11-ospf-1-area-0.0.0.0] network 100.11.1.0 0.0.0.3 [RR11-ospf-1-area-0.0.0.0] network 100.12.1.0 0.0.0.3 [RR11-ospf-1-area-0.0.0.0] quit [RR11-ospf-1] quit # 配置RR12。 [RR12] ospf 1 [RR12-ospf-1] area 0 [RR12-ospf-1-area-0.0.0.0] network 2.2.2.2 0.0.0.0 [RR12-ospf-1-area-0.0.0.0] network 100.13.1.0 0.0.0.3 [RR12-ospf-1-area-0.0.0.0] network 100.14.1.0 0.0.0.3 [RR12-ospf-1-area-0.0.0.0] quit [RR12-ospf-1] quit # 配置RR21。 [RR21] ospf 1 [RR21-ospf-1] area 0 [RR21-ospf-1-area-0.0.0.0] network 100.11.1.0 0.0.0.3 [RR21-ospf-1-area-0.0.0.0] network 100.13.1.0 0.0.0.3 [RR21-ospf-1-area-0.0.0.0] quit [RR21-ospf-1] quit [RR21] ospf 2 [RR21-ospf-2] area 0 [RR21-ospf-2-area-0.0.0.0] network 1.1.1.1 0.0.0.0 [RR21-ospf-2-area-0.0.0.0] network 100.21.1.0 0.0.0.3 [RR21-ospf-2-area-0.0.0.0] network 100.21.2.0 0.0.0.3 [RR21-ospf-2-area-0.0.0.0] quit [RR21-ospf-2] quit # 配置RR22。 [RR22] ospf 1 [RR22-ospf-1] area 0 [RR22-ospf-1-area-0.0.0.0] network 100.12.1.0 0.0.0.3 [RR22-ospf-1-area-0.0.0.0] network 100.14.1.0 0.0.0.3 [RR22-ospf-1-area-0.0.0.0] quit [RR22-ospf-1] quit [RR22] ospf 3 [RR22-ospf-3] area 0 [RR22-ospf-3-area-0.0.0.0] network 1.1.1.1 0.0.0.0 [RR22-ospf-3-area-0.0.0.0] network 100.22.1.0 0.0.0.3 [RR22-ospf-3-area-0.0.0.0] network 100.22.2.0 0.0.0.3 [RR22-ospf-3-area-0.0.0.0] quit [RR22-ospf-3] quit
配置完成后,直连的两个路由器之间应能建立OSPF邻居关系,执行display ospf peer命令可以看到邻居状态为Full。执行display ip routing-table命令可以看到PE之间学习到对方的Loopback1路由。
以RR21的显示为例:
<RR21> display ip routing-table
Routing Tables: Public
Destinations : 21 Routes : 21
Destination/Mask Proto Pre Cost NextHop Interface
1.1.1.1/32 OSPF 10 1 100.11.1.1 Pos2/0/0
2.2.2.2/32 OSPF 10 1 100.13.1.1 Pos2/0/1
3.3.3.3/32 Direct 0 0 127.0.0.1 InLoopBack0
5.5.5.5/32 OSPF 10 1 100.21.1.2 GigabitEthernet1/0/0
6.6.6.6/32 OSPF 10 1 100.21.2.2 GigabitEthernet1/0/1
100.11.1.0/30 Direct 0 0 100.11.1.2 Pos2/0/0
100.11.1.1/32 Direct 0 0 100.11.1.1 Pos2/0/0
100.11.1.2/32 Direct 0 0 127.0.0.1 InLoopBack0
100.12.1.0/30 OSPF 10 2 100.11.1.1 Pos2/0/0
100.13.1.0/30 Direct 0 0 100.13.1.2 Pos2/0/1
100.13.1.1/32 Direct 0 0 100.13.1.1 Pos2/0/1
100.13.1.2/32 Direct 0 0 127.0.0.1 InLoopBack0
100.14.1.0/30 OSPF 10 3 100.11.1.1 Pos2/0/0
100.21.1.0/30 Direct 0 0 100.21.1.1 GigabitEthernet1/0/0
100.21.1.1/32 Direct 0 0 127.0.0.1 InLoopBack0
100.21.1.2/32 Direct 0 0 100.21.1.2 GigabitEthernet1/0/0
100.21.2.0/30 Direct 0 0 100.21.2.1 GigabitEthernet1/0/1
100.21.2.1/32 Direct 0 0 127.0.0.1 InLoopBack0
100.21.2.2/32 Direct 0 0 100.21.2.2 GigabitEthernet1/0/1
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoopBack0
<RR21> display ospf peer
OSPF Process 1 with Router ID 3.3.3.3
Neighbors
Area 0.0.0.0 interface 100.11.1.2(Pos2/0/0)'s neighbors
Router ID: 1.1.1.1 Address: 100.11.1.1 GR State: Normal
State: Full Mode:Nbr is Slave Priority: 1
DR: None BDR: None MTU: 0
Dead timer due in 37 sec
Neighbor is up for 00:38:07
Authentication Sequence: [ 0 ]
Neighbors
Area 0.0.0.0 interface 100.13.1.2(Pos2/0/1)'s neighbors
Router ID: 2.2.2.2 Address: 100.13.1.1 GR State: Normal
State: Full Mode:Nbr is Slave Priority: 1
DR: None BDR: None MTU: 0
Dead timer due in 30 sec
Neighbor is up for 00:33:20
Authentication Sequence: [ 0 ]
OSPF Process 2 with Router ID 3.3.3.3
Neighbors
Area 0.0.0.0 interface 100.21.2.1(GigabitEthernet1/0/1)'s neighbors
Router ID: 6.6.6.6 Address: 100.21.2.2 GR State: Normal
State: Full Mode:Nbr is Master Priority: 1
DR: None BDR: None MTU: 0
Dead timer due in 33 sec
Neighbor is up for 00:19:43
Authentication Sequence: [ 0 ]
Neighbors
Area 0.0.0.0 interface 100.21.1.1(GigabitEthernet1/0/0)'s neighbors
Router ID: 5.5.5.5 Address: 100.21.1.2 GR State: Normal
State: Full Mode:Nbr is Master Priority: 1
DR: None BDR: None MTU: 0
Dead timer due in 32 sec
Neighbor is up for 00:18:20
Authentication Sequence: [ 0 ]
步骤 3 在一级RR上配置到二级RR的Loopback接口的路由并发布该路由
# 以上配置完成后,RR11和RR12上还没有到RR21和RR22的Loopback接口的路由,可以配置静态路由,并使用BGP发布该路由。 # 配置RR11。 [RR11] ip route-static 3.3.3.3 32 100.11.1.2 [RR11] ip route-static 4.4.4.4 32 100.12.1.2 [RR11] bgp 100 [RR11-bgp] network 3.3.3.3 0 [RR11-bgp] network 4.4.4.4 0 # 配置RR12。 [RR12] ip route-static 3.3.3.3 32 100.13.1.2 [RR12] ip route-static 4.4.4.4 32 100.14.1.2 [RR12] bgp 100 [RR12-bgp] network 3.3.3.3 0 [RR12-bgp] network 4.4.4.4 0
步骤 4 配置IBGP连接,并引入直连路由和OSPF路由
# 在RR及其Client之间建立IBGP连接。 # 配置RR11。 [RR11] bgp 100 [RR11-bgp] group rr1 internal [RR11-bgp] peer rr1 connect-interface loopback 1 [RR11-bgp] peer 3.3.3.3 group rr1 [RR11-bgp] peer 4.4.4.4 group rr1 [RR11-bgp] import-route direct [RR11-bgp] import-route ospf 1 # 配置RR12。 [RR12] bgp 100 [RR12-bgp] group rr2 internal [RR12-bgp] peer rr2 connect-interface LoopBack 1 [RR12-bgp] peer 3.3.3.3 group rr2 [RR12-bgp] peer 4.4.4.4 group rr2 [RR12-bgp] import-route direct [RR12-bgp] import-route ospf 1 # 配置RR21。 [RR21-bgp] peer 1.1.1.1 as-number 100 [RR21-bgp] peer 1.1.1.1 connect-interface LoopBack 1 [RR21-bgp] peer 2.2.2.2 as-number 100 [RR21-bgp] peer 2.2.2.2 connect-interface LoopBack 1 [RR21-bgp] group rr3 [RR21-bgp] peer rr3 connect-interface LoopBack1 [RR21-bgp] peer 5.5.5.5 group rr3 [RR21-bgp] peer 6.6.6.6 group rr3 [RR21-bgp] import-route direct [RR21-bgp] import-route ospf 1 [RR21-bgp] import-route ospf 2 # 配置RR22。 [RR22-bgp] peer 1.1.1.1 as-number 100 [RR22-bgp] peer 1.1.1.1 connect-interface LoopBack 1 [RR22-bgp] peer 2.2.2.2 as-number 100 [RR22-bgp] peer 2.2.2.2 connect-interface LoopBack 1 [RR22-bgp] group rr4 [RR22-bgp] peer rr4 connect-interface LoopBack 1 [RR22-bgp] peer 7.7.7.7 group rr4 [RR22-bgp] peer 8.8.8.8 group rr4 [RR22-bgp] import-route direct [RR22-bgp] import-route ospf 1 [RR22-bgp] import-route ospf 3 # 配置RT1。 [RT1] bgp 100 [RT1-bgp] peer 3.3.3.3 as-number 100 [RT1-bgp] peer 3.3.3.3 connect-interface LoopBack 1 [RT1-bgp] import-route direct [RT1-bgp] import-route ospf 2 # 配置RT2。 [RT21] bgp 100 [RT2-bgp] peer 3.3.3.3 as-number 100 [RT2-bgp] peer 3.3.3.3 connect-interface LoopBack 1 [RT2-bgp] import-route direct [RT2-bgp] import-route ospf 2 # 配置RT3。 [RT3] bgp 100 [RT3-bgp] peer 4.4.4.4 as-number 100 [RT3-bgp] peer 4.4.4.4 connect-interface LoopBack 1 [RT3-bgp] import-route direct [RT3-bgp] import-route ospf 3 # 配置RT4。 [RT4] bgp 100 [RT4-bgp] peer 4.4.4.4 as-number 100 [RT4-bgp] peer 4.4.4.4 connect-interface LoopBack 1 [RT4-bgp] import-route direct [RT4-bgp] import-route ospf 3
完成此步骤后,在各路由器上执行display bgp peer命令,可看到IBGP连接的状态都为“Established”。以RR21的显示为例:
[RR21-bgp] display bgp peer
BGP local router ID : 3.3.3.3
Local AS number : 100
Total number of peers : 4 Peers in established state : 4
Peer V AS MsgRcvd MsgSent OutQ Up/Down State PrefRcv
1.1.1.1 4 100 14 14 0 00:09:39 Established 0
2.2.2.2 4 100 12 13 0 00:09:14 Established 0
5.5.5.5 4 100 5 5 0 00:02:38 Established 0
6.6.6.6 4 100 4 4 0 00:02:17 Established 0
步骤 5 配置路由反射器功能。
# 配置RR11。 [RR11] bgp 100 [RR11-bgp] reflector cluster-id 1 [RR11-bgp] peer rr1 reflect-client # 配置RR12。 [RR12] bgp 100 [RR12-bgp] reflector cluster-id 1 [RR12-bgp] peer rr2 reflect-client # 配置RR21。 [RR21] bgp 100 [RR21-bgp] reflector cluster-id 2 [RR21-bgp] peer rr3 reflect-client # 配置RR22。 [RR22] bgp 100 [RR22-bgp] reflector cluster-id 3 [RR22-bgp] peer rr4 reflect-client
完成此步骤后,在各RR上执行display bgp routing-table peer peer-ip-address advertised-routes命令,可看到RR的路由反射情况。以RR11为例,RR11把Cluster21的路由发布给了RR22。
[RR11] display bgp routing-table peer 4.4.4.4 advertised-routes
Total Number of Routes: 19
BGP Local router ID is 1.1.1.1
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
*> 1.1.1.1/32 0.0.0.0 0 0 ?
*> 2.2.2.2/32 0.0.0.0 2 0 ?
*> 3.3.3.3/32 0.0.0.0 0 0 i
*> 4.4.4.4/32 0.0.0.0 0 0 i
*>i 5.5.5.5/32 3.3.3.3 1 100 0 ?
*>i 6.6.6.6/32 3.3.3.3 1 100 0 ?
*> 100.11.1.0/30 0.0.0.0 0 0 ?
*> 100.11.1.2/32 0.0.0.0 0 0 ?
*> 100.12.1.0/30 0.0.0.0 0 0 ?
*> 100.12.1.2/32 0.0.0.0 0 0 ?
*> 100.13.1.0/30 0.0.0.0 2 0 ?
*>i 100.13.1.1/32 3.3.3.3 0 100 0 ?
*> 100.14.1.0/30 0.0.0.0 2 0 ?
*>i 100.21.1.0/30 3.3.3.3 0 100 0 ?
*>i 100.21.1.2/32 3.3.3.3 0 100 0 ?
*>i 100.21.2.0/30 3.3.3.3 0 100 0 ?
*>i 100.21.2.2/32 3.3.3.3 0 100 0 ?
*> 200.1.1.0/30 0.0.0.0 0 0 ?
*> 200.1.1.2/32 0.0.0.0 0 0 ?
步骤 6 配置向Internet发布本ISP的路由,并在一级RR上配置引入Internet路由
# 配置向Internet发布本ISP的路由,此处略。此外,还需要在一级RR上配置引入Internet路由。此处以配置默认路由为例:
说明
这里的200.1.1.2是指Internet路由器连接RR11的接口的IP地址;200.2.1.2是指Internet路由器连接RR12的接口的IP地址。
# 配置RR11。 [RR11] ip route-static 0.0.0.0 0 200.1.1.2 [RR11] bgp 100 [RR11-bgp] network 0.0.0.0 0 # 配置RR12。 [RR12] ip route-static 0.0.0.0 0 200.2.1.2 [RR12] bgp 100 [RR12-bgp] network 0.0.0.0 0
验证结果
如果配置成功,则:
在各个路由器上执行display ip routing-table命令,可以看到各个路由器不仅有所属Cluster的路由,而且还有其他Cluster的路由和Internet路由(0.0.0.0/0)。
以RT3的显示为例:
<RT3> display ip routing-table
Routing Tables: Public
Destinations : 35 Routes : 35
Destination/Mask Proto Pre Cost NextHop Interface
0.0.0.0/0 BGP 255 3 1.1.1.1 GigabitEthernet1/0/0
1.1.1.1/32 BGP 255 1 4.4.4.4 GigabitEthernet1/0/0
2.2.2.2/32 BGP 255 3 4.4.4.4 GigabitEthernet1/0/0
3.3.3.3/32 BGP 255 0 1.1.1.1 GigabitEthernet1/0/0
4.4.4.4/32 OSPF 10 1 100.22.1.1 GigabitEthernet1/0/0
5.5.5.5/32 BGP 255 1 3.3.3.3 GigabitEthernet1/0/0
6.6.6.6/32 BGP 255 1 3.3.3.3 GigabitEthernet1/0/0
7.7.7.7/32 Direct 0 0 127.0.0.1 InLoopBack0
8.8.8.8/32 OSPF 10 2 100.22.1.1 GigabitEthernet1/0/0
100.4.1.0/30 BGP 255 0 2.2.2.2 GigabitEthernet1/0/0
100.4.1.1/32 BGP 255 0 4.4.4.4 GigabitEthernet1/0/0
100.11.1.0/30 BGP 255 2 4.4.4.4 GigabitEthernet1/0/0
100.11.1.1/32 BGP 255 0 3.3.3.3 GigabitEthernet1/0/0
100.11.1.2/32 BGP 255 0 1.1.1.1 GigabitEthernet1/0/0
100.12.1.0/30 BGP 255 0 4.4.4.4 GigabitEthernet1/0/0
100.12.1.1/32 BGP 255 0 4.4.4.4 GigabitEthernet1/0/0
100.13.1.0/30 BGP 255 3 4.4.4.4 GigabitEthernet1/0/0
100.13.1.1/32 BGP 255 0 3.3.3.3 GigabitEthernet1/0/0
100.13.1.2/32 BGP 255 0 2.2.2.2 GigabitEthernet1/0/0
100.14.1.0/30 BGP 255 0 4.4.4.4 GigabitEthernet1/0/0
100.21.1.0/30 BGP 255 0 3.3.3.3 GigabitEthernet1/0/0
100.21.1.2/32 BGP 255 0 3.3.3.3 GigabitEthernet1/0/0
100.21.2.0/30 BGP 255 0 3.3.3.3 GigabitEthernet1/0/0
100.21.2.2/32 BGP 255 0 3.3.3.3 GigabitEthernet1/0/0
100.22.1.0/30 Direct 0 0 100.22.1.2 GigabitEthernet1/0/0
100.22.1.1/32 Direct 0 0 100.22.1.1 GigabitEthernet1/0/0
100.22.1.2/32 Direct 0 0 127.0.0.1 InLoopBack0
100.22.2.0/30 OSPF 10 2 100.22.1.1 GigabitEthernet1/0/0
100.22.2.2/32 BGP 255 0 4.4.4.4 GigabitEthernet1/0/0
127.0.0.0/8 Direct 0 0 127.0.0.1 InLoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 InLoopBack0
200.1.1.0/30 BGP 255 0 1.1.1.1 GigabitEthernet1/0/0
200.1.1.2/32 BGP 255 0 1.1.1.1 GigabitEthernet1/0/0
200.2.1.0/30 BGP 255 0 2.2.2.2 GigabitEthernet1/0/0
200.2.1.2/32 BGP 255 0 2.2.2.2 GigabitEthernet1/0/0





