show arp サブコマンド¶
概要¶
show arp は IPv4 の 隣接テーブル(ARP テーブル)を表示する click コマンド。実装は単なる薄いラッパで、内部では scripts/nbrshow を -4 付きで起動する1。nbrshow 側が APPL_DB の NEIGH_TABLE と kernel の ip neigh 出力を突き合わせて表形式に整形する。
シグネチャ¶
| オプション | 意味 |
|---|---|
<ipaddress> (positional, optional) |
1 エントリのみ絞り込む IPv4 アドレス |
-if, --iface |
インタフェース名でフィルタ。alias モード時は iface_alias_converter.alias_to_name() で内部名へ変換 |
-n, --namespace |
multi-ASIC 時の namespace 指定(multi_asic_click_options 由来) |
-d, --display |
all / frontend 等の display スコープ |
--verbose |
起動する nbrshow コマンド文字列を echo |
起動コマンド¶
cmd = ['nbrshow', '-4']
if ipaddress: cmd += ['-ip', str(ipaddress)]
if iface: cmd += ['-if', str(iface)] # alias 名は内部名に変換
if namespace: cmd += ['-n', str(namespace)]
cmd += ['-d', str(display)]
nbrshow 自体は Python スクリプトで、scripts/nbrshow に置かれている。
別名と関連¶
show ip arp も同じ arp コマンドを show ip グループに add_command した結果として動く(cli 直下と ip サブ両方に同じ関数が登録される)。
クリア側は sonic-clear arp [<ipaddress>] [-n <ns>] が対称。詳細は clear (sonic-clear) コマンド を参照。
CONFIG_DB との接点¶
ARP テーブルは kernel の neighbor table(および swss/neighsyncd 経由で APPL_DB の NEIGH_TABLE に同期)で管理されるため、show arp 自体は CONFIG_DB を読まない。
データフロー (自動生成)¶
flowchart LR
CLI["show arp"]
SRC0[("APP_DB<br/>NEIGH_TABLE")]
V0["nbrshow (-4)"]
SRC0 --> V0 --> CLI
凡例
show 系 (データソース → ラッパスクリプト → CLI) のミニ図。CONFIG_DB は経由しない。
関連リファレンス¶
- (関連リンクなし)
引用元¶
実行例¶
典型的な使い方¶
よくある引数の組み合わせ¶
期待される出力 (抜粋)¶
Address MacAddress Iface Vlan
-------------- ----------------- ------------ ----
10.0.0.1 00:11:22:33:44:55 Ethernet0 -
10.0.0.5 00:11:22:33:44:66 Ethernet4 -
Total number of entries 2
運用ヒント¶
典型的な利用シーン¶
よくある落とし穴¶
show arpは default VRF。VRF 内 ARP はshow arp -V <vrf>またはip neigh show vrf <vrf>。- STATE_DB の NEIGH_TABLE と kernel ARP がズレる場合あり。両方で裏取り。
関連する show / debug¶
関連 CLI コマンド¶
config bgp— config bgp サブコマンドconfig default route— config default-route(デフォルトルート設定パターン)config route— config route サブコマンド(static route)config vrf— config vrf サブコマンドshow bfd— show bfd サブコマンド
-
arpの click 定義とnbrshow -4起動部分はshow/main.pyL421-L446。https://github.com/sonic-net/sonic-utilities/blob/39732bceb8bdefe706518ab40623bbbba6ff33b9/show/main.py#L421 ↩