Communitygithub.com

ネットワークBGP診断

BGPネイバー状態、経路交換、プレフィックスポリシー、ASパス検査、安全な証拠収集のための診断専用BGPトラブルシューティングパターン。BGPネイバーがダウンしている、経路が欠落している、プレフィックスポリシーやASパスの検査が必要な場合に使用します。

ネットワークBGP診断 とは?

このスキルは、BGPセッションがダウン、フラッピング、確立されているが経路が欠落している、または予期しないプレフィックスを広告している場合に、読み取り専用の証拠収集とトリアージを実施するためのものです。デフォルトのワークフローは変更を伴わない診断に限定され、ポリシーの変更やリセットアクションはレビューを経た変更ウィンドウ内で行う必要があります。このスキルは、Cisco IOS、Nexus、Juniper JunOS、Arista EOSなど、BGPをサポートする任意のネットワークプラットフォームで使用できます。このスキルは、ネイバー状態の解釈、トランスポート到達可能性の確認、ルートポリシー(プレフィックスリスト、ルートマップ、最大プレフィックス制限、ASパス)の検査、安全な証拠収集のための具体的なコマンドとパーサーパターンを提供します。また、診断を誤った方向に導くアンチパターンや、セッションリセットなどの変更を伴うアクションを実施する前に確認すべき項目についても言及しています。

対応~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/affaan-m/everything-claude-code/tree/main/skills/network-bgp-diagnostics

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Network BGP Diagnostics (ネットワークBGP診断)

このスキルは、BGPセッションがダウンしている、フラッピングしている、確立されているが経路が欠落している、または予期しないプレフィックスを広告している場合に使用します。デフォルトのワークフローは読み取り専用の証拠収集です。ポリシーの変更やリセットアクションは、レビューを経た変更ウィンドウ内で行う必要があります。

使用すべき状況

  • BGPネイバーが Idle、Connect、Active、OpenSent、または OpenConfirm 状態でスタックしている。
  • セッションは Established だが、期待されるプレフィックスが欠落している。
  • route-map、prefix-list、max-prefix制限、またはASパスポリシーが経路をフィルタリングしている可能性がある。
  • BGP変更の前後で証拠を収集する必要がある。
  • BGPサマリー出力を解析する自動化をレビューしている。

読み取り専用トリアージフロー

  1. 正確なネイバー、アドレスファミリ、VRF、およびローカル/リモートASNを特定する。
  2. サマリー状態と最終リセット理由を取得する。
  3. ピアの送信元アドレスへの到達可能性を確認する。
  4. トランスポート障害を推定する前に、ルートポリシー参照を確認する。
  5. プラットフォームがサポートするコマンドを使用して、広告済み、受信済み、およびインストール済みの経路を比較する。
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ユニキャストを想定しないでください。

状態の解釈

状態最初に確認すべき項目
Established (プレフィックス数あり)経路交換は稼働中。ポリシーとテーブル選択を検査する
Established (プレフィックス数0)受信ポリシー、max-prefix、広告済み経路、および AFI/SAFI を確認する
ActiveTCPセッションが完了していない。ルーティング、送信元、ACL、およびピア到達可能性を確認する
ConnectTCP接続が進行中。パスとリモートリスナーを確認する
OpenSent/OpenConfirmTCPは動作中。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 を使用可能にするために追加の設定が必要です。インシデントトリアージ中にその設定を追加しないでください。ただし、オペレーターが変更を承認した場合は除きます。

ASパスおよびプレフィックスのレビュー

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サマリーフォーマットはプラットフォームやアドレスファミリによって異なるため、生の出力もインシデントレコードと一緒に保存してください。

変更ウィンドウ限定

以下のアクションはルーティングに影響を与える可能性があるため、自動診断として提案すべきではありません。

  • BGPセッションのクリア。
  • ネイバー認証、タイマー、更新送信元、route-map、またはprefix-listの変更。
  • 追加の受信経路ストレージの有効化。
  • ファイアウォール、ACL、またはコントロールプレーンポリシーの緩和。

リセットが承認された場合は、プラットフォームがサポートする最も影響の少ないソフトまたはルートリフレッシュオプションを優先し、なぜそれが安全であるかを正確に文書化してください。

アンチパターン

  • Active が常にリモート側のダウンを意味すると想定する。
  • VRF、アドレスファミリ、または更新送信元の違いを無視する。
  • トークン境界なしで広範なASパス正規表現を使用する。
  • 最終リセット理由とログを読む前にピアをハードリセットする。
  • received-routes 出力の欠落を、経路が到着していない証拠として扱う。

関連情報

  • スキル: cisco-ios-patterns
  • スキル: network-config-validation
  • スキル: network-interface-health

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

accessibility

Design, implement, and audit inclusive digital products using WCAG 2.2 Level AA. Use when building or auditing UI that must meet WCAG 2.2 Level AA, or when reviewing a change for keyboard, contrast, or screen-reader support.

affaan-m/claude-api

Anthropic Claude API patterns for Python and TypeScript. Covers Messages API, streaming, tool use, vision, extended thinking, batches, prompt caching, and Claude Agent SDK. Use when building applications with the Claude API or Anthropic SDKs.

affaan-m/everything-claude-code

End-to-end marketing campaign planning and execution. Covers audience research, positioning, campaign angle definition, landing page copy, email sequences, social posts, ad copy, short-form video scripts, and content calendars. Use as the orchestration layer for multi-channel product launches. Use when planning or executing a multi-channel product launch, or producing landing page, email, social, or ad copy.

affaan-m/everything-claude-code

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/everything-claude-code-conventions

Development conventions and patterns for everything-claude-code. JavaScript project with conventional commits.

affaan-m/frontend-design

Create distinctive, production-grade frontend interfaces with high design quality. Use when the user asks to build web components, pages, or applications and the visual direction matters as much as the code quality.

affaan-m/gget

gget CLI and Python workflow for quick genomic database queries, sequence lookup, BLAST-style searches, enrichment checks, and reproducible bioinformatics evidence logs.

affaan-m/literature-review

Systematic literature-review workflow for academic, biomedical, technical, and scientific topics, including search planning, source screening, synthesis, citation checks, and evidence logging.

affaan-m/motion-ui

Production-ready UI motion system for React/Next.js. Use when implementing animations, transitions, or motion patterns.

affaan-m/project-guidelines-example

Example project-specific skill template based on a real production application.

affaan-m/pubmed-database

Direct PubMed and NCBI E-utilities search workflows for biomedical literature, MeSH queries, PMID lookup, citation retrieval, and API-backed literature monitoring.

affaan-m/scholar-evaluation

Structured scholarly-work evaluation for papers, proposals, literature reviews, methods sections, evidence quality, citation support, and research-writing feedback.

affaan-m/uspto-database

USPTO patent and trademark data workflow for official record lookup, PatentSearch queries, TSDR checks, assignment data, and reproducible IP research logs.

agent-architecture-audit

Full-stack diagnostic for agent and LLM applications. Audits the 12-layer agent stack for wrapper regression, memory pollution, tool discipline failures, hidden repair loops, and rendering corruption. Produces severity-ranked findings with code-first fixes. Essential for developers building agent applications, autonomous loops, or any LLM-powered feature. Use when an agent or LLM feature misbehaves and the failing layer is unknown, or before shipping an agent stack.

agent-eval

Head-to-head comparison of coding agents (Claude Code, Aider, Codex, etc.) on custom tasks with pass rate, cost, time, and consistency metrics. Use when choosing between coding agents, or when a change to an agent setup needs measured pass rate, cost, and time rather than an impression.

agent-harness-construction

Design and optimize AI agent action spaces, tool definitions, and observation formatting for higher completion rates. Use when defining or revising an agent

agentic-engineering

Operate as an agentic engineer using eval-first execution, decomposition, and cost-aware model routing. Use when planning or executing engineering work that agents will carry out end to end.

agentic-os

Build persistent multi-agent operating systems on Claude Code. Covers kernel architecture, specialist agents, slash commands, file-based memory, scheduled automation, and state management without external databases. Use when building a persistent multi-agent system on Claude Code with its own memory, commands, and scheduling.

agent-introspection-debugging

Structured self-debugging workflow for AI agent failures using capture, diagnosis, contained recovery, and introspection reports. Use when an agent run fails and you need a reproducible diagnosis instead of a retry.

agent-payment-x402

Add x402 payment execution to AI agents with per-task budgets, spending controls, and non-custodial wallets. Supports Base through agentwallet-sdk and X Layer through OKX Payments / OKX Agent Payments Protocol. Use when an agent must pay for something itself and needs per-task budgets, spending controls, and a non-custodial wallet.

関連スキル