0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

pktcap-uwリファレンス(継続更新)

Last updated at Posted at 2025-02-04

本記事は生成AIの出力をベースにしています。

はじめに

pktcap-uw は、VMware ESXi に標準搭載されているパケットキャプチャツールです。従来の tcpdump-uw VMKernelインタフェース(vmkX)しかキャプチャできませんでしたが、pktcap-uwは、より詳細なパケット解析が可能であり、VMKernelインタフェース(vmkX)、仮想スイッチポート、物理NIC(vmnicX)という、多様なポイントでのキャプチャに対応しています。本記事では、pktcap-uw の主要なコマンドオプションや設定可能なパラメータについて詳しく解説します。

pktcap-uw の基本構文

pktcap-uw は、ESXi の SSH または ESXi Shell から実行できます。基本的なコマンド構文は以下の通りです。

pktcap-uw [オプション] [キャプチャ対象] [出力オプション] [フィルタ]

例:

pktcap-uw --uplink vmnic0 --capture UplinkRcv

このコマンドは、vmnic0(物理NIC)を通るパケットをキャプチャします。

pktcap-uwコマンドのヘルプ(一部)

ヘルプの一部を掲載します。すべてを見たい場合は pktcap-uwのヘルプ(すべて)を参照ください。

[root@esxi:~] pktcap-uw -h
Packet Capture and Trace command usage:
        == Create session to capture packets ==
         pktcap-uw [--capture <capture point>[,capture point]...
              | [--dir <0|input|1|output|2|inputAndOutput>]
                [--stage <0|pre|1|post>] [-K|--kernelside]]
            [--switchport <PortID> | --vmk <vmknic> | --uplink <vmnic> |
               --fcport [fastpathSwitchID.]<PortID> |
               --dvfilter <filter name> |
               --overlay <overlay class name>]
            [--lifID <lif id for vdr>]
            [-f [module name.]<function name>[:offset]]
            [-AFhP] [-p|--port <Socket PORT>]
            [-c|--count <number>] [-s|--snapLen <length>]
            [-G <seconds>]
            [-C <file_size>]
            [-W <file_count>]
            [-o|--outfile <FILE>] [--console]
            [Flow filter options]

主なオプション一覧

キャプチャ対象(スイッチポート関連)の指定

キャプチャしたいインタフェースを指定します。
後述の--captureや--dir,--stageを指定しない場合は、vSwtichに向かう方向のパケットのみがキャプチャされます。

オプション 説明
--switchport <port ID> 指定した仮想スイッチポートのパケットをキャプチャ(net-stats -lでポート番号を調べる) pktcap-uw --switchport 67108888
--vmk <vmknic> 指定したVMkernel インターフェースのパケットをキャプチャ pktcap-uw --vmk vmk0
--uplink <vmnic> 指定した物理NICのパケットをキャプチャ pktcap-uw --uplink vmnic1

--capture オプション

パケットをキャプチャする具体的なポイントを指定します。
主にVMkernel(vmk)インターフェース、仮想スイッチポート、物理NIC(vmnic)上の送受信ポイントを対象とします。
キャプチャしたいインタフェース毎に、指定できるキャプチャポイントが決まっています。
指定できる値はキャプチャポイント(--capture)で指定可能な値のリストを参照ください。
図示したものはキャプチャポイント(--capture)で指定可能な値の一部の図示を参照ください。

キャプチャインタフェース キャプチャポイント 説明
--switchport VnicTx 仮想マシンから送信された直後
--switchport VnicRx 仮想マシンが受信する直前
--switchport PortInput 仮想マシンから送信され、仮想スイッチポートが受信する直前
--switchport PortOutput 仮想マシンに向けて、仮想スイッチポートから送信された直後
--vmk TcpipTx VMKernelインタフェースから送信された直後
--vmk TcpipRx VMKernelインタフェースが受信する直前
--vmk PortInput VMKernelインタフェースから送信され、仮想スイッチポートが受信する直前
--vmk PortOutput VMKernelインタフェースに向けて、仮想スイッチポートから送信された直後
--uplink PortInput 物理NICで受信し、仮想スイッチポートに入力される直前
--uplink PortOutput 物理NICに向けて、仮想スイッチポートから送信された直後
--uplink UplinkSndKernel ホスト外部に向けたパケットを、物理NICが受信する直前
--uplink UplinkRcvKernel ホスト外部から受信したパケットが、物理NICから仮想スイッチ方向に送信された直後

例:

pktcap-uw --uplink vmnic0 --capture UplinkSndKernel,UplinkRcvKernel

--dir オプション

キャプチャするパケットの流れる方向を--dirの値に従って決定します。
このオプションはキャプチャインタフェースが--switchport, --vmk, --uplink, --fcportの場合のみ利用可能です。
--captureと併用することはできません。

後述の--stageと組み合わせて使うことで、--captureと同様のことが可能となります。

説明
0, input 仮想スイッチ方向に向かうパケットのみをキャプチャ(デフォルト)
1, output 仮想スイッチから出ていく方向のパケットのみをキャプチャ
2, inputAndOutput 双方向のトラフィックをキャプチャ

例:

pktcap-uw --uplink vmnic0 --dir 1

--stage オプション

キャプチャインタフェースで処理される(通過する)前と後の、どちらのパケットをキャプチャするのか指定できます。
このオプションはキャプチャインタフェースが--switchport, --vmk, --uplink, --dvfilter, --overlayの場合のみ利用可能です。
--captureと併用することはできません。

前述の--dirと組み合わせて使うことで、--captureと同様のことが可能となります。

説明
0, pre キャプチャインタフェースで処理する前のパケットをキャプチャ
1, post キャプチャインタフェースで処理した後のパケットをキャプチャ

※デフォルト値はヘルプに記載がありませんので不明です

例:

pktcap-uw --uplink vmnic0 --dir 1 --stage 1

フィルタリングオプション

pktcap-uw では、以下のフィルタリングオプションを使用して、特定のパケットのみをキャプチャできます。

オプション 説明
--srcmac <xx:xx:xx:xx:xx:xx> 送信元 MAC アドレスでフィルタリング pktcap-uw --srcmac 00:50:56:ab:cd:ef
--dstmac <xx:xx:xx:xx:xx:xx> 宛先 MAC アドレスでフィルタリング pktcap-uw --dstmac 00:50:56:12:34:56
--mac <xx:xx:xx:xx:xx:xx> 送信元または宛先の MAC アドレスでフィルタリング pktcap-uw --mac 00:50:56:78:90:12
--ethtype 0x<ETHTYPE> Ethernet タイプ(プロトコル)でフィルタリング(16進数) pktcap-uw --ethtype 0x0800(IPv4)
--vlan <VLANID> VLAN ID でフィルタリング(0-4095) pktcap-uw --vlan 100
--srcip <x.x.x.x[/<range>]> 送信元 IP アドレスでフィルタリング(IPv4/IPv6) pktcap-uw --srcip 192.168.1.10
--dstip <x.x.x.x[/<range>]> 宛先 IP アドレスでフィルタリング(IPv4/IPv6) pktcap-uw --dstip 2001:db8::1
--ip <x.x.x.x> 送信元または宛先の IP アドレスでフィルタリング(IPv4/IPv6) pktcap-uw --ip 10.10.10.10
--proto 0x<IPPROTYPE> IP プロトコル番号でフィルタリング(16進数) pktcap-uw --proto 0x06(TCP)
--srcport <SRCPORT> 送信元 TCP ポート番号でフィルタリング pktcap-uw --srcport 443
--dstport <DSTPORT> 宛先 TCP ポート番号でフィルタリング pktcap-uw --dstport 80
--tcpport <PORT> 送信元または宛先 TCP ポート番号でフィルタリング pktcap-uw --tcpport 22
--srcudpport <SRCPORT> 送信元 UDP ポート番号でフィルタリング pktcap-uw --srcudpport 53
--dstudpport <DSTPORT> 宛先 UDP ポート番号でフィルタリング pktcap-uw --dstudpport 123
--udpport <PORT> 送信元または宛先 UDP ポート番号でフィルタリング pktcap-uw --udpport 161
--vni <vni> VXLAN ネットワーク ID(VNI)でフィルタリング(0-16777215) pktcap-uw --vni 5000
--vxlan <vxlan id> VXLAN ID でフィルタリング(非推奨, --vni を使用推奨) pktcap-uw --vxlan 5000
--rcf <EXPR> tcpdump 形式のフィルタ式を適用(詳細は注意点参照) pktcap-uw --rcf "port 8080"
--rcf-tcp-data <EXPR> TCP データ内容(文字列)でフィルタリング pktcap-uw --rcf-tcp-data "HTTP/1.1 200 OK"

--rcf オプションの制約

--rcftcpdump のフィルタ式を適用できますが、以下の制約があります:

  • VLAN ID (vlan キーワード) を --rcf 内で指定できない。
  • ブロードキャスト (ip broadcast キーワード) のフィルタリングが不可。
  • ENS(Enhanced Network Stack)ポートでは使用できない。

例(正しい使い方)

pktcap-uw --vlan 100 --rcf "port 443"

例(間違った使い方)

pktcap-uw --rcf "vlan 100 and port 443"  # VLAN フィルタは不可

--proto の指定方法

  • --proto では IP プロトコル番号16進数 (0x プレフィックス付き) で指定する必要があります。
    • 0x06 → TCP
    • 0x11 → UDP
    • 0x01 → ICMP
    • 0x02 → IGMP

pktcap-uw --proto 0x06  # TCPパケットのみキャプチャ
pktcap-uw --proto 0x01  # ICMPパケットのみキャプチャ

--ethtype の使用方法

  • --ethtype では EtherType(イーサネットフレームのプロトコルタイプ)16進数 (0x プレフィックス付き) で指定する必要があります。
    • 0x0800 → IPv4
    • 0x86DD → IPv6
    • 0x0806 → ARP
    • 0x8100 → VLAN タグ付きフレーム
    • 0x8847 → MPLS(Multi-Protocol Label Switching)

pktcap-uw --ethtype 0x0800  # IPv4 パケットのみキャプチャ
pktcap-uw --ethtype 0x8100  # VLAN タグ付きのパケットのみキャプチャ
pktcap-uw --ethtype 0x86DD  # IPv6 パケットのみキャプチャ
pktcap-uw --ethtype 0x0806  # ARP リクエスト・レスポンスのみキャプチャ

--rcf-tcp-data の活用例

# HTTP トラフィックの中から特定のレスポンスを含むパケットをキャプチャ
pktcap-uw --rcf-tcp-data "HTTP/1.1 200 OK"
# GET リクエストを含むパケットのみをキャプチャ
pktcap-uw --rcf-tcp-data "GET /index.html"

出力・制御オプション

pktcap-uw には、キャプチャしたパケットの保存や出力制御を行うオプションがいくつか用意されています。

オプション 説明
-G <seconds> 指定した秒数ごとに出力ファイルをローテーション(分割保存)する pktcap-uw -o /tmp/capture.pcap -G 60(60秒ごとに新しいファイルを作成)
-C <file_size MB> 指定したサイズ(MB)ごとに出力ファイルをローテーション(分割保存)する pktcap-uw -o /tmp/capture.pcap -C 100(100MBごとに新しいファイルを作成)
-W <file_count> -G-C によるローテーションで保持する最大ファイル数を指定 pktcap-uw -o /tmp/capture.pcap -C 100 -W 5(100MBごとに最大5ファイルまで保存)
-o, --outfile <FILE> キャプチャ結果を指定したファイルに保存(デフォルトはコンソール出力)。-で標準出力に出力。 pktcap-uw -o /tmp/capture.pcap
-P, --ng -o オプションで指定したファイルを pcapng 形式で保存(デフォルト) pktcap-uw -o /tmp/capture.pcapng -P(明示的に pcapng を指定)
--nong -o オプションで指定したファイルを pcap 形式で保存 pktcap-uw -o /tmp/capture.pcap --nong(従来の pcap 形式で保存)
--console キャプチャ結果をコンソールに出力(デフォルト動作) pktcap-uw --console(コンソールにリアルタイム表示)
-c, --count <NUMBER> 指定したパケット数をキャプチャしたら終了 pktcap-uw -c 100(100パケットキャプチャしたら終了)

-G, -C, -W の組み合わせ

-G(時間)、-C(サイズ)、-W(最大ファイル数)は組み合わせて使用可能です。

pktcap-uw -o /tmp/capture.pcap -G 60 -C 50 -W 10

この場合、以下の動作になります:

  • 60秒ごと または 50MB に達したら新しいファイルを作成
  • 10ファイルまで保存し、古いファイルから削除

-o, -P, --nong の関係

  • -o でファイル出力を指定しない場合、デフォルトで コンソール出力 される。
  • -P(pcapng)は デフォルト値 のため、明示的に指定しなくても pcapng で保存される。
  • --nong を指定すると、従来の pcap 形式 で保存可能。

pktcap-uw -o /tmp/capture.pcap --nong

このコマンドは、従来の pcap 形式で /tmp/capture.pcap に保存します。

-c オプションの使い方

-c はキャプチャするパケット数を制限し、指定した数のパケットを取得したら自動的に終了します。

pktcap-uw --uplink vmnic0 -c 500 --view

このコマンドは、vmnic0 のパケットを 500個キャプチャしたら自動終了 します。

tcpdump-uw との組み合わせ

pktcap-uw は強力なパケットキャプチャツールですが、コンソール出力の形式が直観的に分かりにくい ため、より視覚的に分かりやすい tcpdump-uw と組み合わせて解析することが可能です。

デフォルトの pktcap-uw のコンソール出力は、以下のように バイナリデータのダンプ形式 で表示されます。

pktcap-uw --uplink vmnic0

出力例

[root@esxi:~] pktcap-uw --vmk vmk0
The name of the vmk is vmk0.
No server port specifed, select 54459 as the port.
Output the packet info to console.
Local CID 2.
Listen on port 54459.
Main thread: 529453649088.
Recv Thread: 529454708480.
Accept...
Vsock connection from port 1029 cid 2.
Dump Thread: 529454180096.
03:09:47.982158[1] Captured at PortInput point, TSO not enabled, Checksum offloaded and not verified, SourcePort 67108877, length 114.
        Segment[0] ---- 114 bytes:
        0x0000:  0050 56b7 2a26 0050 c0a8 816f 0800 4502
        0x0010:  0064 ab9e 4000 4006 0a6b c0a8 816f c0a8
        0x0020:  81c8 71b2 0cbc d44e efc7 f4e2 84b1 8018
        0x0030:  0202 84df 0000 0101 080a fc18 15c4 670d
        0x0040:  a8b9 4080 0000 0000 0000 0000 0000 0000
        0x0050:  0000 ffff ffff 0033 1f5a 0051 1571 1f5d
        0x0060:  c0b3 0000 0000 0000 0000 0000 0000 0000
        0x0070:  0000
03:09:48.238120[2] Captured at PortInput point, TSO not enabled, Checksum offloaded and not verified, SourcePort 67108877, length 114.
        Segment[0] ---- 114 bytes:
        0x0000:  0050 56b7 2a26 0050 c0a8 816f 0800 4502
        0x0010:  0064 abb2 4000 4006 0a57 c0a8 816f c0a8
        0x0020:  81c8 e4e4 0cbc 1503 b9cb 5132 d64b 8018
        0x0030:  0202 84df 0000 0101 080a 2bca f182 670d
        0x0040:  a9b9 4080 0000 0000 0000 0000 0000 0000
        0x0050:  0000 ffff ffff 000f 136c 0029 07d2 91d1
        0x0060:  95ee 0000 0000 0000 0000 0000 0000 0000
        0x0070:  0000

この形式は 人間が直感的に理解するのが難しい ため、tcpdump-uw で解析しやすくするのが有効です。
pktcap-uw の出力を tcpdump-uw で読み取り可能な形式に変換し、その場で解析できます。

pktcap-uw -o - | tcpdump-uw -r -

説明

  • pktcap-uw -o - → キャプチャデータを標準出力(stdout)へ送信
  • | tcpdump-uw -r -pktcap-uw の出力をパイプで受け取り、人間が読みやすい形式で表示

出力例

16:30:45.123456 IP 192.168.1.10.443 > 192.168.1.20.54730: Flags [P.], seq 0:1234, ack 5678, win 65535
16:30:45.123789 IP 192.168.1.20.54730 > 192.168.1.10.443: Flags [.], ack 1234, win 32768

この形式なら、通信の流れを簡単に把握できる ため、トラブルシューティングが効率的になります。

tcpdump-uw との組み合わせの応用

フィルタを追加

pktcap-uw の フィルタオプションでフィルタすることも可能ですが、tcpdump-uwでフィルタして表示することも可能です。
ただし、pktcap-uwで不要なパケットもキャプチャされてしまうため、負荷や効率の面では劣ります。

特定の IP アドレスだけを解析する場合:

pktcap-uw -o - | tcpdump-uw -r - src 192.168.1.100

特定のポート番号(例: HTTP の 80番)を解析:

pktcap-uw -o - | tcpdump-uw -r - port 80

ファイル保存と解析

パケットを保存して後で解析

pktcap-uw -o /tmp/capture.pcap
tcpdump-uw -r /tmp/capture.pcap

これにより、大量のパケットをリアルタイムに解析するのではなく、キャプチャ後にじっくりと分析 できます。
ファイルサイズが大きくなる可能性があるため、保存先は共有ストレージとすることをお勧めします。

ユースケース

物理NIC vmnic0 の UplinkRcvKernel ポイントでパケットをキャプチャ

pktcap-uw --uplink vmnic0 --capture UplinkRcvKernrl

仮想マシン の vNIC に対応するポートID 100663322 について仮想スイッチポートが受信するパケットをキャプチャ

[root@esxi:~] net-stats -l
PortNum          Type SubType SwitchName       MACAddress         ClientName
2214592521          4       0 vSwitch0         00:50:56:b7:d4:0c  vmnic0
67108877            3       0 vSwitch0         00:50:c0:a8:81:6f  vmk0
2248146959          4       0 vSS1             00:50:56:b7:f3:df  vmnic1
2248146961          4       0 vSS1             00:50:56:b7:70:85  vmnic2
100663322           5       9 vSS1             00:0c:29:c4:4b:ea  virtual_machine1
pktcap-uw --switchport 100663322 --capture PortInput

複数キャプチャポイントでの同時キャプチャ

Packet capture on ESXi using the pktcap-uw tool in ESXi 5.5 and laterAdvanced Usage: trace multiple ports at the same time を一部改変。

キャプチャ開始

# &をつけてバックグラウンドでキャプチャ
cd /vmfs/volumes/datastore1/
pktcap-uw --switchport 67108879 -o esxi.switchport.67108879.pcapng &
pktcap-uw --uplink vmnic2 -o esxi.uplink.vmnic2.pcapng &

キャプチャ終了

# 開かれているファイル(lsof)のうち、pktcap-uwが開いているファイルについて、pktcap-uwのプロセスをkill
kill $(lsof |grep pktcap-uw |awk '{print $1}'| sort -u)

# 確認
lsof |grep pktcap-uw |awk '{print $1}'| sort -u

pktcap-uwとtcpdump-uwを組み合わせてリアルタイムで表示

pktcap-uw --uplink vmnic2 -o - --ip 192.168.1.100 | tcpdump-uw -r - -en

# tcpdumpのオプション
  -e: L2情報(MACアドレス)を表示
  -n: 表示されるIPアドレスの名前解決OFF、ポート番号のサービス名変換OFF(-n と -nnで違いがないように見える)

pktcap-uw の注意点

  • ESXi の管理インターフェース(vmk0 など)への影響
    • 過度なパケットキャプチャは ESXi ホストのパフォーマンスに影響を与える可能性があります。
  • vSphere Distributed Switch(VDS)では使用制限あり
    • pktcap-uw は標準仮想スイッチ(VSS)に対しては有効ですが、VDS では一部機能が制限される場合があります。

まとめ

pktcap-uw は、ESXi ホスト上のネットワークトラブルシューティングに非常に有用なツールです。本記事で紹介したオプションを活用し、トラフィックの分析や問題の特定を効率的に行いましょう。

pktcap-uwのヘルプ(すべて)

[root@esxi:~] pktcap-uw -h
Packet Capture and Trace command usage:
        == Create session to capture packets ==
         pktcap-uw [--capture <capture point>[,capture point]...
              | [--dir <0|input|1|output|2|inputAndOutput>]
                [--stage <0|pre|1|post>] [-K|--kernelside]]
            [--switchport <PortID> | --vmk <vmknic> | --uplink <vmnic> |
               --fcport [fastpathSwitchID.]<PortID> |
               --dvfilter <filter name> |
               --overlay <overlay class name>]
            [--lifID <lif id for vdr>]
            [-f [module name.]<function name>[:offset]]
            [-AFhP] [-p|--port <Socket PORT>]
            [-c|--count <number>] [-s|--snapLen <length>]
            [-G <seconds>]
            [-C <file_size>]
            [-W <file_count>]
            [-o|--outfile <FILE>] [--console]
            [Flow filter options]

        == Create session to trace packets path ==

     it can trace up to 32 level from pkt allocation and record up to 12 IOChain or portID
         pktcap-uw --trace
            [-AFhP] [-p|--port <Socket PORT>]
            [-c|--count <number>] [-s|--snapLen <length>]
            [-G <seconds>]
            [-C <file_size>]
            [-W <file_count>]
            [-o|--outfile <FILE>] [--console]
            [Flow filter options]

The command options:
        -p, --port <Socket PORT>
                Specify the port number of vsocket server.
        -G, <seconds>
                Specify the seconds to rotate the outfile.
        -C, <file_size MB>
        -W, <file_count>
                Specify the maximum number of output files
        -o, --outfile <FILE>
                Specify the file name to dump the packets. If unset,
                output to console by default. If '-', then stdout is used.
        -P, --ng   (only working with '-o')
                Using the pcapng format to dump into the file.
                This option is true by default and no longer required.
        --nong     (only working with '-o')
                Using the pcap format to dump into the file.
        --console  (by default if without '-o')
                Output the captured packet info to console.
        -s, --snaplen <length>
                Only capture the first <length> packet buffer.
                The minimum snap length is 24 bytes. However, setting
                snaplen to 0 will capture entire packet.
        -c, --count <NUMBER>
                How many count packets to capture.
        -h
                Print this help.
        -A, --availpoints
                List all capture points supported.
        -F
                List all dynamic capture point functions supported.
        -4
                Capture only IPv4 Packet.
        -6
                Capture only IPv6 Packet.
        --capture <capture point>
                Specify the capture point. Use '-A' to get the list.
                If not specified, will select the capture point
                by --dir and --stage setting

The switch port options:
(for Port, Uplink and Etherswitch related capture points)
        --switchport <port ID>
                Specify the switch port by ID
        --fcport [fastpathSwitchID.]<port ID>
                Specify the fastpath port by ID
        --lifID <lif ID>
                Specify the logical interface id of VDR port
        --vmk <vmk NIC>
                Specify the switch port by vmk NIC
        --uplink <vmnic>
                Specify the switch port by vmnic

The capture point auto selection options without --capture:
        --dir <0|input|1|output|2|inputAndOutput>  (for --switchport, --vmk, --uplink, --fcport)
                The direction of flow, with respect to the vswitch:
                0- Input: to vswitch (Default), 1- Output: from vswitch, 2- Input and Output
        --stage <0|pre|1|post>  (for --switchport, --vmk, --uplink, --dvfilter, --overlay)
                The stage at which to capture: 0- Pre: before, 1- Post: after
        --kernelside (for --uplink)
                The capture point is in kernel instead of in driver.
                This option is always true and no longer required.

The capture point options
        -f [module name.]<function name>[[:offset]|[:line number]]
                The function name and the offset/line number in the function.
                The default module name is 'vmkernel'.
                The default offset into the function is 0 (the beginning of the function).
                The line number must start with letter 'L' if it's file related
                line number, or 'F' for function related line number.
                (for 'Dynamic', 'IOChain' and 'TcpipDispatch' capture points)
        --dvfilter <filter name>
                Specify the dvfilter name for DVFilter related points
        --overlay <overlay class name>
                Specify the overlay class name for 'Overlay' capture point
        --pkt-list-param-idx <num>
                Specify the pktList index in function's parameter table, starting from 1
        --pkt-param-idx <num>
                Specify the pkt index in function's parameter table, starting from 1
        --port-id-param-idx <num>
                Specify the portId index in function's parameter table, starting from 1
                --switchport option is required to filter packets by port ID
        --mbuf-param-idx <num>
                Specify the mbuf index in function's parameter table, starting from 1
        --mbuf-array-param-idx <num>
                Specify the mbuf array index in function's parameter table, starting from 1
        --num-mbufs-param-idx <num>
                Specify the mbuf array size index in function's parameter table, starting from 1
        --vprobe-pkt-list <string>
                If function offset is specified in '-f' argument, this is the vprobe
                expression to access the pointer to pktList, e.g. "rax+18"
                If file/function relative line number is specified in '-f' argument,
                this is the C expression to access pktList, all variables must start
                with '$' sign, e.g. "$pktListPtr"
        --vprobe-pkt <string>
                Vprobe/C expression to access the pointer to pkt, e.g. "rax+18"
                or "$pkt", see argument --vprobe-pkt-list for details.
        --vprobe-port-id <string>
                Vprobe/C expression to access switch port id, e.g. "rax+18"
                or "$portID", see argument --vprobe-pkt-list for details.
        --vprobe-mbuf <string>
                Vprobe expression to access mbuf, e.g. "rax+18"
                or "$mbufPtr", see argument --vprobe-pkt-list for details.
        --vprobe-mbuf-array <string>
                Vprobe expression to access mbuf array, e.g. "rax+18"
                or "$mbufArray", see argument --vprobe-pkt-list for details.
        --vprobe-num-mbufs <string>
                Vprobe expression to access number of mbufs in the array, e.g. "rax+18"
                or "$numMbufs", see argument --vprobe-pkt-list for details.
        --vprobe-symdbs <directory>
                The parent directory of the symbol database.
        --no-vprobe
                Don't emit vprobe script to assist packet capture, the capture
                function itself has dynamic capture point inserted
        --compile-only
                Print the vprobe script to standard output and exit
        --script <FILE>
                Start vprobe with the input .emt file to filter packets
        -e, --experimental
                Call experimental vProbe builtins
        --clone-mbuf
                Force to clone mbuf for capturing.
                The original mbuf can be modified after capture, the dumped data
                may be different from that seen at the capture point.

Flow filter options, it will be applied when set:
        --srcmac <xx:xx:xx:xx:xx>
                The Ethernet source MAC address.
        --dstmac <xx:xx:xx:xx:xx>
                The Ethernet destination MAC address.
        --mac <xx:xx:xx:xx:xx>
                The Ethernet MAC address(src or dst).
        --ethtype 0x<ETHTYPE>
                The Ethernet type. HEX format.
        --vlan <VLANID>
                The Ethernet VLAN ID, one of 0-4095.
        --srcip <x.x.x.x[/<range>]>
                The source IPv4/IPv6 address.
        --dstip <x.x.x.x[/<range>]>
                The destination IPv4/IPv6 address.
        --ip <x.x.x.x>
                The IPv4/IPv6 address(src or dst).
        --proto 0x<IPPROTYPE>
                The IPv4/IPv6 protocol.
        --srcport <SRCPORT>
                The TCP source port.
        --dstport <DSTPORT>
                The TCP destination port.
        --tcpport <PORT>
                The TCP port(src or dst).
        --srcudpport <SRCPORT>
                The UDP source port.
        --dstudpport <DSTPORT>
                The UDP destination port.
        --udpport <PORT>
                The UDP port(src or dst).
        --vni <vni>
                The VNI of flow, one of 0-16777215.
        --vxlan <vxlan id>
                The vxlan id of flow. This option is deprecated, use 'vni' instead.
        --rcf <EXPR>
                The tcpdump filter expression. You better not use this options
                together with legacy pktcap-uw 5-tuples filter rules. You can use
                them separately. For vni and vlan options of legacy pktcap-uw, you
                can use them as before. For rcf option, please notice below three limits:
                        1) Do not set vlan in rcf option;
                        2) Do not set ip broadcast in rcf option;
                        3) Do not use rcf on ENS ports.
        --rcf-tcp-data <EXPR>
                Packet data content, such as, "GET", "GET /index.html"
                or "HTTP/1.0 200 OK" for HTTP packet.

キャプチャポイント(--capture)で指定可能な値のリスト

[root@esxi:~] pktcap-uw -A
Supported capture points:
        1: Dynamic -- The dynamic inserted runtime capture point.
        2: UplinkRcv -- Function to Rx packets from uplink at driver side (obsoleted).
        3: UplinkSnd -- Function to Tx packets on uplink at driver side (obsoleted).
        4: VnicTx -- Function in vnic backend to Tx packets from guest
        5: VnicRx -- Function in vnic backend post Rx packets delivery to Guest
        6: PortInput -- Port_Input function of any given port
        7: IOChain -- The virtual switch port iochain capture point.
        8: EtherswitchDispatch -- Function that receives packets for switch
        9: EtherswitchOutput -- Function that sends out packets, from switch
        10: PortOutput -- Port_Output function of any given port
        11: TcpipDispatch -- Tcpip Dispatch function
        12: PreDVFilter -- Before DVFIlter capture point
        13: PostDVFilter -- After DVFilter capture point
        14: Drop -- Dropped Packets capture point
        15: VdrRxLeaf -- The Leaf Rx IOChain for VDR
        16: VdrTxLeaf -- The Leaf Tx IOChain for VDR
        17: VdrRxTerminal -- Terminal Rx IOChain for VDR
        18: VdrTxTerminal -- Terminal Tx IOChain for VDR
        19: PktFree -- Packets freeing point
        20: TcpipRx -- TcpipRX function
        21: TcpipTx -- TcpipTX function
        22: UplinkRcvKernel -- The function that receives packets from uplink dev at kernel side
        23: UplinkSndKernel -- Function to Tx packets on uplink at kernel side
        24: PreOverlayInput -- Before overlay input callback
        25: PostOverlayInput -- After overlay input callback
        26: PreOverlayOutput -- Before overlay output callback
        27: PostOverlayOutput -- After overlay output callback
        28: EtherswitchFwdCheckPolicy -- In virtual switch's forward policy check
        29: VnicRxEntry -- Function in vmxnet3 vnic backend entry point to Rx packets to Guest
        30: RepRx -- The function that receives packets from representor
        31: RepTx -- Function to Tx packets to representor
        32: FPORx -- Hardware source port input
        33: FPOTx -- Hardware destination port output
        34: ENSInput -- Read mbuf from an ENS port
        35: ENSOutput -- Write mbuf to an ENS port
        36: EnsPortReaderRx -- Read mbufs from an ENS port
        37: EnsPortWriterTx -- Write mbufs to an ENS port
        38: EnsPortWriterQueue -- Queue mbufs to an ENS port
        39: EnsPortWriterFlush -- Flush mbufs on an ENS port
        40: EnsPortFPORx -- Read offloaded mbuf from an ENS port
        41: EnsPortFPOTx -- Write offloaded mbuf to an ENS port

キャプチャポイント(--capture)で指定可能な値の一部の図示

https://knowledge.broadcom.com/external/article/341568 を参考に作成)

pktcap-uw-capture-points.png

リファレンス

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?