ebgp邻居非直连无法建立邻居解决方法(2)

📅 2026/6/25 12:17:41
ebgp邻居非直连无法建立邻居解决方法(2)
一 拓扑说明R1、R2、R3通过ospf建立邻居R1和R3通过非直连物理接口建立EBGP邻居注意默认情况下,BGP认为EBGP邻居是直连可达的。如果EBGP邻居间不是直连可达则必须在BGP视图下配置允许同非直接相连网络上的邻居建立EBGP连接。二 R1和R3设备配置1.R1配置router bgp 100bgp log-neighbor-changesbgp graceful-restart restart-time 120bgp graceful-restart stalepath-time 360bgp graceful-restartneighbor 2.2.2.2 remote-as 200neighbor 2.2.2.2 ebgp-multihop 255address-family ipv4neighbor 2.2.2.2 activateexit-address-family!2.R3配置router bgp 200bgp log-neighbor-changesbgp graceful-restart restart-time 120bgp graceful-restart stalepath-time 360bgp graceful-restartneighbor 1.1.1.1 remote-as 100neighbor 1.1.1.1 ebgp-multihop 255address-family ipv4neighbor 1.1.1.1 activateexit-address-family!三 前后对比3.1 R1、R3配置非直连ebgp邻居多条功能前-邻居无法建立-路由无法学习R1#sh bgp all su//邻居状态不对For address family: IPv4 UnicastBGP router identifier 192.168.1.1, local AS number 100BGP table version is 10 BGP AS-PATH entries0 BGP Community entries0 BGP Prefix entries (Maximum-prefix:4294967295)Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd2.2.2.2 4 200 0 0 0 0 0 never IdleTotal number of neighbors 1, established neighbors 0R1#R1#R1#sh ip ro//没有路由Codes: C - Connected, L - Local, S - StaticR - RIP, O - OSPF, B - BGP, I - IS-IS, V - Overflow routeN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2SU - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2IA - Inter area, EV - BGP EVPN, A - Arp to hostLA - Local aggregate route* - candidate defaultGateway of last resort is no setC 1.1.1.0/30 is directly connected, GigabitEthernet 0/0C 1.1.1.1/32 is local host.O 2.2.2.0/30 [110/2] via 1.1.1.2, 00:04:44, GigabitEthernet 0/0C 192.168.1.1/32 is local host.R1#R1#sh bgp ipv4 unicastR1#3.2 R1、R3配置非直连ebgp邻居多条功能后-邻居正常建立-路由可以学习R1#sh bgp all su//邻居正常For address family: IPv4 UnicastBGP router identifier 192.168.1.1, local AS number 100BGP table version is 32 BGP AS-PATH entries0 BGP Community entries2 BGP Prefix entries (Maximum-prefix:4294967295)Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd2.2.2.2 4 200 7 5 3 0 0 00:03:191Total number of neighbors 1, established neighbors 1R1#R1#sh ip ro//路由学习正常Codes: C - Connected, L - Local, S - StaticR - RIP, O - OSPF, B - BGP, I - IS-IS, V - Overflow routeN1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2E1 - OSPF external type 1, E2 - OSPF external type 2SU - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2IA - Inter area, EV - BGP EVPN, A - Arp to hostLA - Local aggregate route* - candidate defaultGateway of last resort is no setC 1.1.1.0/30 is directly connected, GigabitEthernet 0/0C 1.1.1.1/32 is local host.O 2.2.2.0/30 [110/2] via 1.1.1.2, 00:11:56, GigabitEthernet 0/0C 192.168.1.1/32 is local host.B 192.168.11.1/32 [20/0] via 2.2.2.2, 00:00:15R1#R1#sh bgp ipv4 unicast//路由学习正常BGP table version is 3, local router ID is 192.168.1.1Status codes: s suppressed, d damped, h history, * valid, best, i - internal,S Stale, b - backup entry, m - multipath, f Filter, a additional-pathOrigin codes: i - IGP, e - EGP, ? - incompleteNetwork Next Hop Metric LocPrf Weight Path* 192.168.1.1/32 0.0.0.0 0 32768 i* 192.168.11.1/32 2.2.2.2 0 0 200 iTotal number of prefixes 2R1#