简介
本文档介绍阻止正确建立BGP邻居关系的问题。
先决条件
要求
本文档没有任何特定的要求。
使用的组件
本文档不限于特定的软件和硬件版本。
本文档中的信息都是基于特定实验室环境中的设备编写的。本文档中使用的所有设备最初均采用原始(默认)配置。如果您的网络处于活动状态,请确保您了解所有命令的潜在影响。
规则
有关文档规则的详细信息,请参阅 Cisco 技术提示规则。
背景信息
BGP 路由器只有在互相之间建立对等连接时,才能交换路由信息。BGP 对等体的建立开始于设备之间 TCP 连接的创建。TCP 连接建立后,BGP 设备会尝试通过 BGP Open 消息交换创建 BGP 会话,其中这些设备交换 BGP 版本、AS 编号、保持时间和 BGP 标识符。
在 BGP 对等体建立的过程中,有几件事可能会阻止 BGP 邻居关系的正常建立。本文档将讨论导致该问题的一些可能的原因:
网络图
该网络图用作前三个原因的示例:
网络图
问题
邻居语句不正确
路由器R1-AGS上的show ip bgp summary命令显示会话处于活动状态。
R1-AGS(9)#show ip bgp summary
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.10.10.2 4 400 0 0 0 0 0 never Active
配置如下:
R1-AGS |
R6-2500 |
interface Loopback0
ip address 10.2.2.2 255.255.255.255
!
interface Serial1
ip address 10.10.10.1 255.255.255.0
!
router bgp 400
neighbor 10.10.10.2 remote-as 400
neighbor 10.10.10.2 update-source Loopback0
!
ip route 10.1.1.1 255.255.255.255 10.10.10.2 |
interface Loopback0
ip address 10.1.1.1 255.255.255.255
!
interface Serial0
ip address 10.10.10.2 255.255.255.0
!
router bgp 400
neighbor 10.10.10.1 remote-as 400
neighbor 10.10.10.1 update-source Loopback0
!
ip route 10.2.2.2 255.255.255.255 10.10.10.1 |
debug ip bgp 和 debug ip tcp transactions 命令显示 TCP 连接失败。
路由器 R1-AGS 上的 debug:
BGP: 10.10.10.2 open active, local address 10.2.2.2
TCB00135978 created
TCB00135978 setting property 0 16ABEA
TCB00135978 bound to 10.2.2.2.11039
TCP: sending SYN, seq 3797113156, ack 0
TCP0: Connection to 10.10.10.2:179, advertising MSS 1460
TCP0: state was CLOSED -> SYNSENT [11039 -> 10.10.10.2(179)]
TCP0: state was SYNSENT -> CLOSED [11039 -> 10.10.10.2(179)]
TCP0: bad seg from 10.10.10.2 -- closing connection: seq 0 ack 3797113157 rcvnxt 0 rcvwnd 0
TCP0: connection closed - remote sent RST
TCB00135978 destroyed
BGP: 10.10.10.2 open failed: Connection refused by remote host
TCP: sending RST, seq 0, ack 1965664223
TCP: sent RST to 10.1.1.1:11016 from 10.10.10.1:179
路由器 R6-2500 上的 debug:
TCP: sending RST, seq 0, ack 3797113157
TCP: sent RST to 10.2.2.2:11039 from 10.10.10.2:179
BGP: 10.10.10.1 open active, local address 10.1.1.1
TCB001E030C created
TCB001E030C setting property TCP_WINDOW_SIZE (0) 194F7A
TCB001E030C setting property TCP_TOS (11) 194F79
TCB001E030C bound to 10.10.1.1.11016
TCP: sending SYN, seq 1965664222, ack 0
TCP0: Connection to 10.10.10.1:179, advertising MSS 1460
TCP0: state was CLOSED -> SYNSENT [11016 -> 10.10.10.1(179)]
TCP0: state was SYNSENT -> CLOSED [11016 -> 10.10.10.1(179)]
TCP0: bad seg from 10.10.10.1 -- closing connection: seq 0 ack 1965664223 rcvnxt 0 rcvwnd 0
TCP0: connection closed - remote sent RST
TCB 0x1E030C destroyed
BGP: 10.10.10.1 open failed: Connection refused by remote host
解决方案
要解决此问题,需更正 neighbor 语句中的环回地址,或者从配置中移除 update-source 命令。
在此示例中,对地址进行了更正。
R1-AGS |
R6-2500 |
router bgp 400
neighbor 10.1.1.1 remote-as 400
neighbor 10.1.1.1 update-source Loopback0
!
ip route 10.1.1.1 255.255.255.255 10.10.10.2
|
router bgp 400
neighbor 10.2.2.2 remote-as 400
neighbor 10.2.2.2 update-source Loopback0
!
ip route 10.2.2.2 255.255.255.255 10.10.10.1
|
看看show ip bgp summary命令就知道路由器R1-AGS处于已建立状态。
R1-AGS(9)#show ip bgp summary
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.1.1.1 4 400 3 3 1 0 0 00:00:26 0
问题
到邻居地址的路由不存在或默认路由被用于到达对端
路由器R1-AGS上的show ip bgp summary命令显示会话当前处于活动状态。
R1-AGS(9)#show ip bgp summary
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.1.1.1 4 400 0 0 0 0 0 never Active
配置如下:
R1-AGS |
R6-2500 |
interface Loopback0
ip address 10.2.2.2 255.255.255.255
!
interface Serial1
ip address 10.10.10.1 255.255.255.0
!
router bgp 300
neighbor 10.1.1.1 remote-as 400
neighbor 10.1.1.1 ebgp-multihop 2
neighbor 10.1.1.1 update-source Loopback0 |
interface Loopback0
ip address 10.1.1.1 255.255.255.255
!
interface Serial0
ip address 10.10.10.2 255.255.255.0
!
router bgp 400
neighbor 10.2.2.2 remote-as 300
neighbor 10.2.2.2 ebgp-multihop 2
neighbor 10.2.2.2 update-source Loopback0 |
如果您运行 debug 命令,则它会显示没有到邻居的路由。
路由器 R1-AGS 上的 debug:
BGP: 10.1.1.1 open active, delay 9568ms
BGP: 10.1.1.1 multihop open delayed 19872ms (no route)
BGP: 10.1.1.1 multihop open delayed 12784ms (no route)
路由器 R6-2500 上的 debug:
BGP: 10.2.2.2 open active, delay 6531ms
BGP: 10.2.2.2 multihop open delayed 14112ms (no route)
BGP: 10.2.2.2 multihop open delayed 15408ms (no route)
解决方案
解决办法是在 BGP neighbor 语句中加入到下一跳的路由。根据具体情况,您可以使用静态路由或动态路由。在您拥有更多控制权的内部 BGP (iBGP) 环境中,您可以使用路由协议动态地传播该路由。在外部 BGP (eBGP) 情况下,建议配置静态路由以到达下一跳。
注意:只有当您在eBGP对等体上对等的IP地址不是直接连接的情况下,才应使用neighbor ebgp-multihop命令。
本例中使用的是静态路由。
R1-AGS |
R6-2500 |
router bgp 300
neighbor 10.1.1.1 remote-as 400
neighbor 10.1.1.1 ebgp-multihop 2
neighbor 10.1.1.1 update-source Loopback0
!
ip route 10.1.1.1 255.255.255.255 10.10.10.2
|
router bgp 400
neighbor 10.2.2.2 remote-as 300
neighbor 10.2.2.2 ebgp-multihop 2
neighbor 10.2.2.2 update-source Loopback0
!
ip route 10.2.2.2 255.255.255.255 10.10.10.1
|
show ip bgp summary 命令显示路由器R1-AGS处于已建立状态。
R1-AGS(9)#show ip bgp summary
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.1.1.1 4 400 3 3 1 0 0 00:00:26 0
注意:默认路由永远不会用于建立BGP会话(iBGP/eBGP),并且您会在调试中看到相同的(无路由)输出,尽管您可以ping通BGP邻居。解决办法仍然是添加到 BGP 邻居的路由。
问题
BGP下缺少Update-source命令
路由器R1-AGS上的show ip bgp summary命令显示会话处于活动状态。
R1-AGS(9)#show ip bgp summary
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.1.1.1 4 400 0 0 0 0 0 never Active
配置如下:
R1-AGS |
R6-2500 |
interface Loopback0
ip address 10.2.2.2 255.255.255.255
!
interface Serial1
ip address 10.10.10.1 255.255.255.0
!
router bgp 400
neighbor 10.1.1.1 remote-as 400
!
ip route 10.1.1.1 255.255.255.255 10.10.10.2 |
interface Loopback0
ip address 10.1.1.1 255.255.255.255
!
interface Serial0
ip address 10.10.10.2 255.255.255.0
!
router bgp 400
neighbor 10.2.2.2 remote-as 400
!
ip route 10.2.2.2 255.255.255.255 10.10.10.1 |
如果您运行 debug 命令,则它会显示 TCP 连接失败。
路由器 R1-AGS 上的 debug:
TCP: sending RST, seq 0, ack 2248020754
TCP: sent RST to 10.10.10.2:11018 from 10.2.2.2:179
BGP: 10.1.1.1 open active, local address 10.10.10.1
TCB0016B06C created
TCB0016B06C setting property 0 16ADEA
TCB0016B06C bound to 10.10.10.1.11042
TCP: sending SYN, seq 4099938541, ack 0
TCP0: Connection to 10.1.1.1:179, advertising MSS 536
TCP0: state was CLOSED -> SYNSENT [11042 -> 10.1.1.1(179)]
TCP0: state was SYNSENT -> CLOSED [11042 -> 10.1.1.1(179)]
TCP0: bad seg from 10.1.1.1 -- closing connection: seq 0 ack 4099938542 rcvnxt 0 rcvwnd 0
TCP0: connection closed - remote sent RST
TCB0016B06C destroyed
BGP: 10.1.1.1 open failed: Connection refused by remote host
路由器 R6-2500 上的 debug:
BGP: 10.2.2.2 open active, local address 10.10.10.2
TCB00194800 created
TCB00194800 setting property TCP_WINDOW_SIZE (0) E6572
TCB00194800 setting property TCP_TOS (11) E6571
TCB00194800 bound to 10.10.10.2.11018
TCP: sending SYN, seq 2248020753, ack 0
TCP0: Connection to 10.2.2.2:179, advertising MSS 556
TCP0: state was CLOSED -> SYNSENT [11018 -> 10.2.2.2(179)]
TCP0: state was SYNSENT -> CLOSED [11018 -> 10.2.2.2(179)]
TCP0: bad seg from 10.2.2.2 -- closing connection: seq 0 ack 2248020754 rcvnxt 0 rcvwnd 0
TCP0: connection closed - remote sent RST
TCB 0x194800 destroyed
BGP: 10.2.2.2 open failed: Connection refused by remote host
TCP: sending RST, seq 0, ack 4099938542
TCP: sent RST to 10.10.10.1:11042 from 10.1.1.1:179
解决方案
要解决这一问题,需在这两个路由器上同时配置 update-source 命令,或者删除 update-source 命令,并且更改这两个路由器上的 neighbor 语句。下面是这两种解决办法的示例。
两个路由器上都配置了update-source命令:
R1-AGS |
R6-2500 |
interface Loopback0
ip address 10.2.2.2 255.255.255.255
!
interface Serial1
ip address 10.10.10.1 255.255.255.0
!
router bgp 400
neighbor 10.1.1.1 remote-as 400
neighbor 10.1.1.1 update-source Loopback0
!
ip route 10.1.1.1 255.255.255.255 10.10.10.2 |
interface Loopback0
ip address 10.1.1.1 255.255.255.255
!
interface Serial0
ip address 10.10.10.2 255.255.255.0
!
router bgp 400
neighbor 10.2.2.2 remote-as 400
neighbor 10.2.2.2 update-source Loopback0
!
ip route 10.2.2.2 255.255.255.255 10.10.10.1 |
show ip bgp summary 命令显示路由器R1-AGS处于已建立状态。
R1-AGS(9)#
show ip bgp summary
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.2.2.2 4 400 3 3 1 0 0 00:00:26 0
当有人在对等您的环回地址时,您只需使用 update-source 命令。这适用于 iBGP 对等体和 eBGP 对等体。
在下面的示例中,删除了 update-source 命令并且同时更改了这两个路由器上的 neighbor 语句。
R1-AGS |
R6-2500 |
interface Loopback0
ip address 10.2.2.2 255.255.255.255
!
interface Serial1
ip address 10.10.10.1 255.255.255.0
!
router bgp 400
neighbor 10.10.10.2 remote-as 400
|
interface Loopback0
ip address 10.1.1.1 255.255.255.255
!
interface Serial0
ip address 10.10.10.2 255.255.255.0
!
router bgp 400
neighbor 10.10.10.1 remote-as 400
|
show ip bgp summary 命令显示路由器R1-AGS处于已建立状态。
R1-AGS(9)#show ip bgp summary
BGP table version is 1, main routing table version 1
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.10.10.2 4 400 3 3 1 0 0 00:00:26 0
相关信息