LoginSignup
0

More than 5 years have passed since last update.

tcpdumpでICMPv6のtypeを指定する方法

Last updated at Posted at 2018-11-26

Typeの指定

ICMPv6
sudo tcpdump -i eth0 "ip6[40] == 'type number' (or ...) && icmp6"

IPv4までのICMPパケットは

ICMP
sudo tcpdump -i eth0 "icmp[0] == 'type' "

であった。

ちなみに "[ ]" はヘッダのバイトオフセットを指定する。ip6[40]はIPv6ヘッダの40バイト目(ICMPv6 type)の値だ。

ファイルに保存+標準出力

hoge.pcapというファイルに保存する。

write_and_stdout
sudo tcmpdump -w - | tee hoge.pcap | tcpdump -r -

-w - で標準出力にpcapバイナリを吐き出す
-r - で標準入力から読み込む(ここではpcapバイナリを読んでいる)

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