LoginSignup
3
4

More than 5 years have passed since last update.

お手軽netflow

Last updated at Posted at 2016-05-25

インストール

$ sudo apt-get install nfdump -y
最新はこっち https://github.com/phaag/nfdump

使い方

Capture Start

$ nfcapd -w -t 3600 -D -l ~/netflow -p 5000

w:ファイルに書き出す
t:ファイルに書き出す間隔 ※毎時0分からの間隔
D:デーモンモードで起動
l:書き出すディレクトリ
p:受信ポート ※環境に合わせて変更

Dump

リスト表示

$ nfdump -r nfcapd.current

raw表示

$ nfdump -o raw -r nfcapd.current

リスト表示をSourceIPでソート

$ nfdump -r nfcapd.current -n 20 -s srcip/bytes

IP Rangeでフィルタ

$ nfdump -r nfcapd.current 'net 192.168.0.0/16'

特定ASとの通信をリスト

$ nfdump -r nfcapd.current 'as hoge' -n 20 -s srcip

Capture Stop

$ ps aux | grep nfcapd
$ kill pid

rotate

crontab -e
0 0 * * * find /home/hoge/netflow/ -name "nfcapd.*" -mtime +3 -delete

参考資料

http://enog.jp/wp-content/uploads/2010/08/enog4-takasima-0827.pdf
http://knqyf263.hatenablog.com/entry/2014/02/27/005353

3
4
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
3
4