インフラ系SEの技術メモ

雑なエンジニアが低信頼性のメモを書いています。参考程度にとどめてください。

(Linux)tcpdumpコマンドはデフォルトでUDPも取ってくれる

意外と大事な情報

tcpdumpコマンドはオプションでudpやicmpがありますが、指定しなければ全て取ってくれます。

WebRTCの調査をしていた際にキャプチャをしかけると

Frame 281: 160 bytes on wire (1280 bits), 160 bytes captured (1280 bits)
Linux cooked capture v1
Packet type: Unicast to us (0)
Link-layer address type: Ethernet (1)
Link-layer address length: 6
Source: XX
Unused: 0000
Protocol: IPv4 (0x0800)
Internet Protocol Version 4, Src: XX
0100 .... = Version: 4
.... 0101 = Header Length: 20 bytes (5)
Differentiated Services Field: 0x00 (DSCP: CS0, ECN: Not-ECT)
Total Length: 144
Identification: 0xcfed (XX)
Flags: 0x40, Don't fragment
...0 0000 0000 0000 = Fragment Offset: 0
Time to Live: 64
Protocol: UDP (17)
...

こんな感じでバッチリUDPを捕捉。

つまり、デフォルトで取ったキャプチャにUDPが流れていないのであれば、流れていないってことですね。