show bgp / show ip bgp / show ipv6 bgp サブコマンド¶
概要¶
BGP 状態表示用の CLI は 3 系統に分かれている:
show bgp ...... CONFIG_DB のBGP_DEVICE_GLOBAL/BGP_AGGREGATE_ADDRESSをshow/bgp_cli.pyが直接 dump(FRR を経由しない)。show ip bgp .../show ipv6 bgp ......show/bgp_frr_v4.py/bgp_frr_v6.pyがvtysh -c "show ip bgp ..."を内部実行して FRR の出力を整形。show running-configuration bgp...show/main.pyがvtysh -c "show running-config"を実行(別ページ「show running-config」を参照)。
show bgp グループは show/main.py 末尾で cli.add_command(bgp_cli.BGP) の形で登録される1ため、cli.json の機械抽出には現れない。本ページではこの隠れたサブグループを含めて整理する。
コマンド一覧¶
show bgp ... (CONFIG_DB 直接 dump、FRR 不経由)¶
| コマンド | 用途 |
|---|---|
show bgp device-global [-j\|--json] |
TSA / W-ECMP の現在状態を CONFIG_DB から表示 |
show bgp aggregate-address ipv4 [-j\|--json] |
IPv4 集約 prefix の設定一覧 |
show bgp aggregate-address ipv6 [-j\|--json] |
IPv6 集約 prefix の設定一覧 |
show ip bgp ... / show ipv6 bgp ... (FRR 経由)¶
| コマンド | 用途 |
|---|---|
show ip bgp summary [-n NS] [--display NS_OR_ALL] |
IPv4 BGP セッションサマリ |
show ip bgp neighbors [<ipaddress>] [routes\|advertised-routes\|received-routes] [-n NS] |
隣接情報 |
show ip bgp network [<ip\|prefix>] [bestpath\|json\|longer-prefixes\|multipath] [-n NS] |
RIB の prefix lookup |
show ip bgp aggregate-address |
bgp_cli の IPv4 aggregate 表示への shim |
show ip bgp vrf <vrf> summary / neighbors ... / network ... |
VRF 配下の BGP 情報(パラメータは default VRF と同じ) |
show ipv6 bgp summary / neighbors / network / vrf ... |
IPv6 版(IPv4 と同等の subcommand 体系) |
各コマンドの詳細¶
show bgp device-global [-j]¶
db.cfgdb.get_table(BGP_DEVICE_GLOBAL)['STATE'] を読み、tsa_enabled / wcmp_enabled を to_str で Yes/No 形式に変換して表示する。--json で {"tsa": ..., "w-ecmp": ...} の dict 出力。CONFIG_DB に未設定なら No configuration is present in CONFIG DB と表示して exit 02。
📋 検証エビデンス: sonic-net/sonic-utilities/show/bgp_cli.py#L57-L130 (sha: 39732bceb8bdefe706518ab40623bbbba6ff33b9)
出典:
sonic-net/sonic-utilities/show/bgp_cli.py#L57-L130 (sha: 39732bceb8bdefe706518ab40623bbbba6ff33b9)
抜粋:
show bgp aggregate-address <ipv4|ipv6>¶
BGP_AGGREGATE_ADDRESS テーブルから該当 family のエントリを抽出し、bbr-required / summary-only / as-set / aggregate-address-prefix-list / contributing-address-prefix-list をテーブル表示する。
show ip bgp summary [-n] [--display]¶
bgp_util.get_bgp_summary_from_all_bgp_instances(IPV4, namespace, display, vrf=default) で各 namespace の bgpd から取得した summary を集約。multi-ASIC では --display が frontend(external 隣接)/ all(internal 隣接含む)を切り替える3。
show ip bgp neighbors [<ipaddress>] [<info_type>]¶
内部で vtysh -c "show ip bgp vrf default neighbor [<ip> [routes|advertised-routes|received-routes]]" を組み立てて FRR コンテナ内で実行する。引数の <info_type> は <ipaddress> を指定したときのみ意味を持つ。
<ipaddress> を指定すると bgp_util.get_namespace_for_bgp_neighbor が当該 IP を持つ namespace を逆引きし、-n の値と矛盾していれば警告して 実 namespace を優先 する。
show ip bgp network [<ip|prefix>] [<info_type>]¶
info_type は bestpath / json / longer-prefixes / multipath の Choice。longer-prefixes は prefix(/ を含む)指定時のみ 有効で、IP 単独で渡すと Abort する4。chassis supervisor では rexec all 経由で全ライン カードで実行される。
show ip bgp vrf <vrf> {summary|neighbors|network}¶
vrf を click context の親 group から取り出し、ヘルパに vrf=<name> を渡して default と同じパスを通す。VNet 名も VRF として扱う。
IPv6 (show ipv6 bgp ...)¶
bgp_frr_v6.py の構造は v4 と完全に対称で、内部で組み立てる FRR コマンドが show ipv6 bgp ... になるだけ。bestpath / longer-prefixes 等の制約も同じ。
内部呼び出し¶
| CLI | 内部実行 |
|---|---|
show ip bgp summary |
bgp_util.get_bgp_summary_from_all_bgp_instances → vtysh -c "show ip bgp vrf <vrf> summary json" |
show ip bgp neighbors |
vtysh -c "show ip bgp vrf <vrf> neighbor ..." |
show ip bgp network |
vtysh -c "show ip bgp vrf <vrf> [<prefix>] [<info_type>]" |
show bgp device-global |
CONFIG_DB の BGP_DEVICE_GLOBAL 直接読み |
show bgp aggregate-address |
CONFIG_DB の BGP_AGGREGATE_ADDRESS 直接読み |
vtysh は bgp コンテナ内の FRR と通信するため、コンテナ起動前のタイミングではエラーになる。
chassis supervisor の挙動¶
show ip bgp系のnetwork以外は、chassis supervisor で叩くとrexec all -c "show ip bgp ..."で全ライン カードに伝搬される5。networkだけは supervisor 上で直接実行できる。
multi-ASIC オプション¶
-n / --namespace... 単一 namespace 名 (asic0等) またはall。-d / --display...frontend/all。frontendは external 向けセッションのみ。
データフロー (自動生成)¶
flowchart LR
CLI["show bgp"]
CDB0[("CONFIG_DB<br/>BGP_DEVICE_GLOBAL")]
CDB0 --> CLI
CDB1[("CONFIG_DB<br/>BGP_AGGREGATE_ADDRESS")]
CDB1 --> CLI
凡例
show 系 (CONFIG_DB → CLI) のミニ図。テーブル → daemon 対応は docs/reference/config-db-orch-map.md から機械生成。
関連リファレンス¶
- CONFIG_DB:
BGP_DEVICE_GLOBAL/BGP_AGGREGATE_ADDRESS
引用元¶
実行例¶
典型的な使い方¶
よくある引数の組み合わせ¶
# VRF サマリ / IPv6 サマリ
show ip bgp vrf Vrf_Red summary
show ipv6 bgp summary
# 特定隣接の advertised / received routes
show ip bgp neighbors 10.0.0.1 advertised-routes
期待される出力 (抜粋)¶
Neighbor V AS MsgRcvd MsgSent TblVer InQ OutQ Up/Down State/PfxRcd
10.0.0.1 4 65100 1023 1019 0 0 0 01:25:34 128
10.0.0.5 4 65100 980 982 0 0 0 01:25:30 128
運用ヒント¶
典型的な利用シーン¶
- BGP セッションが UP しているか、prefix 学習数が想定どおりかをオペ監視で確認する。
- 障害切り分け時に隣接ステータス・received-routes・advertised-routes を順に追う。
よくある落とし穴¶
show ip bgp summaryは default VRF のみで、VRF 設定がある場合はshow ip bgp vrf <name> summaryを使う。- multi-ASIC 機種では
-n asic0などで namespace を明示しないと一部 ASIC の状態が見えない。
関連する show / debug¶
関連 CLI コマンド¶
config bgp— config bgp サブコマンドconfig default route— config default-route(デフォルトルート設定パターン)config route— config route サブコマンド(static route)config vrf— config vrf サブコマンドshow arp— show arp サブコマンド
関連ページ¶
-
show/main.py末尾でcli.add_command(bgp_cli.BGP)(show/bgp_cli.pyのBGPgroup がshow bgpとして登録される)。https://github.com/sonic-net/sonic-utilities/blob/39732bceb8bdefe706518ab40623bbbba6ff33b9/show/main.py ↩ -
show bgp device-global実装はshow/bgp_cli.pyL57-L130。https://github.com/sonic-net/sonic-utilities/blob/39732bceb8bdefe706518ab40623bbbba6ff33b9/show/bgp_cli.py#L57 ↩ -
bgp_frr_v4.pyのsummary_helper(L160-L164) がbgp_util.get_bgp_summary_from_all_bgp_instancesにdisplayを渡す。 ↩ -
network_helperのlonger-prefixes制約はshow/bgp_frr_v4.pyL225-L228。https://github.com/sonic-net/sonic-utilities/blob/39732bceb8bdefe706518ab40623bbbba6ff33b9/show/bgp_frr_v4.py#L225 ↩ -
chassis supervisor 分岐は
bgpgroup 関数(L23-L33)でrexecを呼ぶ。 ↩