news 2026/6/25 12:17:32

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

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
ebgp邻居非直连无法建立邻居解决方法(2)

一 拓扑说明

R1、R2、R3通过ospf建立邻居,R1和R3通过非直连物理接口建立EBGP邻居

注意:默认情况下,BGP认为EBGP邻居是直连可达的。如果EBGP邻居间不是直连可达,则必须在BGP视图下配置允许同非直接相连网络上的邻居建立EBGP连接。

二 R1和R3设备配置

1.R1配置

router bgp 100

bgp log-neighbor-changes

bgp graceful-restart restart-time 120

bgp graceful-restart stalepath-time 360

bgp graceful-restart

neighbor 2.2.2.2 remote-as 200

neighbor 2.2.2.2 ebgp-multihop 255

address-family ipv4

neighbor 2.2.2.2 activate

exit-address-family

!

2.R3配置

router bgp 200

bgp log-neighbor-changes

bgp graceful-restart restart-time 120

bgp graceful-restart stalepath-time 360

bgp graceful-restart

neighbor 1.1.1.1 remote-as 100

neighbor 1.1.1.1 ebgp-multihop 255

address-family ipv4

neighbor 1.1.1.1 activate

exit-address-family

!

三 前后对比

3.1 R1、R3配置非直连ebgp邻居多条功能前-邻居无法建立-路由无法学习

R1#sh bgp all su//邻居状态不对

For address family: IPv4 Unicast

BGP router identifier 192.168.1.1, local AS number 100

BGP table version is 1

0 BGP AS-PATH entries

0 BGP Community entries

0 BGP Prefix entries (Maximum-prefix:4294967295)

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd

2.2.2.2 4 200 0 0 0 0 0 never Idle

Total number of neighbors 1, established neighbors 0

R1#

R1#

R1#sh ip ro//没有路由

Codes: C - Connected, L - Local, S - Static

R - RIP, O - OSPF, B - BGP, I - IS-IS, V - Overflow route

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2

SU - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

IA - Inter area, EV - BGP EVPN, A - Arp to host

LA - Local aggregate route

* - candidate default

Gateway of last resort is no set

C 1.1.1.0/30 is directly connected, GigabitEthernet 0/0

C 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/0

C 192.168.1.1/32 is local host.

R1#

R1#sh bgp ipv4 unicast

R1#

3.2 R1、R3配置非直连ebgp邻居多条功能后-邻居正常建立-路由可以学习

R1#sh bgp all su//邻居正常

For address family: IPv4 Unicast

BGP router identifier 192.168.1.1, local AS number 100

BGP table version is 3

2 BGP AS-PATH entries

0 BGP Community entries

2 BGP Prefix entries (Maximum-prefix:4294967295)

Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd

2.2.2.2 4 200 7 5 3 0 0 00:03:191

Total number of neighbors 1, established neighbors 1

R1#

R1#sh ip ro//路由学习正常

Codes: C - Connected, L - Local, S - Static

R - RIP, O - OSPF, B - BGP, I - IS-IS, V - Overflow route

N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2

E1 - OSPF external type 1, E2 - OSPF external type 2

SU - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2

IA - Inter area, EV - BGP EVPN, A - Arp to host

LA - Local aggregate route

* - candidate default

Gateway of last resort is no set

C 1.1.1.0/30 is directly connected, GigabitEthernet 0/0

C 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/0

C 192.168.1.1/32 is local host.

B 192.168.11.1/32 [20/0] via 2.2.2.2, 00:00:15

R1#

R1#sh bgp ipv4 unicast//路由学习正常

BGP table version is 3, local router ID is 192.168.1.1

Status codes: s suppressed, d damped, h history, * valid, > best, i - internal,

S Stale, b - backup entry, m - multipath, f Filter, a additional-path

Origin codes: i - IGP, e - EGP, ? - incomplete

Network 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 i

Total number of prefixes 2

R1#

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/6/25 12:17:23

AlienFX Tools实战指南:3种方案解决Alienware灯光风扇控制难题

AlienFX Tools实战指南:3种方案解决Alienware灯光风扇控制难题 【免费下载链接】alienfx-tools Alienware systems lights, fans, and power control tools and apps 项目地址: https://gitcode.com/gh_mirrors/al/alienfx-tools AlienFX Tools是一套专为Ali…

作者头像 李华
网站建设 2026/6/25 12:14:47

基于OpenClaw与GLM-4.7-Flash的智能API自动化测试实践

1. 项目概述与核心价值最近在折腾一个挺有意思的自动化测试项目,核心是围绕OpenClaw这个开源工具,让它去驱动GLM-4.7-Flash这个轻量级大模型,来对一堆API接口进行连续、稳定的验证,最后还能自动生成一份清晰可读的测试报告。听起来…

作者头像 李华
网站建设 2026/6/25 12:13:17

基于LAMA模型的智能视频水印清除方案:释放你的创作自由

基于LAMA模型的智能视频水印清除方案:释放你的创作自由 【免费下载链接】WatermarkRemover 批量去除视频中位置固定的水印 项目地址: https://gitcode.com/gh_mirrors/wa/WatermarkRemover 在数字内容创作时代,视频水印常常成为内容重用的主要障碍…

作者头像 李华
网站建设 2026/6/25 12:12:59

AI动态简报之技术前沿篇(2026.06.23)

🔥 第1条:小米MiMo Code开源——长线自动化AI编程范式彻底重构核心内容:小米MiMo团队正式开源基于OpenCode构建的终端AI编程智能体MiMo Code,搭载"计算、记忆、进化"三位一体核心能力。其基于SQLite FTS5的跨会话持久化…

作者头像 李华
网站建设 2026/6/25 12:12:34

《男频文里的恶毒青梅》小说|下载|txt

资料可下载《男频文里的恶毒青梅》小说全文百度可下载https://pan.baidu.com/s/1E5TUzoRxRucoVBRu6h6QeQ?pwdrbvpEnglish Practice Set 36 个人练习草稿,随便记几道题。Part 1 Vocabulary Choose the best word.They grew up together and were ______ friends s…

作者头像 李华
网站建设 2026/6/25 12:09:26

终极macOS菜单栏整理方案:Ice让你的Mac界面瞬间清爽高效

终极macOS菜单栏整理方案:Ice让你的Mac界面瞬间清爽高效 【免费下载链接】Ice Powerful menu bar manager for macOS 项目地址: https://gitcode.com/GitHub_Trending/ice/Ice 还在为Mac顶部菜单栏拥挤不堪而烦恼吗?每次找图标都要眯着眼睛在一堆…

作者头像 李华