BGP协议: BGP-boundary gateway protocol即边界网关协议,是用来连接Internet上的独立系统的路由选择协议。 属于公有协议,位于 OSI 第 7 层,套接字为 TCP 179。该协议本身不会产生路由,仅仅用来传递路由,一般应用于不同公司之间,可以在长时间内稳定的传输大量的路由条目。可以赋予路由条目众多属性,从而可以实现路由条目的灵活控制。 有的时候也将其称之为“路径矢量”,同样存在自动汇总,但是可以人工关闭,因为BGP协议传输路由时,是有子网掩码的。

1、建立邻居表 router bgp 1 no auto-summary //关闭自动汇总功能; no synchronization //关闭BGP与IGP的同步功能 bgp router-id 1.1.1.1 // 设置 BGP 的 RID; neighbor 192.168.12.2 remote-as 1 //单播建立BGP邻局 验证命令 show ip bgp summary 2、同步数据库(DB\Topology\LSDB\BGP Table) 宣告:network + redistribute R1: router bgp 1 network 10.10.1.0 mask 255.255.255.0 R3: router bgp 2 no auto-summary no synchronization bgp router-id 3.3.3.3 neighbor 192.168.23.2 remote-as 1 redistribute connected 验证命令: show ip bgp neighbor x.x.x.x adver //查看该路由器向邻居xxxx发送了哪些路由; show ip bgp //查看本地的 BGP 数据库 3、路由表 show ip route show ip route bgp R2:router bgp 1 neighbor 192.168.12.1 next-hop-self clear ip bgp * soft 软清 clear ip bgp * 硬清(不建议工作中使用)

非直连的 BGP 邻居关系: 为了增强 BGP 邻居关系的稳定性,才考虑通过非直连的 链 路IP地址进行邻居关系的建立,即通过loopback口建立,另外,非直连建立邻居 时,务必需要考虑一个“更新源检测机制”的问题。如果更新源检测不通过,则导致邻 居无法建立。

修改EBGP邻居之间发送的报文的 TTL : router bgp 2 neighbor x.x.x.x ebpg-multihop [value]

更新源检测机制(通过非直连端口建立邻居时) neighbor x.x.x.x update-source y.y.y.y 直连检测机制(通过非直连端口建立 EBGP 邻居时候) neighbor x.x.x.x ebgp-multihop [value]