# tcpdump -i tun0 -l | grep -i vxlan
tcpdumpでvlanタグやMACアドレスを表示する
-eオプションを付与する。
例
tcpdump -i eth0 -e icmp下図の赤線部のようにEthernet headerの情報が表示される。この中で四角で囲った部分がvlanタグ。
参考
Ethernetパケットの構造については、以下を参照How to create a network packet capture file by tcpdump, which can be available for Wireshark
Example: File name (blue characters) should be changed properly.
-s 0: Makes the maximum packet size unlimited.
-i: Network device used for the capture.
-w: File name captured packets will be stored in.
Japanese version is here
# tcpdump -n -s 0 -i eth0 -w dump.dat
-n: Shows the raw IP address (doesn't resolve the name with DNS).-s 0: Makes the maximum packet size unlimited.
-i: Network device used for the capture.
-w: File name captured packets will be stored in.
Japanese version is here
Wiresharkで解析できるキャプチャファイルを、tcpdumpで作成する
例
tcpdump -n -s 0 -i eth0 -w dump.dat
青字不部分は適宜変更
オプションの説明
| オプション | 説明 |
|---|---|
| -n | IPアドレスのまま出力する(DNSを引かない) |
| -s 0 | キャプチャするパケットサイズの上限を無制限 |
| -i | キャプチャ対象のネットワークデバイスを指定 |
| -w | 作成するキャプチャファイル名を指定 |
tcpdumpの使い方
interfaceを指定する
-iオプションを指定する例
# tcpdump -i eth0
port番号を指定する
'port ポート番号'を指定する例
# tcpdump -i eth0 port 80
パケットの内容をダンプする
-Xオプションを指定する例
# tcpdump -i lo port 35357 -X
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on lo, link-type EN10MB (Ethernet), capture size 65535 bytes
13:47:55.102252 IP ika.52727 > ika.35357: Flags [S], seq 2674919811, win 32792, options [mss 16396,sackOK,TS val 27498856 ecr 0,nop,wscale 7], length 0
0x0000: 4500 003c 90eb 4000 4006 286c c0a8 000a E..<..@.@.(l....
0x0010: c0a8 000a cdf7 8a1d 9f70 0983 0000 0000 .........p......
0x0020: a002 8018 7016 0000 0204 400c 0402 080a ....p.....@.....
0x0030: 01a3 9968 0000 0000 0103 0307 ...h........
出力をパイプでgrepへ渡したり、ファイルへリダイレクトする場合
-lオプションをつけます。これがない場合、一定サイズのデータがtcpdumpから出力されるまで、grepやファイルへデータが送られなくなり、実際にデータが来るまで時間差が生じます。例
# tcpdump -i eth0 port 80 -l | grep GET
登録:
投稿 (Atom)