[补档]CCNP-BGP

2018-8-14 BGP

BGP同步判断,写进路由表的条件

  1. 下一跳可达
  2. 同步

什么是同步判断功能

  一个BGP路由器不会把从他的IBGP对等体学来的路由发送给EBGP对等体路由,除非IGP(内部网关协议)表中存在这条路由

*路由黑洞:

主动路由黑洞:防止DDoS路由攻击,分布式拒绝攻击

被动路由黑洞:BGP路由设计缺陷

BGP状态(5个)

  1. IDLE(空闲):路由器查找表中到邻居的路由
  2. CONNECT    :路由器发现邻居路由并完成三次握手
  3. OPEN SENT   OPEN消息发送
  4. OPEN CONFIRM:OPEN消息确认
  5. ESTABLISH:邻居关系建立:开始发BGP表(仅相当于TWO-WAY STATE)

排错

IDLE:路由协议没有学到IP地址,检查IGP表,跳数设置

ACTIVE:在ACTIVE 于IDLE间循环

  1. 收到的BGP open消息包中没有一条到更新源地址的路由(更新源地址错误)
  2. 邻居地址错误
  3. 单边指路由
  4. AS号设置错误

BGP验证

Neighbor  password XXX  源目地址HASH验证

BGP属性四大类

  • 公认的必选属性

Origin Code :network-i|egp-e|igp-?  代码值i

AS Path 起源

Next-hop下一跳属性

  • 公认的自选属性

Atomic-Aggregate 原子聚合属性

Local preference 本地优先级。越大越优先

  • 任选可透明传输

聚合属性

团队属性(community)

Internet

团队号

No-export不能发送给他的EBPG对等体

Local-as 能发送给他的EBPG对等体包括联盟的EBPG

No-advertisement 不能发送给任何EBPG对等体,智能留在本路由器上

  • 任选非可透明传输

MED:越小越优先

Originate-ID 起源id

Class-id。簇id

 

 

BGP的路径属性

     大量的路径属性会在BGP更新数据包(更新路由)时,传递给邻居BGP路由,自身携带大量的路径属性

路径属性在选路中起到了至关重要的作用

周知强制属性

R6(config)#do sho bgp ipv4 unicast 100.1.1.1
BGP routing table entry for 100.1.1.1/32, version 6
Paths: (2 available, best #2, table Default-IP-Routing-Table, RIB-failure(17))
  Not advertised to any peer
 65001
   5.5.5.5 (metric 11) from 5.5.5.5 (5.5.5.5)
     Origin IGP, metric 0, localpref 100, valid, internal
 65001
   4.4.4.4 (metric 11) from 4.4.4.4 (4.4.4.4)
     Origin IGP, metric 0, localpref 100, valid, internal, best
R1(config-router)#clear ip bgp * soft

R1(config)#access-list 1 permit 100.6.6.6
Router-map weight permit 10   
//对谁(目标)ACL或前缀列表来匹配路由.  在哪(某个进程) 做什么操作
Match ip adress 1  1=access-list
Set weight 50 
Router-map weight permit 20
R1(config)#route-map weight permit 10
R1(config-route-map)#match ip address 1
R1(config-route-map)#set weight 50
R1(config-route-map)#route-map weight permit 20

R1(config)#router bgp 65001
R1(config-router)#neighbor 3.3.3.3 route-map weight in

周知自选属性

Local preference在传递数据的过程中携带属性,在本身配置

R3(config-router)#bgp default local-preference 110
R3不传递给R2  IBGP防环AS内防环永远只传一跳

R3(config)#access-list 1 permit 100.66.66.66
R3(config)#route-map localp permit 10
R3(config-route-map)#set local-preference 120
R3(config-route-map)#route-map localp permit 20
R3(config-router)#neighbor 100.1.1.1 route-map localp out

Router bgp 65001
Aggregate-ad 100.0.0.0 255.0.0.0 summary-only
  Network          Next Hop            Metric LocPrf Weight Path
*> 100.0.0.0        0.0.0.0                            32768 i
r>i100.1.1.1/32     100.1.1.1                0    100     0 i
s i100.6.6.6/32     3.3.3.3                  0    100     0 65000 i
s>                  4.4.4.4                                0 65000 i
r>i100.11.11.11/32  100.1.1.1                0    100     0 i
s i100.66.66.66/32  3.3.3.3                  0    100     0 65000 i
s>                  4.4.4.4                                0 65000 i

R2(config-router)#do sho ip bgp 100.0.0.0
BGP routing table entry for 100.0.0.0/8, version 18
Paths: (1 available, best #1, table Default-IP-Routing-Table)
Flag: 0x820
 Advertised to update-groups:
    1          2
 Local, (aggregated by 65001 2.2.2.2)
   0.0.0.0 from 0.0.0.0 (2.2.2.2)
    Origin IGP, localpref 100, weight 32768, valid, aggregated, local, atomic-aggregate, best

R3(config-router)#aggregate-address 100.0.0.0 255.0.0.0 summary-only
在R23上双向重分发
R3(config-router)#redistribute ospf 100 match external    
R3(config-router)#redistribute bgp 65001 subnets

*> 100.0.0.0        172.16.2.2               1         32768 ?
* i                 3.3.3.3                  0    100     0 i
*                   0.0.0.0                            32768 I

R2(config-router)#do sho ip bgp 100.0.0.00
BGP routing table entry for 100.0.0.0/8, version 60
Paths: (3 available, best #1, table Default-IP-Routing-Table)
 Advertised to update-groups:
    1          2
 Local
   172.16.2.2 from 0.0.0.0 (2.2.2.2)
     Origin incomplete(代表重分发来的路由), metric 1, localpref 100, weight 32768, valid, sourced, best
 Local, (aggregated by 65001 3.3.3.3)
   3.3.3.3 (metric 11) from 3.3.3.3 (3.3.3.3)
     Origin IGP, metric 0, localpref 100, valid, internal, atomic-aggregate
 Local, (aggregated by 65001 2.2.2.2)
   0.0.0.0 from 0.0.0.0 (2.2.2.2)  //本地聚合           宣告>重分发>聚合
     Origin IGP, localpref 100, weight 32768, valid, aggregated, local, atomic-aggregate
*> 100.0.0.0        0.0.0.0                            32768 i
* i                 2.2.2.2                  1    100     0 ?

R5#show ip bgp 100.6.6.6
BGP routing table entry for 100.6.6.6/32, version 8
Paths: (1 available, best #1, table Default-IP-Routing-Table, RIB-failure(17))
Flag: 0x4800
 Advertised to update-groups:
     2
 Local
   100.6.6.6 (metric 11) from 100.6.6.6 (6.6.6.6)
     Origin IGP, metric 20, localpref 100, valid, internal, best


底层IGP度量值

R1(config-if)#ip ospf cost 1
R1(config-if)#do show ip b 100.6.6.6
BGP routing table entry for 100.6.6.6/32, version 6
Paths: (2 available, best #2, table Default-IP-Routing-Table, RIB-failure(17))
  Not advertised to any peer
 65000
   3.3.3.3 (metric 2) from 3.3.3.3 (3.3.3.3)
     Origin IGP, metric 0, localpref 100, valid, internal
 65000
   2.2.2.2 (metric 11) from 2.2.2.2 (2.2.2.2)
     Origin IGP, metric 0, localpref 100, valid, internal, best

Bgp选路

  1. 同步,下一跳可达
  2. 最大weight
  3. 最大本地优先级(默认100 作用范围在as内部传递,IBGP间可传递属性)
  4. 起源于本地路由器
  5. 最小的起源代码
  6. 最小的MED值
  7. EBGP优于IBGP路径
  8. 最近的IGP邻居
  9. 负载均衡

默认不开启负载均和(MAX-PATH为1)

在前8条选路原则无法进行选路的情况下,可以开启负载均衡

IBGP/EBGP负载均衡

IBGP负载均和可以看到M

  1. 存在时间最长的EBGP路径
  2. 最小的BGP邻居
  1. 最小的CLUSTER-LIST(类似AS-PATH)

每经过一个RR时,将会将路由反射ID(簇ID)加入到CLUSTER-LIST。当路由经过的CLUSTER越少越优先(反射的次数越少越优先)

  1. 最小的BGP邻居ROUTER ID
  2. 最小的邻居IP地址

 


R1(config)#route-map C ma
R1(config)#route-map C pe
R1(config)#route-map C permit 10
R1(config-route-map)#ma
R1(config-route-map)#match ip ad
R1(config-route-map)#match ip address 10
Router-map C deny 10
不写permit 20则则不放行其他路由


R4(config)#ip prefix-list ck seq 5 permit 10.1.8.0/22 ge 24 le  24
//10.1.8.0/22前缀
Ge 24 le 24  大于等于。小于等于。子网掩码
Loopback0                  1.1.1.1         YES NVRAM  up                    up     
Loopback2                  11.11.11.11     YES NVRAM up                    up      
Loopback3                  10.1.8.1        YES manual up                    up      
Loopback4                  10.1.9.1        YES manual up                    up      
Loopback5                  10.1.10.1       YES manual up                    up      
Loopback6                  10.1.11.1       YES manual up                    up      
R1(config)#

 


 

你可能感兴趣的:(learning)