全部博文(102)
分类: 系统运维
2008-09-09 09:32:44
路由器 | 接口 | IP地址 |
RR11 | loopback1 | 1.1.1.1/32 |
R11 | POS1/0/0 | 100.11.1.1/30 |
R11 | POS1/0/1 | 100.12.1.1/30 |
RR11 | GE2/0/0 | 200.1.1.1/30 |
根据网络的结构和BGP路由器的数目,可对路由反射器进行分级。例如,可在核心层部署专用的一级RR,用于Internet和本ISP网络之间传递路由,并在核心层的BGP节点之间反射路由。在汇聚层部署二级RR,作为一级RR的Client,并在汇聚层各BGP节点之间反射路由。如果汇聚层或接入层网络结构明显,还可以继续部署三级、四级RR。
为增加网络的可靠性,防止单点故障,通常在一个Cluster中配置两个RR,互为备份。这两个RR同时作为上一级RR的Client。Cluster内的所有Client同时与这两个RR建立IBGP连接。若其中一台与某非客户机连接,另一台也与该客户机连接。同一个Cluster的RR一般不建立连接。
配置思路
1 在同一个cluster内运行同一个进程的IGP.使RR有到所有client的路由。不同cluster 使用不同IGP或者相同的IGP的不同进程。
2 配置client与RR之间,非Client与RR之间建立iBGP连接、
3 在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会
配置步骤1
1 在各个路由器上配置接口的IP地址并且配置32位的loopback
2 配置IGP(OSPF为例子)
启动OSPF路由器协议,发布各个接口的路由
首先开始配置RR11
[RR11]ospf 1
[RR11-ospf-1]area 0
[RR11-ospf-1-0.0.0.0]network 1.1.1.1 0.0.0.0
[RR11-ospf-1-0.0.0.0]network 100.11.1.0 0.0.0.3
[RR11-ospf-1-0.0.0.0]network 100.12.1.0 0.0.0.3
配置RR12
[RR12]ospf 1
[RR12-ospf-1]area 0
[RR12-ospf-1-0.0.0.0]network 2.2.2.2 0.0.0.0
[RR12-ospf-1-0.0.0.0]network 100.13.1.0 0.0.0.3
[RR12-ospf-1-0.0.0.0]network 100.14.1.0 0.0.0.3
配置RR21
[RR21]ospf 1
[RR21-ospf-1]area 0
[RR212-ospf-1-0.0.0.0]network 100.11.1.0 0.0.0.3
[RR21-ospf-1-0.0.0.0]network 100.13.1.0 0.0.0.3
[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
配置RR22
[RR22]ospf 1
[R22-ospf-1]area 0
[R22-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 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
以上配置结束后,RR11和RR12没有到RR21和RR22的loopback接口的路由信息,可以胚子,并且使用BGP发布该路由
R11的配置
[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
配置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的显示为例:
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
#
sysname RR11
#
interface GigabitEthernet2/0/0
ip address 200.1.1.1 255.255.255.252
undo shutdown
#
interface Pos1/0/0
link-protocol ppp
ip address 100.11.1.1 255.255.255.252
#
interface Pos1/0/1
link-protocol ppp
ip address 100.12.1.1 255.255.255.252
#
interface LoopBack1
ip address 1.1.1.1 255.255.255.255
#
bgp 100
group rr1 internal
peer rr1 connect-interface LoopBack1
peer 3.3.3.3 as-number 100
peer 3.3.3.3 group rr1
peer 4.4.4.4 as-number 100
peer 4.4.4.4 group rr1
#
ipv4-family unicast
undo synchronization
reflector cluster-id 1
network 3.3.3.3 255.255.255.255
network 4.4.4.4 255.255.255.255
import-route direct
import-route ospf 1
peer rr1 enable
peer rr1 reflect-client
peer 3.3.3.3 enable
peer 3.3.3.3 group rr1
peer 4.4.4.4 enable
peer 4.4.4.4 group rr1
#
ospf 1
area 0.0.0.0
network 100.11.1.0 0.0.0.3
network 100.12.1.0 0.0.0.3
network 1.1.1.1 0.0.0.0
#
ip route-static 3.3.3.3 255.255.255.255 100.11.1.2
ip route-static 4.4.4.4 255.255.255.255 100.12.1.2
#
return
#
sysname RR12
#
interface GigabitEthernet2/0/0
ip address 200.2.1.1 255.255.255.252
undo shutdown
#
interface Pos1/0/0
link-protocol ppp
ip address 100.13.1.1 255.255.255.252
#
interface Pos1/0/1
link-protocol ppp
ip address 100.4.1.1 255.255.255.252
#
interface LoopBack1
ip address 2.2.2.2 255.255.255.255
#
bgp 100
group rr2 internal
peer rr2 connect-interface LoopBack1
peer 3.3.3.3 as-number 100
peer 3.3.3.3 group rr2
peer 4.4.4.4 as-number 100
peer 4.4.4.4 group rr2
#
ipv4-family unicast
undo synchronization
reflector cluster-id 1
network 3.3.3.3 255.255.255.255
network 4.4.4.4 255.255.255.255
import-route direct
import-route ospf 1
peer rr2 enable
peer rr2 reflect-client
peer 3.3.3.3 enable
peer 3.3.3.3 group rr2
peer 4.4.4.4 enable
peer 4.4.4.4 group rr2
#
ospf 1
area 0.0.0.0
network 2.2.2.2 0.0.0.0
network 100.13.1.0 0.0.0.3
network 100.14.1.0 0.0.0.3
#
ip route-static 3.3.3.3 255.255.255.255 100.13.1.2
ip route-static 4.4.4.4 255.255.255.255 100.14.1.2
#
return
#
sysname RR21
#
interface GigabitEthernet1/0/0
ip address 100.21.1.1 255.255.255.252
undo shutdown
#
Interface GigabitEthernet1/0/1
ip address 100.21.2.1 255.255.255.252
undo shutdown
#
interface Pos2/0/0
link-protocol ppp
ip address 100.11.1.2 255.255.255.252
#
interface Pos2/0/1
link-protocol ppp
ip address 100.13.1.2 255.255.255.252
#
interface LoopBack1
ip address 3.3.3.3 255.255.255.255
#
bgp 100
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack1
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack1
group rr3 internal
peer rr3 connect-interface LoopBack1
peer 5.5.5.5 as-number 100
peer 5.5.5.5 group rr3
peer 6.6.6.6 as-number 100
peer 6.6.6.6 group rr3
#
ipv4-family unicast
undo synchronization
reflector cluster-id 2
import-route direct
import-route ospf 1
import-route ospf 2
peer 1.1.1.1 enable
peer 2.2.2.2 enable
peer rr3 enable
peer rr3 reflect-client
peer 5.5.5.5 enable
peer 5.5.5.5 group rr3
peer 6.6.6.6 enable
peer 6.6.6.6 group rr3
#
ospf 1
area 0.0.0.0
network 100.11.1.0 0.0.0.3
network 100.13.1.0 0.0.0.3
#
ospf 2
import-route static
area 0.0.0.0
network 100.21.1.0 0.0.0.3
network 100.21.2.0 0.0.0.3
network 3.3.3.3 0.0.0.0
#
return
#
sysname RR22
#
interface GigabitEthernet1/0/0
ip address 100.22.1.1 255.255.255.252
undo shutdown
#
interface GigabitEthernet1/0/1
ip address 100.22.2.1 255.255.255.252
undo shutdown
#
interface Pos2/0/0
link-protocol ppp
ip address 100.12.1.2 255.255.255.252
#
interface Pos2/0/1
link-protocol ppp
ip address 100.14.1.2 255.255.255.252
#
interface LoopBack1
ip address 4.4.4.4 255.255.255.255
#
bgp 100
peer 1.1.1.1 as-number 100
peer 1.1.1.1 connect-interface LoopBack1
peer 2.2.2.2 as-number 100
peer 2.2.2.2 connect-interface LoopBack1
group rr4 internal
peer rr4 connect-interface LoopBack1
peer 7.7.7.7 as-number 100
peer 7.7.7.7 group rr4
peer 8.8.8.8 as-number 100
peer 8.8.8.8 group rr4
#
ipv4-family unicast
undo synchronization
reflector cluster-id 3
import-route direct
import-route ospf 1
import-route ospf 3
peer 1.1.1.1 enable
peer 2.2.2.2 enable
peer rr4 enable
peer rr4 reflect-client
peer 7.7.7.7 enable
peer 7.7.7.7 group rr4
peer 8.8.8.8 enable
peer 8.8.8.8 group rr4
#
ospf 1
area 0.0.0.0
network 100.12.1.0 0.0.0.3
network 100.14.1.0 0.0.0.3
#
ospf 3
area 0.0.0.0
network 100.22.1.0 0.0.0.3
network 100.22.2.0 0.0.0.3
network 4.4.4.4 0.0.0.0
#
return
#
sysname RT1
#
interface GigabitEthernet1/0/0
ip address 100.21.1.2 255.255.255.252
undo shutdown
#
interface LoopBack1
ip address 5.5.5.5 255.255.255.255
#
bgp 100
peer 3.3.3.3 as-number 100
peer 3.3.3.3 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
import-route direct
import-route ospf 2
peer 3.3.3.3 enable
#
ospf 2
area 0.0.0.0
network 100.21.1.0 0.0.0.3
network 5.5.5.5 0.0.0.0
#
return
#
sysname RT2
#
interface GigabitEthernet1/0/0
ip address 100.21.2.2 255.255.255.252
undo shutdown
#
interface LoopBack1
ip address 6.6.6.6 255.255.255.255
#
bgp 100
peer 3.3.3.3 as-number 100
peer 3.3.3.3 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
import-route direct
import-route ospf 2
peer 3.3.3.3 enable
#
ospf 2
area 0.0.0.0
network 6.6.6.6 0.0.0.0
network 100.21.2.0 0.0.0.3
#
return
#
sysname RT3
#
interface GigabitEthernet1/0/0
ip address 100.22.1.2 255.255.255.252
undo shutdown
#
interface LoopBack1
ip address 7.7.7.7 255.255.255.255
#
bgp 100
peer 4.4.4.4 as-number 100
peer 4.4.4.4 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
import-route direct
import-route ospf 3
peer 4.4.4.4 enable
#
ospf 3
area 0.0.0.0
network 100.22.1.0 0.0.0.3
network 7.7.7.7 0.0.0.0
#
return
#
sysname RT4
#
interface GigabitEthernet1/0/0
ip address 100.22.2.2 255.255.255.252
undo shutdown
#
interface LoopBack1
ip address 8.8.8.8 255.255.255.255
#
bgp 100
peer 4.4.4.4 as-number 100
peer 4.4.4.4 connect-interface LoopBack1
#
ipv4-family unicast
undo synchronization
import-route direct
import-route ospf 3
peer 4.4.4.4 enable
#
ospf 3
area 0.0.0.0
network 100.22.2.0 0.0.0.3
network 8.8.8.8 0.0.0.0
#
return