1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

tcpdumpしてみました

Posted at

tcpdumpとは

ネットワークの通信をキャプチャするもの
今回はlinux(CentOS7)で実行します。

使い方

  • すべてのインタフェースの通信をキャプチャ

コマンドは tcpdump のみ

$ tcpdump

よく使うオプション

  • インターフェースを指定(-i)

-i インタフェース名 を使用

$ tcpdump -i インタフェース名

使用例
$ tcpdump -i enp0s8
  • キャプチャ結果を出力(-w)

-w ファイル名 を使用

$ tcpdump -w ファイル名

使用例
$ tcpdump -w tcpdump.log
  • キャプチャデータをASCIIで表示(-A)

-A を使用

$ tcpdump -A
  • 時間を表示しない(-t)
$ tcpdump -t

フィルタ

  • IPアドレスを指定(送信元・送信先関わらず)
$ tcpdump host 送信元IPアドレス

使用例
$ tcpdump host 192.168.1.1
  • ポート指定
$ tcpdump port ポート番号

使用例
$ tcpdump port 80
  • 送信元IPアドレスを指定
$ tcpdump src host 送信元IPアドレス

使用例
$ tcpdump src host 192.168.1.1
  • 送信元ポート指定
$ tcpdump src port ポート番号

使用例
$ tcpdump src port 80
  • 送信先IPアドレスを指定
$ tcpdump dst host 送信元IPアドレス

使用例
$ tcpdump dst host 192.168.1.1
  • 送信先ポート指定
$ tcpdump dst port ポート番号

使用例
$ tcpdump dst port 80
  • 複数組み合わせる
IP:192.168.1.1, port:80 をキャプチャ
$ tcpdump host IPアドレス port ポート番号

使用例
$ tcpdump host 192.168.1.1 port 80

見方

  • tcpdumpコマンドで見る
$ tcpdump -r ファイル名

使用例
tcpdump -r tcpdump.log

参考

1
0
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?