BGP消息类型及配置BGP


 * BGP消息类型
   -- Open: 用于建立BGP对等体之间的连接关系
   -- Keepalive: 周期性地向BGP对等体发出Keepalive消息, 用来保持连接的有效性
   -- Update: 携带的是路由更新(删减、增加)信息
   -- Notification: 当BGP检测到错误状态时, 就向对等体发出Notification消息, 之后BGP连接会立即被关闭


 * BGP状态
   -- 当建立BGP会话, 路由器与邻居之间的关系经过如下状态:
      * Idle(空闲): 路由器查看路由表, 邻居是否可达
      * Connect(连接): 路由器发现路由并完成TCP连接的三次握手
      * Open sent(打开发送): 发送BGP会话之间的连接参数
      * Open confirm(打开确认): 路由器收到连接参数一致性的确认
      * Established(已建立): 邻居关系建立


 * 配置BGP命令
   Router(config)#
       router bgp autonomous-system

   -- 仅仅此命令并不能激活BGP
   -- 一个路由器上只能配置一个自治系统
   -- 自治系统号用来识别这台路由器是属于哪个自治系统的
   -- 自治系统号也用来识别将来的指定的邻居关系是IBGP关系还是EBGP关系



   Router(config-router)#
       neighbor {ip-address | peer-group-name}remote-as AS
  
   -- 指定与当亲路由器建立会话的对等路由器
   -- remote-as后指定的AS号, 将用来确定指定的邻居是IBGP邻居还是EBGP邻居关系
   -- IP地址是所有前往该邻居路由器的BGP分组的目标地址
   -- 要建立邻居关系, 无论是IBGP还是EBGP首先要保证邻居是可到达的
   -- EBGP和IBGP都需要此命令建立邻居


 * BGP关闭邻居关系
   Router(config-router)#
       neighbor {ip-address | peer-group-name}shutdown

   -- 管理性的关闭邻居关系(注意: 并不是删除了邻居)
   -- 如果对邻居路由器的策略进行修改, 则需要关闭邻居关系, 修改后重新启用邻居关系



   Router(config-router)#
       no neighbor {ip-address | peer-group-name}shutdown


   -- 启用邻居关系

 * BGP配置技巧
   在配置IBGP时, 一般使用loop back口的地址来指定邻居,但是一定要指定源IP地址; 而EBGP, 一般使用直连的物理口的地址来指定邻居。

 * BGP邻居的更新源地址(在IBGP配置中使用)
   Router(config-router)#
       neighbor {ip-address | peer-group-name}update-source interface-type interface-number

   -- 此命令用来指定BGP进程用更新地址作为对邻居的更新源地址
   -- 通常使用环回地址来作为更新源地址, 因为环回地址总是可用的
   -- 在两台路由器中必须有到更新源的路由
   -- 通常只用与IBGP邻居关系之间
   -- 默认时EBGP邻居关系要求直连, 环回地址对于EBGP来说不是相互直接相连的。如果EBGP之间使用环回口建邻居, 还需要指定多跳。 


 * BGP同步
   -- 同步规则: 仅当从IBGP邻居那里获悉的路由出现在本地路由选择表中后, BGP进程才将器加入到IP路由选择表中
   -- 确保AS内部路由信息的一致性
   -- 避免黑洞问题
   -- 如果运行全互联IBGP, 可以关闭同步

   
   Router(config-router)#
       no synchronization

   -- 关闭同步可减少IGP通告的路由数, 提高BGP的汇聚速度, 默认是被关闭的(即默认是非同步的)
  
   Router(config-router)#
       synchronization



 * 查看BGP
   Router# 
       show ip bgp summary// 查看BGP的概要信息



 * Clearing the BGP Session
   -- When policies such as access lists or attributes are changed, the change takes effect immediately, and the next time that a prefix or path is advertidrf or received, the new policy is used. It can take a long time for the policy to be applied to all networks.
   -- You must trigger an update to ensure that the policy is immediately applied to all affected prefixes and paths.
   -- Ways to trigger an update
      * Hard reset
      * Soft reset
      * Route refresh 

 
* Hard Reset of BGP Sessions(断开所有连接)
   Router#
       clear ip bgp *

   -- Resets all BGP connections with this router
   -- Entire BGP forwarding table Is discarded
   -- BGP session makes the transition from established to Idle; everything must relearned


   Router#
       clear ip bgp {neighbor-address}

   -- Resets only a single neighbor
   -- BGP session makes the transition from established to Idle; everything from this neighbor must be relearned
   -- Less severe than clear ip bgp *


 * Soft Reset Outbound(强制刷新路由表)
   Router#
       clear ip bgp {* | neighbor-address}[soft out]

   -- Routes learned from this neighbor are not lost
   -- This router resends all BGP information to the neighbor without resetting the connection
   -- The connection remains establlshed
   -- This option is highly recommended when you are changing outbound policy

   -- The soft out option does not help if you are changing inbound policy



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值