bgp汇总

router(config-router)#

aggregate-address ip address mask [summary-only](只通告汇总出去) [as-set](携带原来as属性)使用时候得先把明细路由通告出来

r2:

router bgp 2

net 172.16.4.0 mask 255.255.255.0

net 172.16.5.0 mask 255.255.255.0

net 172.16.6.0 mask 255.255.255.0

net 172.16.7.0 mask 255.255.255.0

aggregate-address 172.16.4.0 255.255.252.0(默认做聚合把明细和聚合都发出来)summary-only(只发送汇总)as-set(携带丢失as)

s>抑制,不会通告给bgp邻居

ip prefix-list sup7 permit 172.16.7.0/24

route-map sup permit 10

match ip address prefix-list sup7

router bgp 2

aggregate-address 172.16.4.0 255.255.252.0 as-set suppress-map sup(抑制掉这个路由)

路由聚合

两种常用的路由聚合方法

1.使用network命令发布一条聚合路由,前提是该聚合路由必须在路由表中存在

2.使用aggregate命令进行聚合,前提是路由表中至少存在一条需要聚合的详细路由,可以使用参数控制只发布聚合路由还是发布聚合路由和详细路由或部分详细路由。

3.路由聚合后,有可能产生环路,使用aggregate命令的时候使用参数as-set来避免环路

ibgp水平分割:从ibgp邻居学到路由不会通告给ibgp邻居。

bgp分成2中水平分割

1.ebgp:as号,从别处收到一条与本地as号相同的bgp条目,会被丢弃

2.ibgp:从ibgp收到的bgp条目不会转发给它的ibgp邻居。

有条件的打破ibgp水平分割规则:

1.rr路由反射器

2.联邦

bgp常见故障汇总

邻居不能建立(as号码错误,地址不匹配,路由不可达,ttl问题)

bgp log-neighbor-change

show ip bgp neighbor x.x.x.x

show ip bgp summary

路由丢失(next-hop无效,路由未同步,宣告的网段没有与之匹配的igp路由,汇总时被抑制,做了错误的过滤)

show ip bgp (x.x.x.x)(longer)

show ip bgp neighbor x.x.x.x advertised-routes

show ip bgp neighbor x.x.x.x received-routes

show ip bgp neighbor x.x.x.x routes (需要命令neighbor soft reconfiguration)

debug ip bgp

debug ip bgp x.x.x.x update

debug ip bgp events

clear ip bgp(soft in)

clear ip bgp (soft out)

bgp在大规模网络中遇到的问题

bgp路由表庞大

bgp聚合

ibgp相邻体过多,逻辑全连接不易实现

bgp联盟

bgp反射

在复杂网络环境中路由的变化过于频繁

bgp衰减

路由反射器就是一台路由器,可以将它的ibgp邻居指定为自己的客户端。

路由反射器和其客户的集合被称为集群(cluster),每一个集群都有一个cluster-id,默认情况下路由反射器的router-id会被用做cluster-id,也可以手工指定,路由反射器所传递的每一条路由都会带上这个cluster-id

rr如何打破ibgp水平分割规则:

1、rr从ebgp学到的一条路由,会传递clent和非clent端

2、rr从client端学到路由,会传给其他client和ebgp邻居以及非client端

3、rr从非客户端收到路由,会转发给客户端以及ebgp邻居,但不会转发给非客户端。

show ip bgp neighbor 4.4.4.4 advertised-routes(这条命令可查看ibgp邻居r3是否给r4传递bgp路由)

路由反射器实验:

r2:

router bgp 2

neighbor 12.1.1.1 remote-as 134

bgp router-id 2.2.2.2

no syn

no au

network 2.2.2.0 mask 255.255.255.0

r1:

router bgp 123

bgp router-id 1.1.1.1

no au

no syn

neighbor 12.1.1.2 remote-as 2

router rip

ver 2

no au

net 1.0.0.0

net 13.0.0.0

r3:router rip

ver 2

no au

net 13.0.0.0

net 34.0.0.0

net 3.0.0.0

r4:

router rip

ver 2

no au

net 34.0.0.0

net 4.0.0.0

r1:

router bgp 134

neighbro 3.3.3.3 remote 134

neighbor 3.3.3.3 up lo0

neighbor 3.3.3.3 next-hop-self

r3:

router bgp 134

bgp router-id 3.3.3.3

neghbor 1.1.1.1 remote-as 134

neighbor 1.1.1.1 up lo0

neighbor 4.4.4.4 remote-as 134

neighbor 4.4.4.4 up lo0

r4:

router bgp 134

bgp router-id 4.4.4.4

no ayn

no au

neighbor 3.3.3.3 remote-as 134

neighbor 3.3.3.3 up lo0

net 4.4.4.0 mask 255.255.255.0

r3:

router bgp 134

neighbor 4.4.4.4 route-reflector-client(设定4.4.4.4为是自己的客户端)