Layer3 BGP-9 BGP特性

来源:互联网 发布:淘宝客不战 编辑:程序博客网 时间:2024/05/25 19:59
session 1 BGP路由策略
一、BGP限制路由条目
R1(config-router)#neighbor 6.6.6.6 maximum-prefix 5 ?
  <1-100>       Threshold value (%) at which to generate a warning msg      设置百分比报警
  restart       Restart bgp connection after limit is exceeded                     超过报警限制后邻居down重置时间
  warning-only  Only give warning message when limit is exceeded      只报警不down邻居
下面两条命令可以查看邻居发来的路由被限制的条目数
R1(config-router)#neighbor 2.2.2.2 soft-reconfiguration inbound     邻居温和重配置,不开启查看不了
R1#show ip bgp neighbors 2.2.2.2 received-routes                              查看被限制的路由条目数

二、BGP隐藏真实的AS号,local-as技术。用于ebgp中。
R1(config)#router bgp 123
R1(config-router)#neighbor 2.2.2.2 local-as 88 no-prepend replace-as       使用虚假的AS号88来建立邻居,在邻居只能使用虚假as88来与R1建立邻居关系,而不能使用真实as的123来建立邻居关系。
R1(config-router)#neighbor 2.2.2.2 local-as 88 no-prepend replace-as dual-as     加上dual-as这个参数后,邻居既可以使用真实as123来建立tcp会话也可以使用虚假as88来建立tcp会话形成邻居关系。

三、bgp enforce-first-as 
R1(config-router)#bgp enforce-first-as 
只有当路由的as_path中开头的as与neighbor指的as一样时,才会接收邻居传递的路由。(只接收邻居始发的路由,而不接收邻居学习到然后转发的路由)

四、BGP链路认证
R1(config-router)#neighbor 2.2.2.2 password 0 xxxxx               BGP的认证命令,密码在BGP的tcp报文中
 
五、删除私有AS号
BGP的AS号范围:1~65535,其中64512~65535为私有AS号,删除私有号三种方法:
1、联邦(大联邦IBGP的AS为公有AS号,内部小AS号用私有AS号)自动清除
2、neighbor x.x.x.x remove-private-as     对特定EBGP邻居的路由更新时,将私有AS号从as_path中删除
3、聚合(公有、私有AS都将被移除)
 
六、BGP的路由过滤,四中方法:
1、neighbor x.x.x.x prefix-list 1 in/out
      ip prefix-list 1 permit x.x.x.x/24
 
2、neighbor x.x.x.x distribute-list 1 in/out
      access-list 1 permit x.x.x.x 255.255.255.0
 
3、neighbor x.x.x.x route-map A in/out
R1(config)#route-map A permit 10
R1(config-route-map)#match ip address 1
R1(config)#access-list 1 permit x.x.x.x 255.255.255.0
 
4、neighbor x.x.x.x filter-list as-path-access-list-number (1) in/out
R1(config)#ip as-path access-list 1 permit ^33_              正则表达式,用于批量匹配某些as有33的路由条目
ip as-path access-list 1 permit 33                                     匹配所有as号中带有33的路有条目
正则表达式用法:baidu(编程中较多)
 
七、BGP的orf(outbound rouote filter)出向路由过滤,用于双方自动协商路由条目的数量,保护带宽
R1(config-router)#neighbor 2.2.2.2 capability orf prefix-list ?
  both     Capability to SEND and RECEIVE the ORF to/from this neighbor
  receive  Capability to RECEIVE the ORF from this neighbor
  send     Capability to SEND the ORF to this neighbor
R1#show ip bgp neighbors 2.2.2.2 advertised-routes
两端邻居都启用orf功能,一端做了过滤策略另一端而另一端没有做的时候,双方会根据做了限制的一方的策略来协商发送和接收的路由数目,可以做both双向的orf来保护双向带宽。
 
八、链路MTU最大值检测
开启路径mtu最大值检测,IOS15.1以后自动开启。用于让路由器检测到达邻居链路的最大mtu值,用于调整发送路由的数据包的大小,减少小包的发送,提高路由器处理数据包的性能。
R1(config-router)#bgp transport path-mtu-discovery

R1(config-router)#neighbor 2.2.2.2 transport path-mtu-discovery      路径(到邻居)mtu最大值检测


0 0