内部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


目录
相关文章
|
网络架构
内部BGP邻居(下)
文章目录 系列文章 实验目的 实验拓扑 实验步骤 步骤1的配置 步骤2的配置 步骤3的配置 步骤4的配置
94 0
内部BGP邻居(下)
|
NoSQL Redis 网络架构
BGP邻居路由黑洞+mpls ip
文章目录 要求: 拓扑: 命令:
75 0
BGP邻居路由黑洞+mpls ip
|
网络协议 数据库 网络架构
|
网络协议 网络架构
|
负载均衡 网络协议 数据库
|
网络协议 网络架构

热门文章

最新文章