BGP基本配置与总结

使用BGP路由协议的意义是将自治系统中的路由通告到外部,而自治系统内使用的是IGP路由,这就是为什么内部BGP管理距离这么高,而外部BGP管理距离这么低的原因了。


1、建立BGP邻居的前提:在BGP的neighbor中指定的IP必须是可达对方的,不是使用直连接口的,可以通过静态路由、动态路由来到达指定的IP。

2、通告BGP网络即network:邻居建立完成后,就可以使用bgp通告本地网络了。在ibgp中使用其他的动态路由协议(如eigrp、ospf等),是为了第1步中做neighbor的IP可达而已。

3、必须修改BGP下一跳。

4、BGP同步规则,当启动同步情况下BGP路由器不应使用通过IBGP获悉的路由或将其通告给外部邻居,除非该路由是本地的或通过IBGP获悉的(注意“通过IBGP获悉”指的是当BGP与IGP同步情况下,即在该自治系统中BGP与IGP同时都通告了该路由,那么BGP路由器就可以将该路由通告到外部邻居。)。当禁用同步的情况下全互联IBGP拓扑就可以将从IBGP路由器获悉的路由通告给外部BGP。


实验:


实验拓扑:



1)验证neighbor中对方的IP不可达时,无法建立邻居关系(R2与R3)。

R2(config-router)#do sh run

router bgp 65001
 no synchronization
 bgp log-neighbor-changes
 network 2.2.2.2 mask 255.255.255.255
 network 10.1.1.0 mask 255.255.255.0
 neighbor 3.3.3.3 remote-as 65001
 neighbor 3.3.3.3 update-source Loopback0  //指本身的源地址接口
 no auto-summary


R3(config-router)#do sh run

router bgp 65001
 no synchronization
 bgp log-neighbor-changes
 network 3.3.3.3 mask 255.255.255.255
 network 10.1.1.0 mask 255.255.255.0
 neighbor 2.2.2.2 remote-as 65001
 neighbor 2.2.2.2 update-source Loopback0
 no auto-summary


在检查建立邻居结果(R2):

R2(config-router)#do sh ip bgp nei
BGP neighbor is 3.3.3.3,  remote AS 65001, internal link
  BGP version 4, remote router ID 0.0.0.0
  BGP state = Active
  Last read 00:02:37, last write 00:02:37, hold time is 180, keepalive interval is 60 seconds
  Message statistics:
    InQ depth is 0
    OutQ depth is 0
                         Sent       Rcvd
    Opens:                  0          0
    Notifications:          0          0
    Updates:                0          0
    Keepalives:             0          0
    Route Refresh:          0          0
    Total:                  0          0
  Default minimum time between advertisement runs is 0 seconds


 For address family: IPv4 Unicast
  BGP table version 1, neighbor version 0/0
 Output queue size : 0
  Index 1, Offset 0, Mask 0x2
  1 update-group member
                                 Sent       Rcvd
  Prefix activity:               ----       ----
    Prefixes Current:               0          0
    Prefixes Total:                 0          0
    Implicit Withdraw:              0          0
    Explicit Withdraw:              0          0
    Used as bestpath:             n/a          0
    Used as multipath:            n/a          0


                                   Outbound    Inbound
  Local Policy Denied Prefixes:    --------    -------
    Total:                                0          0
  Number of NLRIs in the update sent: max 0, min 0


  Connections established 0; dropped 0   \\established为0表明没有建立邻居关系。
  Last reset never
  No active TCP connection
R2(config-router)#do sh ip bgp    \\同时没有显示邻居拓扑表
BGP table version is 3, local router ID is 22.22.22.22
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
*> 2.2.2.2/32       0.0.0.0                  0         32768 i
*> 10.1.1.0/24      0.0.0.0                  0         32768 i

R2(config-router)#

建立邻居失败是由于R2与R3的环回接口IP相对是未知(不可达的)。

如果使用的是10.1.1.0/24作为建立邻居的网段,则R2 与R3邻居建立成功。

R2(config-router)#do sh  run

router bgp 65001
 no synchronization
 bgp log-neighbor-changes
 network 2.2.2.2 mask 255.255.255.255
 network 10.1.1.0 mask 255.255.255.0
 neighbor 10.1.1.2 remote-as 65001

R3(config-router)# do sh run

router bgp 65001
 no synchronization
 bgp log-neighbor-changes
 network 3.3.3.3 mask 255.255.255.255
 network 10.1.1.0 mask 255.255.255.0
 neighbor 10.1.1.1 remote-as 65001
 no auto-summary


R2(config-router)#do sh 
*Mar  1 00:29:20.323: %BGP-5-ADJCHANGE: neighbor 10.1.1.2 Up 
R2(config-router)#do sh bgp nei
BGP neighbor is 10.1.1.2,  remote AS 65001, internal link
  BGP version 4, remote router ID 33.33.33.33
  BGP state = Established, up for 00:00:04
  Last read 00:00:04, last write 00:00:04, 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
  Message statistics:
    InQ depth

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值