内部BGP邻居(上)

简介: 文章目录系列文章实验目的实验拓扑实验步骤步骤1的配置步骤2的配置步骤3的配置步骤4的配置

实验目的

通过对内部IBGP邻居的配置,学习到内部BGP邻居建立的特点,以及内部BGP防环机制和IBGP下一跳问题。同时也将通过实验和学习BGP同步。

实验拓扑


本次实验由四台路由器完成,其中R1,R2属于AS1,并且内部运行EIGRP作为IGP使用,而R4处于AS2中。其中每台路由器都拥有地址为X.X.X.X/24的环回口。

实验步骤

  1. 首先配置好R1,R2以及R3的接口IP地址,并且保证直连接口的可达性。然后在R1,R2和R3的域内配置好EIGRP 协议,使得相互能够学习到各自的环回口。但注意,R3和R4的直连接口不能加入EIGRP协议中。
  2. 由于IBGP邻居往往存在一个管理域内,而同一个管理域内拥有共同的IGP,所以IBGP邻居关系为了便于稳定,通常采用环回口建立。因此,这里我们让R1和R3建立IBGP邻居关系,并且通过环回口建立。

步骤1的配置

IP地址的配置

R1:
R1#configure  terminal 
R1(config)#int e0/0 
R1(config-if)#ip add 10.10.12.1 255.255.255.0 
R1(config-if)#no sh
R1(config-if)#int loo0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#no sh
R2:
R2#configure terminal 
R2(config)#int e0/1
R2(config-if)#ip add 10.10.12.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int e0/0 
R2(config-if)#ip add 10.10.23.2 255.255.255.0
R2(config-if)#no sh
R2(config-if)#int loo0
R2(config-if)#ip add 2.2.2.2 255.255.255.0
R2(config-if)#no sh
R3:
R3#configure terminal 
R3(config)#int e0/1
R3(config-if)#ip add 10.10.23.3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#int e0/0
R3(config-if)#ip add 10.10.34.3 255.255.255.0
R3(config-if)#no sh
R3(config-if)#int loo0
R3(config-if)#ip add 3.3.3.3 255.255.255.0
R3(config-if)#no sh
R4:
R4#configure terminal
R4(config)#int e0/1
R4(config-if)#ip add 10.10.34.4 255.255.255.0
R4(config-if)#no sh
R4(config-if)#int loo0
R4(config-if)#ip add 4.4.4.4 255.255.255.0
R4(config-if)#no sh

EIGRP的配置:

R1:
R1(config-if)#router eigrp 1
R1(config-router)#no auto-summary 
R1(config-router)#network 1.1.1.0 0.0.0.255 
R1(config-router)#network 10.10.12.0 0.0.0.255
R2:
R2(config-if)#router eigrp 1
R2(config-router)#no auto-summary 
R2(config-router)#network 2.2.2.0 0.0.0.255 
R2(config-router)#network 10.10.12.0 0.0.0.255
R2(config-router)#network 10.10.23.0 0.0.0.255
R3:
R3(config-if)#router eigrp 1
R3(config-router)#no auto-summary 
R3(config-router)#network 3.3.3.0 0.0.0.255   
R3(config-router)#network 10.10.23.0 0.0.0.255
R3(config-router)#network 10.10.34.0 0.0.0.255
R4:
R4(config)#router eigrp 1  
R4(config-router)#no auto-summary 
R4(config-router)#network 4.4.4.4 

步骤2的配置

R1:
R1(config-router)#router bgp 1    //本地AS号码为1
R1(config-router)#bgp router-id 1.1.1.1   //指定RID为1.1.1.1
R1(config-router)#neighbor 3.3.3.3 remote-as 1    //邻居的AS号码也为1
R1(config-router)#neighbor 3.3.3.3 update-source lo0    //由于采用环回口建立邻居关系,因此需要更改新能源地址,否则TCP连接无法建立
R1(config-router)#exit
R3:
R3(config-router)#router bgp 1
R3(config-router)#bgp router-id 3.3.3.3
R3(config-router)#neighbor 1.1.1.1 remote-as 1 
R3(config-router)#neighbor 1.1.1.1 update-source lo0
R3(config-router)#exit

上面的配置对比EBGP邻居配置,少了EBGP多跳,因为IBGP之间发送的数据包的默认的TTL值设置的较大,不需要对TTL值进行更改。

稍等片刻,则出现R1和R3之间邻居建立的日志。

*Mar 1 02:24:56.171: %BGP-5-ADJCHANGE: neighbor 3.3.3.3 Up

*Mar 1 02:24:56.391: %BGP-5-ADJCHANGE: neighbor 1.1.1.1 Up

对IBGP邻居关系进行查看:

R1#sh ip bgp summ
BGP router identifier 1.1.1.1, local AS number 1
BGP table version is 1, main routing table version 1
Neighbor        V    AS MsgRcvd MsgSent   TblVer  InQ OutQ Up/Down  State/PfxRcd
3.3.3.3         4     1      10      10        1    0    0 00:06:52        0

由于出现的邻居关系3.3.3.3的AS号一致,因此为IBGP邻居。

R1#sh ip bgp neighbors 3.3.3.3
BGP neighbor is 3.3.3.3,  remote AS 1, internal link
  BGP version 4, remote router ID 3.3.3.3
  BGP state = Established, up for 00:10:15
  Last read 00:00:15, last write 00:00:15, hold time is 180, keepalive interval is 60 seconds
  Neighbor capabilities:
    Route refresh: advertised and received(old & new)
    Address family IPv4 Unicast: advertised and received

上面是通过命令show ip bgp neighbor 3.3.3.3 显示的部分输出。也能够通过标记部分明确邻居3.3.3.3是内部BGP邻居关系。

步骤3的配置

在R3和R4之间建立EBGP邻居关系,采用直连接口建立。之后在R4上将R4的环回口路由加入到BGP进程中。

R3:
R3(config)#router bgp 1
R3(config-router)#neighbor 10.10.34.4 remote-as 2
R3(config-router)#exit
R4:
R4(config)#router bgp 2   
R4(config-router)#bgp router-id 4.4.4.4
R4(config-router)#neighbor 10.10.34.3 remote-as 1
R4(config-router)#network 4.4.4.0 
R4(config-router)#network 4.4.4.0 mask 255.255.255.0 
R4(config-router)#exit

之后在R3的BGP表,显示如下:

R3#show ip bgp 
BGP table version is 2, local router ID is 3.3.3.3
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*> 4.4.4.0/24       10.10.34.4               0             0 2 i

从上面的内容可以看到,R3已经学习到R4通告过来的关于其环回口的路由,并且被使用为最佳路由。同时该路由的下一跳为10.10.34.4,说明外部BGP发送更新时,下一跳属性为发出接口的IP地址。同时AS-PATH属性显示为2,说明该路由从AS 2产生。

对于 AS-PATH属性而言,有两个主要作用:

| 如果在路由器进行选择时,优先考虑AS-PATH属性短的。代表该路由穿越的AS区域少。

| 同时对于EBGP而言,AS-PATH属性还能够防环。如果某BGP路由器从EBGP邻居收到某条路由,并且AS-PATH属性中包含自己本地AS的话,那么该路由将会被拒收。AS-PATH属性只有在离开AS时才会由边缘BGP路由写入。在AS内部传递时不更改。

那么在AS内部BGP如何防止环路?

查看R1的BGP表项。

R1#sh ip bgp  
BGP table version is 2, local router ID is 1.1.1.1
Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,
              r RIB-failure, S Stale
Origin codes: i - IGP, e - EGP, ? - incomplete
   Network          Next Hop            Metric LocPrf Weight Path
*>i4.4.4.0/24       10.10.34.4               0    100      0 2 i

我们可以看到在R1上虽然收到了来于R3所告知的4.4.4.0/24的路由,但是该路由器并没有将本条路由作为’best".

R1:
R1(config)#router bgp 1
R1(config-router)#neighbor 2.2.2.2 remote-as 1
R1(config-router)#neighbor 2.2.2.2 update-source lo0
R1(config-router)#exit
R2:
R2(config-router)#router bgp 2 
R2(config-router)#bgp router-id 2.2.2.2
R2(config-router)#neighbor 1.1.1.1 remote-as 1   
R2(config-router)#neighbor 1.1.1.1 update-source lo0
R2(config-router)#exit


目录
相关文章
|
监控 关系型数据库 数据库
rds的安全性
rds的安全性
587 7
|
1月前
|
并行计算 编译器 调度
GPU红绿阵营对决:CUDA与ROCm内核调度机制深度漫游指南
本文深入剖析GPU内核(Kernel)在CUDA与ROCm异构生态中的底层交互机制,涵盖命令包生成、环形队列投递、Doorbell通知、硬件调度等关键环节;对比NVIDIA的Warp/SIMT与AMD的Wavefront/HSA架构差异;详解内存优化、延迟掩盖、寄存器级通信及Graph静态调度等极限性能调优策略,助工程师穿透抽象,直抵算力本质。(239字)
270 6
|
Docker 容器
docker中使用Dockerfile自动创建数据卷
【10月更文挑战第12天】
356 5
2022年最新最详细的IntelliJ idea高效插件的介绍安装,让你的工作效率提升10倍
这篇文章详细介绍了10款IntelliJ IDEA的高效插件,包括Codota代码智能提示、Key Promoter X快捷键提示、CodeGlance代码缩略图、Lombok代码简化、阿里巴巴代码规范检查、SonarLint代码质量检查、Save Actions格式化代码、Translation翻译、Rainbow Brackets彩虹括号和Nyan Progress Bar彩虹进度条插件,旨在帮助提升开发效率和代码质量。
2022年最新最详细的IntelliJ idea高效插件的介绍安装,让你的工作效率提升10倍
|
前端开发 数据可视化 UED
React的代码分割:使用React.lazy和Suspense进行性能优化
【4月更文挑战第25天】使用React的`React.lazy`和`Suspense`进行代码分割可优化性能,按需加载组件以提升应用启动速度和用户体验。`React.lazy`接收返回Promise的组件动态导入,而`Suspense`提供加载指示器,保证加载过程中的用户体验。适用于大型组件或路由应用,但需注意服务器配置、避免过度拆分和确保关键代码即时加载。合理运用能显著改善应用性能。
|
开发框架 数据安全/隐私保护 Android开发
iOS二维码的生成和扫码详细介绍(手把手教)
iOS二维码的生成和扫码详细介绍(手把手教)
1134 0
|
Ubuntu Linux 数据库
ubuntu linux 搭建ftp虚拟目录
ubuntu linux 搭建ftp虚拟目录
311 0
|
弹性计算 安全 网络安全
阿里云ECS经典网络和专有网络有什么区别?
阿里云面向客户提供的网络类型服务有经典网络和专有网络两种,但这两者有什么区别呢?阿里官网给的解释是: 经典网络:IP地址由阿里云统一分配,配置简便,使用方便,适合对操作易用性要求比较高、需要快速使用 ECS 的用户。
|
安全 程序员 Shell
老程序员分享:NSIS自定义界面,下载并安装Net.Framework4.8
老程序员分享:NSIS自定义界面,下载并安装Net.Framework4.8
|
Ubuntu Windows
iperf3 使用
iperf3 使用
678 0
iperf3 使用

热门文章

最新文章