Go to main content
Oracle® Solaris 11.3 での TCP/IP ネットワーク、IPMP、および IP トンネルの管理

印刷ビューの終了

更新: 2016 年 11 月
 
 

ipstat および tcpstat コマンドを使用したネットワークトラフィックの監視

このリリースでは、サーバー上でさまざまなタイプのネットワークトラフィックを監視する 2 つのコマンド ipstattcpstat が導入されています。

ipstat コマンドは、コマンド構文で指定された選択した出力モードとソート順序に基づいて、サーバー上で IP トラフィックに関する統計情報を収集および報告するために使用します。このコマンドを使用すると、送信元、宛先、上位層プロトコル、およびインタフェースごとに集計された IP 層のネットワークトラフィックを監視できます。このコマンドは、特定のサーバーとそのほかのサーバーの間のトラフィック量を監視する必要があるときに使用します。

tcpstat コマンドは、コマンド構文で指定された選択した出力モードとソート順序に基づいて、サーバー上で TCP および UDP トラフィックに関する統計情報を収集および報告するために使用します。このコマンドを使用すると、トランスポート層、具体的には TCP と UDP のネットワークトラフィックを監視できます。送信元および宛先 IP アドレスに加え、送信元および宛先の TCP または UDP ポート、トラフィックを送受信しているプロセスの PID、プロセスが動作しているゾーンの名前を監視できます。

    次に、tcpstat コマンドの使い方の例をいくつか挙げます。

  • サーバー上でもっともトラフィック量の多い TCP および UDP の送信元を特定する。

  • 特定のプロセスによって生成されているトラフィックを調査する。

  • 特定のゾーンで生成されているトラフィックを調査する。

  • ローカルポートにバインドされているプロセスを確認する。


注 -  上記の使い方がすべてではありません。tcpstat コマンドにはほかにも使い方があります。詳細は、tcpstat(1M)のマニュアルページを参照してください。

    ipstat および tcpstat コマンドを使用するには、次のいずれかの権限が必要です。

  • root 役割になります。

  • dtrace_kernel 権限が明示的に割り当てられていること

  • Network Management または Network Observability 権利プロファイルが割り当てられていること

次の例に、この 2 つのコマンドを使用してネットワークトラフィックを監視するさまざまな方法を示します。詳細は、tcpstat(1M)およびipstat(1M)のマニュアルページを参照してください。

次の例は、–c オプションを指定して実行したときの ipstat コマンドからの出力を示しています。–c オプションを使用すると、前のレポートを上書きすることなく、前のレポート以降の新しいレポートを出力できます。この例の数字 3 は、データを表示する間隔を指定します (これは、ipstat 3 としてコマンドを起動した場合と同じです)。

# ipstat -c 3
SOURCE                     DEST                       PROTO    INT        BYTES
zucchini                   antares                    TCP      net0       72.0
zucchini                   antares                    SCTP     net0       64.0
antares                    zucchini                   SCTP     net0       56.0
amadeus.foo.example.com    10.6.54.255                UDP      net0       40.0
antares                    zucchini                   TCP      net0       40.0
zucchini                   antares                    UDP      net0       16.0
antares                    zucchini                   UDP      net0       16.0
Total: bytes in: 192.0  bytes out: 112.0 

比較のために、次の例に、tcpstat コマンドを –c オプション付きで使用した場合の出力を示します。

# tcpstat -c 3
ZONE         PID PROTO  SADDR             SPORT DADDR             DPORT   BYTES
global    100680 UDP    antares           62763 agamemnon          1023   76.0
global    100680 UDP    antares             775 agamemnon          1023   38.0
global    100680 UDP    antares             776 agamemnon          1023   37.0
global    100680 UDP    agamemnon          1023 antares           62763   26.0
global    104289 UDP    zucchini          48655 antares            6767   16.0
global    104289 UDP    clytemnestra      51823 antares            6767   16.0
global    104289 UDP    antares            6767 zucchini          48655   16.0
global    104289 UDP    antares            6767 clytemnestra      51823   16.0
global    100680 UDP    agamemnon          1023 antares             776   13.0
global    100680 UDP    agamemnon          1023 antares             775   13.0
global    104288 TCP    zucchini          33547 antares            6868    8.0
global    104288 TCP    clytemnestra      49601 antares            6868    8.0
global    104288 TCP    antares            6868 zucchini          33547    8.0
global    104288 TCP    antares            6868 clytemnestra      49601    8.0
Total: bytes in: 101.0  bytes out: 200.0 

さらに次の例は、ipstat および tcpstat コマンドを使用して、ネットワーク上のトラフィックを監視するほかの方法を示しています。

使用例 13  ipstat コマンドを使用した 5 つのもっともアクティブな IP トラフィックフローの監視

次の例は、もっともアクティブな 5 つの IP トラフィックフローを報告しています。–l nlines オプションには、報告ごとの出力データ行数を指定します。

# ipstat -l 5
SOURCE                     DEST                       PROTO    IFNAME     BYTES
charybdis.foo.example.com  achilles.exampl            UDP      net0        6.6K
eratosthenes.example.com   aeneas.example.c           TCP      tun0        6.1K
achilles.exampl            charybdis.foo.example.com  UDP      net0      964.0
aeneas.example.c           eratosthenes.example.com   TCP      tun0      563.0
odysseus.example.          255.255.255.255            UDP      net0       66.0
Total: bytes in: 12.6K bytes out:  2.2K
使用例 14  ipstat コマンドを使用したタイムスタンプの表示

次の例は、最上位の IP トラフィックを標準日付書式 (–d d) のタイムスタンプ付きで報告しています。タイムスタンプが、秒または Unix 時間 (–d u) で出力されるように指定できます。間隔は 10 秒に設定されます。

# ipstat -d d -c 10
Monday, March 26, 2012 08:34:07 PM EDT
SOURCE                     DEST                       PROTO    IFNAME     BYTES
charybdis.foo.example.com  achilles.exampl            UDP      net0       15.1K
eratosthenes.example.com   aeneas.example.c           TCP      tun0       13.9K
achilles.exampl            charybdis.foo.example.com  UDP      net0        2.4K
aeneas.example.c           eratosthenes.example.com   TCP      tun0        1.5K
odysseus.example.          255.255.255.255            UDP      net0       66.0
cassiopeia.foo.example.com aeneas.example.c           TCP      tun0       29.0
aeneas.example.c           cassiopeia.foo.example.com TCP      tun0       20.0
Total: bytes in: 29.1K bytes out:  3.8K
使用例 15  tcpstat コマンドを使用した 5 つのもっともアクティブなトラフィックフローの監視

次の例は、サーバーでもっともアクティブな 5 つの TCP トラフィックフローを報告しています。

# tcpstat -l 5
ZONE            PID PROTO  SADDR            SPORT DADDR            DPORT   BYTES
global        28919 TCP    achilles.exampl  65398 aristotle.exampl   443   33.0
zone1          6940 TCP    ajax.example.com  6868 achilles.exampl  61318    8.0
zone1          6940 TCP    achilles.exampl  61318 ajax.example.com  6868    8.0
global         8350 TCP    ajax.example.com  6868 achilles.exampl  61318    8.0
global         8350 TCP    achilles.exampl  61318 ajax.example.com  6868    8.0
Total: bytes in: 16.0  bytes out: 49.0 
使用例 16  tcpstat コマンドを使用したタイムスタンプ情報の表示

次の例は、tcpstat コマンドを使用して、サーバー上の TCP ネットワークトラフィックのタイムスタンプ情報を標準の日付書式で表示しています。

# tcpstat -d d -c 10
Saturday, March 31, 2012 07:48:05 AM EDT
ZONE            PID PROTO  SADDR            SPORT DADDR            DPORT   BYTES
global         2372 TCP    penelope.example 58094 polyphemus.examp    80   37.0
zone1          6940 TCP    ajax.example.com  6868 achilles.exampl  61318    8.0
zone1          6940 TCP    achilles.exampl  61318 ajax.example.com  6868    8.0
global         8350 TCP    ajax.example.com  6868 achilles.exampl  61318    8.0
global         8350 TCP    achilles.exampl  61318 ajax.example.com  6868    8.0
Total: bytes in: 16.0  bytes out: 53.0