Diagnoses BGP session issues: neighbor states, missing prefixes, route-map/policy filtering, AS-path checks, and security evidence collection. Provides read-only troubleshooting workflow.
How this skill is triggered — by the user, by Claude, or both
Slash command
/everything-claude-code:network-bgp-diagnosticsThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
当 BGP 会话断开、抖动、建立但缺少路由或通告意外前缀时使用此技能。默认工作流是只读证据收集;策略和重置操作属于经过审查的更改窗口。
当 BGP 会话断开、抖动、建立但缺少路由或通告意外前缀时使用此技能。默认工作流是只读证据收集;策略和重置操作属于经过审查的更改窗口。
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
当设备使用 VRF、IPv6、VPNv4 或 EVPN 时,使用特定于平台的地址族命令。不要假设全局 IPv4 单播。
| 状态 | 首先检查 |
|---|---|
| 已建立且有前缀计数 | 路由交换已启动;检查策略和表选择 |
| 已建立但前缀为零 | 检查入站策略、最大前缀、已通告路由和 AFI/SAFI |
| Active | TCP 会话未完成;检查路由、源、ACL 和对等体可达性 |
| Connect | TCP 连接正在进行;检查路径和远程侦听器 |
| OpenSent/OpenConfirm | TCP 工作正常;检查 ASN、身份验证、计时器、功能和日志 |
| Idle | 邻居可能被禁用、缺少配置、被策略阻止或退避计时器 |
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
如果对等体从环回接口源,请确认两个方向都路由到环回地址,并且邻居配置使用预期的更新源。 避免禁用 ACL 或防火墙策略作为诊断快捷方式。首先读取命中计数器、日志和路径状态。
show bgp neighbors <peer> advertised-routes
show bgp neighbors <peer> routes
show ip prefix-list <name>
show route-map <name>
show bgp <prefix>
某些平台需要额外配置才能使 received-routes 可用。不要在事件分流期间添加该配置,除非操作员批准更改。
show bgp regexp _65001_
show bgp regexp ^65001$
show bgp <prefix>
show bgp neighbors <peer> advertised-routes | include Network|Path|<prefix>
谨慎使用 AS 路径正则表达式。_65001_ 将 AS 65001 匹配为标记。纯 65001 可以匹配更长的 ASN 或不相关的文本。
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({
"neighbor": match.group("neighbor"),
"remote_as": int(match.group("remote_as")),
"state": state,
"prefixes_received": prefixes_received,
"uptime": match.group("uptime"),
})
return rows
在可用时优先使用结构化解析器输出,但将原始输出与事件记录一起存储,因为 BGP 摘要格式因平台和地址族而异。
这些操作可能会影响路由,不应建议为自动诊断:
如果批准重置,优先使用平台支持的破坏性最小的软或路由刷新选项,并准确记录为什么它是安全的。
Active 总是意味着远程端已关闭。received-routes 输出视为没有路由到达的证明。cisco-ios-patternsnetwork-config-validationnetwork-interface-healthnpx claudepluginhub aaione/everything-claude-code-zhDiagnoses BGP session issues — down, flapping, missing routes, or unexpected prefixes — using read-only commands for neighbor state, route exchange, prefix policy, and AS path inspection.
Simulates BGP prefix hijacking and route leak attacks in isolated Containerlab labs with FRRouting to evaluate RPKI, route origin validation, and BGP monitoring defenses.
Simulates BGP prefix hijacking and route leak attacks in isolated lab environments to test RPKI deployment, route origin validation, and BGP monitoring defenses.