tcpdumpのフィルターのまとめ

tcpdumpの基本的な使用方法はこちら

## 名前解決をしない
tcpdump -n src 192.168.100.1 and dst  192.168.100.2
## インターフェイスを指定する
tcpdump -i eth1
## 特定のホストを除外する
tcpdump -i eth0 not host 192.168.100.5
## 複数ホストを除外する
tcpdump -i eth0 not host 192.168.100.5 and not host 192.168.100.6
## ネットワークを指定する
tcpdump net 192.168.100.0/24
## ネットワークを除外する
tcpdump not net 192.168.100.0/24
## 特定ポートを指定する
tcpdump -i eth0 not host 192.168.100.5 and not host 192.168.100.6 and port 80
tcpdump port ssh
## 特定ポートを除外する
tcpdump -i eth0 not host 192.168.100.5 and not host 192.168.100.6 and not port 80
## 特定のプロトコルを指定する
## ※ポートではありません。プロトコルを指定します
## ether
## ip
## ip6
## arp
## rarp
## icmp
## icmp6
## tcp
## udp
tcpdump -i eth0 arp
tcpdump icmp
## 特定のプロトコルを除外する
tcpdump -i eth0 not host 192.168.100.5 and not host 192.168.100.6 and not port 80 and not arp
## 送信元アドレスを指定する
tcpdump src  192.168.100.2
## 送信先アドレスを指定する
tcpdump dst  192.168.100.2
## 条件の否定
tcpdump not arp
tcpdump not host 192.168.100.5
## 複数条件(or)
tcpdump dst host 192.168.100.1 or src host 192.168.100.1
## 複数条件(and)
tcpdump not host 192.168.100.5 and net 192.168.100.0/24
## カッコを使用する場合
## 注意 \でエスケープする
tcpdump host \(192.168.100.1 or 192.168.100.2\) and not arp
tcpdump -n -i eth2 not host \(192.168.100.5 or 192.168.100.6 or 192.168.100.11 or  192.168.100.22 \) and not net 192.168.200.0/24
タイトルとURLをコピーしました