Skip to content

Netscaler mpx packet capture

Path は /var/nstrace オプションは大量にあるが、そのオプションが必須で必要なことは少ない 大体 ↓ ぐらいで足りる。 filter 部分は必要に応じて書き換える。独自のフィルタ式なので書き方注意。 -link ENABLE はリクエストのバックポストもキャプチャしてくれるので便利。 インライン構成の VIP へのリクエストをキャプチャする場合、配下サーバとの通信も一緒に取ってくれる。 stop nstrace は忘れないように。

start nstrace -size 0 -filesize 1024 -traceBuffers 65535 -link ENABLED -filter "CONNECTION.IP.EQ(210.171.63.8)"
stop nstrace

取ったキャプチャは、キャプチャを開始したタイムスタンプのディレクトリの中にある。

14:25 nsroot@mpx-Primary> start nstrace -size 0 -filesize 1024 -traceBuffers 65535 -link ENABLED -filter "CONNECTION.IP.EQ(192.168.0.2)"
Done
14:25 nsroot@mpx-Primary> stop nstrace
Done
14:28 nsroot@mpx-Primary> shell
Copyright (c) 1992-2013 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
root@mpx01# ls -la /var/nstrace/
total 24
drwxr-xr-x 12 root wheel 512 Oct 22 14:25 .
drwxr-xr-x 41 root wheel 1024 Oct 22 12:54 ..
drwxr-xr-x 2 root wheel 512 Oct 22 14:25 22Oct2020_14_20_11
drwxr-xr-x 2 root wheel 512 Oct 22 14:28 22Oct2020_14_25_35
root@mpx01# ls -la /var/nstrace/22Oct2020_14_25_35
total 34212
drwxr-xr-x 2 root wheel 512 Oct 22 14:28 .
drwxr-xr-x 12 root wheel 512 Oct 22 14:25 ..
-rw-r--r-- 1 root wheel 34979840 Oct 22 14:28 nstrace1.cap # 多いと複数ファイルに分割される

tcpdump をラップした nstcpdump.sh というものもある。使い方は tcpdump と同じ。 メーカ曰く、 nstcpdump.sh は nstrace よりも負荷がかかるため、稼働環境では nstrace を推奨とのこと。

root@mpx01# nstcpdump.sh -h
nstcpdump.sh: utility to view/save/sniff LIVE packet capture on NETSCALER box
tcpdump version 4.9.1
libpcap version 1.0.0
OpenSSL 1.0.2r-fips 26 Feb 2019
Usage: tcpdump [-aAbdDefhHIKlLnNOpqStuUvxX#] [ -B size ] [ -c count ]
[ -C file_size ] [ -E algo:secret ] [ -F file ] [ -G seconds ]
[ -i interface ] [ -M secret ] [ --number ]
[ -Q in|out|inout ]
[ -r file ] [ -s snaplen ] [ -T type ] [ --version ] [ -V file ]
[ -w file ] [ -W filecount ] [ -y datalinktype ] [ -z postrotate-command ]
[ -Z user ] [ expression ]
NOTE: tcpdump options -i, -r and -F are NOT SUPPORTED by this utility