帮助排查 BGP 邻居状态、路由交换与策略问题,并安全收集诊断证据。
复制安装指令,让 AI 自动完成配置 · 推荐新手
请帮我安装 askskill 上的 "network-bgp-diagnostics" 技能: 1. 下载 https://raw.githubusercontent.com/affaan-m/ECC/main/skills/network-bgp-diagnostics/SKILL.md 2. 保存为 ~/.claude/skills/network-bgp-diagnostics/SKILL.md 3. 装好后重载技能,告诉我可以用了
请提供仅用于诊断的 BGP 排障步骤,分析邻居卡在 Idle/Active/Connect 状态的常见原因。按“先看什么命令、每条命令要关注什么字段、如何判断是对端配置、链路、ASN、认证或定时器问题”的结构输出,不要给出任何变更命令。
一份只读排障清单,说明应查看的状态、计时器、报文计数和错误线索,以及对应的可能根因。
我需要诊断某个前缀为什么没有从 BGP 邻居收到,或为什么没有被通告出去。请给出只读分析流程,覆盖 prefix-list、route-map、community、next-hop、max-prefix 和 address-family 方向的检查点,并说明每一步能排除什么问题。
一个按策略与路由传播路径组织的诊断流程,帮助定位过滤、属性或地址族配置相关问题。
请生成一套 BGP 取证与分析模板,用于检查某条路由的 AS Path、Local Preference、MED、Origin、下一跳和最佳路径选择依据。要求只包含安全的证据收集命令、输出解读方法,以及适合提交给网络团队的记录模板。
一套规范化的取证模板,包含只读命令、关键字段解释和便于升级处理的记录格式。
Use this skill when a BGP session is down, flapping, established with missing routes, or advertising unexpected prefixes. The default workflow is read-only evidence collection; policy and reset actions belong in a reviewed change window.
show bgp summary
show bgp neighbors <peer>
show ip route <peer>
show tcp brief | include <peer>|:179
show logging | include BGP|<peer>
show running-config | section router bgp
show ip prefix-list
show route-map
Use platform-specific address-family commands when the device uses VRFs, IPv6, VPNv4, or EVPN. Do not assume global IPv4 unicast.
| State | First checks |
|---|
| Established with prefix count | Route exchange is up; inspect policy and table selection |
| Established with zero prefixes | Check inbound policy, max-prefix, advertised routes, and AFI/SAFI |
| Active | TCP session is not completing; check routing, source, ACLs, and peer reachability |
| Connect | TCP connection is in progress; check path and remote listener |
| OpenSent/OpenConfirm | TCP works; check ASN, authentication, timers, capabilities, and logs |
| Idle | Neighbor may be disabled, missing config, blocked by policy, or backoff timer |
ping <peer> source <local-source>
traceroute <peer> source <local-source>
show ip route <peer>
show bgp neighbors <peer> | include BGP state|Last reset|Local host|Foreign host
If the peer is sourced from a loopback, confirm both directions route to the loopback addresses and that the neighbor config uses the expected update source.
Avoid disabling ACLs or firewall policy as a diagnostic shortcut. Read hit counters, logs, and path state first.
show bgp neighbors <peer> advertised-routes
show bgp neighbors <peer> routes
show ip prefix-list <name>
show route-map <name>
show bgp <prefix>
Some platforms require additional configuration before received-routes is
available. Do not add that configuration during incident triage unless the
operator approves the change.
show bgp regexp _65001_
show bgp regexp ^65001$
show bgp <prefix>
show bgp neighbors <peer> advertised-routes | include Network|Path|<prefix>
Use AS-path regex carefully. _65001_ matches AS 65001 as a token. Plain
65001 can match longer ASNs or unrelated text.
import re
from typing import Any
BGP_SUMMARY_RE = re.compile(
r"^(?P<neighbor>\d{1,3}(?:\.\d{1,3}){3})\s+"
r"(?P<version>\d+)\s+"
r"(?P<remote_as>\d+)\s+"
r"(?P<msg_rcvd>\d+)\s+"
r"(?P<msg_sent>\d+)\s+"
r"(?P<table_version>\d+)\s+"
r"(?P<input_queue>\d+)\s+"
r"(?P<output_queue>\d+)\s+"
r"(?P<uptime>\S+)\s+"
r"(?P<state_or_prefixes>\S+)$",
re.M,
)
def parse_bgp_summary(raw: str) -> list[dict[str, Any]]:
rows = []
for match in BGP_SUMMARY_RE.finditer(raw):
state_or_prefixes = match.group("state_or_prefixes")
if state_or_prefixes.isdigit():
state = "Established"
prefixes_received = int(state_or_prefixes)
else:
state = state_or_prefixes
prefixes_received = None
rows.append({
…
帮助你定位常见故障、兼容性问题并诊断状态机异常