LoginSignup
2
3

More than 5 years have passed since last update.

linux / MacOSX > udp通信(ポート6000)へ/からの通信をキャプチャする > tcpdump -n udp portrange 6000

Last updated at Posted at 2015-09-04
動作確認
CentOS 6.5 (32bit)

ポート6000のUDP通信をキャプチャしたい。

  • 自分のIP: 192.168.10.8
    • キャプチャをする側
  • 相手のIP: 192.168.10.6
    • echo server起動中

手順

  1. 192.168.10.8の一つのTerminalでsuにてrootユーザになる
  2. 次のコマンドを実行しておく tcpdump -n udp portrange 6000
  3. 別のTerminalで以下のコマンドを実行する
$ echo "TEST2B" | nc -u 192.168.10.6 6000
TEST2B

tcpdumpを実行していた端末には以下のような情報が表示される。

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth0, link-type EN10MB (Ethernet), capture size 65535 bytes
19:54:02.616539 IP 192.168.10.8.33668 > 192.168.10.6.6000: UDP, length 7
19:54:02.624092 IP 192.168.10.6.6000 > 192.168.10.8.33668: UDP, length 7

UnityでのUDP通信が失敗していたのはポート番号がらみのようだ。

MacOS X > Terminal

MacOS X 10.8.5のターミナルにて su してから tcpdumpでキャプチャしたところ、192.168.10.6 への通信はキャプチャできているが、192.168.10.6からの通信がキャプチャできていない。でも実際には192.168.10.6からの応答は受けている。

tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on en0, link-type EN10MB (Ethernet), capture size 65535 bytes
20:15:20.014699 IP 192.168.10.3.57414 > 192.168.10.6.6000: UDP, length 5

このlinuxとMacOS Xの振る舞いの違いは今のところよくわからない。

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