目次

ホーム#ツール

Linux tcpdumpコマンドでパケットキャプチャ



tcpdumpコマンド例

# tcpdump -i eth1   <-  eth0 is default interface.
# tcpdump -i any

# tcpdump -nn  udp port 53 -i any  <- Check DNS
# tcpdump -nn  port 53 -i any  <- Check DNS

# tcpdump -nn  port 2049  -i any <- Check NFS

# tcpdump -nn 'port 80 or port 8080'

# tcpdump -nn  not port 22
# tcpdump -nn  not arp and not port 22 # 「ARPではなく、かつ、ポート22でもない」パケットを表示する
# tcpdump -nn  not arp and not port 123 and not port 22
# tcpdump -nn  not host 192.168.100.10
-n
  ホストアドレスを名前に変換しません。
-nn
  ホストアドレスに加えてポート番号等も名前に変換しません。
# tcpdump -D  # 利用できるNICの一覧




tcpdumpでパケットの中身を ASCII で表示

-A ASCII文字で表示を行う。

http通信の内容をキャプチャし表示

# tcpdump -s0 -A dst port 80

-s0 パケット数の制限をなくす


FTP通信の内容をキャプチャし表示

# tcpdump -s0 -A host 192.168.0.10 and \(port 20 or port 21\)


telnet通信の内容をキャプチャし表示

# tcpdump -s0 -A host 192.168.0.10 and port 23




tcpdumpの結果をWiresharkなどで分析するための取得方法

# tcpdump -s0 -A -n host 192.168.0.10 -w test.pcap
# tcpdump -s0 -A -n host 192.168.0.10 and \(port 80 or port 443 \) -w test.pcap

-wで保存したファイルを読み込む

# tcpdump -r test.cap  host 192.168.0.10





ホーム#ツール