agentsclimarketplace

Bgp config

Skill nanxiaoyao/network-huawei-skills/bgp-config

华为设备 BGP 动态路由配置(EBGP / IBGP 邻居建立、路由通告、反射器/联盟、双 ISP 接入、数据中心 EVPN 底层)。适用设备:USG6000E V500/V600 防火墙、CloudEngine 9800/8800/6800/5800 数据中心交换机。注意:S 系列接入/汇聚交换机一般不跑 BGP。From its SKILL.md

Install
npx -y skills add nanxiaoyao/network-huawei-skills --skill bgp-config

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

5.4 KB, ~2.0k tokens by cl100k_base, as published. Nobody here has run it

BGP 动态路由配置(华为)

触发场景

  • 数据中心 Spine-Leaf 跑 EBGP / IBGP 做底层路由
  • VXLAN EVPN 用 BGP 做控制面
  • 企业出口跑双 ISP 多线接入
  • 跨 AS 互联、与运营商对接
  • 大型园区核心层用 BGP 替代 OSPF 做路由汇聚

平台适用

设备类型是否支持典型场景
CloudEngine 数据中心交换机✅ 主战场DCN Spine-Leaf、VXLAN EVPN
USG6000E 防火墙✅ 常用双 ISP 接入、跨地域互联
S 系列接入/汇聚交换机❌ 不建议一般跑 OSPF/静态路由即可

配置六步走(基础 EBGP 邻居建立)

Step 1:规划 AS 号与 router-id

本端 AS:65001
对端 AS:65002(EBGP)/ 65001(IBGP)
Router-ID:建议用 Loopback0 地址(稳定)

Step 2:进入 BGP 视图

[~SwitchA] bgp 65001
[*SwitchA-bgp] router-id 1.1.1.1

Step 3:建立邻居

# EBGP(不同 AS)
[*SwitchA-bgp] peer 10.1.1.2 as-number 65002

# IBGP(相同 AS,通常用 Loopback 建立)
[*SwitchA-bgp] peer 2.2.2.2 as-number 65001
[*SwitchA-bgp] peer 2.2.2.2 connect-interface LoopBack0

Step 4:进入地址族,激活邻居

[*SwitchA-bgp] ipv4-family unicast
[*SwitchA-bgp-af-ipv4] peer 10.1.1.2 enable
[*SwitchA-bgp-af-ipv4] peer 2.2.2.2 enable

Step 5:通告本地路由

# 方式 1:network 精确通告
[*SwitchA-bgp-af-ipv4] network 192.168.10.0 24

# 方式 2:import-route 引入其他协议
[*SwitchA-bgp-af-ipv4] import-route ospf 1
[*SwitchA-bgp-af-ipv4] import-route direct

Step 6:CE 设备必须 commit 提交

[*SwitchA-bgp-af-ipv4] commit

⚠️ CE V200R022+ 是两阶段提交,不 commit 配置不生效。USG 防火墙和 S 交换机不需要。

核心命令体系

类别命令说明
启用bgp <as-number>启动 BGP 进程
标识router-id <ip>设置 router-id(必配)
邻居peer <ip> as-number <as>指定邻居 AS
邻居peer <ip> connect-interface LoopBack0用 Loopback 建邻居
邻居peer <ip> ebgp-max-hop <n>EBGP 多跳(Loopback 必配)
激活peer <ip> enable在地址族内激活
通告network <ip> <mask-len>精确通告路由
引入import-route <protocol>引入其他协议路由
反射器peer <ip> reflect-client配置路由反射器客户端
团体peer <ip> advertise-community通告团体属性
联盟confederation id <as>配置 BGP 联盟
认证peer <ip> password cipher <pwd>MD5 认证
BFDpeer <ip> bfd enable启用 BFD 联动快速收敛

典型场景

场景 1:EBGP + IBGP 全互联(CE 数据中心)

  • SwitchA (AS65001) ←EBGP→ SwitchB (AS65002)
  • SwitchB / SwitchC / SwitchD 之间 IBGP 全互联
  • 关键:IBGP 必须全互联或用反射器,否则路由不传递

场景 2:路由反射器(解决 IBGP 全互联爆炸)

  • 选定一台作为 RR,其余作为 Client
  • RR 上:peer <client-ip> reflect-client
  • Client 之间不用互建邻居,由 RR 反射路由

场景 3:USG 防火墙双 ISP 接入

  • USG 同时与电信、联通建立 EBGP
  • 配合 route-policy 控制路由优选
  • 出方向通告本地公网段,入方向接受默认路由或全表

场景 4:VXLAN EVPN 底层 IBGP

  • Spine 作为 RR,Leaf 作为 Client
  • 启用 l2vpn-family evpn 地址族
  • 邻居用 Loopback 建立(CE Spine-Leaf 标准范式)

场景 5:BFD 联动快速收敛

  • peer <ip> bfd enable 把 BGP Keepalive 从秒级降到毫秒级
  • 链路断开 50ms 内感知,路由立即切换

排错思路

  1. 邻居建不起来(Idle / Active 状态)

    • display bgp peer 看状态
    • 检查 AS 号、IP 互通(ping)、防火墙策略放行 TCP 179
    • IBGP 用 Loopback 时检查 connect-interface 和路由
    • EBGP 用 Loopback 时必须配 ebgp-max-hop
  2. 邻居 Established 但收不到路由

    • 对端 display bgp routing-table 是否有路由
    • 本端是否在地址族内 peer xxx enable 激活
    • 是否被 route-policy 过滤
  3. 路由通告了但对端不接收

    • 检查 IBGP 水平分割(IBGP 学到的路由默认不传给其他 IBGP 邻居 → 需反射器)
    • 检查 next-hop 是否可达(IBGP 默认不改 next-hop)
  4. 路由频繁震荡

    • 启用 dampening(路由衰减)
    • 启用 BGP 下一跳迭代震荡抑制

平台差异

CE 数据中心USG 防火墙S 接入交换机
支持度完整(含 EVPN)完整(IPv4/IPv6)不建议
提交方式必须 commit直接生效直接生效
典型场景Spine-Leaf / EVPN双 ISP / 跨地域
Loopback 邻居标配常用

速查参考

详细命令清单见 references/bgp-commands.md 故障排查手册见 references/bgp-troubleshooting.md 完整配置场景见 references/bgp-scenarios.md

What ships with it: 3 files

18.6 KB alongside SKILL.md

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.