如何读取IP/TCP数据

问题描述 投票:0回答:1

我在这里有点困惑

偏移

0000 00 12 17 c1 fd f8 00 0d 87 cf 71 9a 08 00 45 00

0010 00 30 aa b6 40 00 80 06 c3 99 c0 a8 00 c0 d4 3a

0020 f6 d4 05 0b 01 bb 50 06 19 e0 00 00 00 00 70 02

0030 ff ff 85 FB 00 00 02 04 05 b4 01 01 04 02

所以我知道IP头从45 00开始,有20个字节。我想知道 TCP 标头从哪里开始以及有多少字节,如果您不介意,您能否简要解释一下帧及其有效负载中包含的所有字段的用途?

谢谢你

只是一个为了更好地理解的问题。

networking tcp ip
1个回答
0
投票

它是这样分解的:

00 12 17 c1 fd f8    // src mac address
00 0d 87 cf 71 9a    // dst mac address
08 00                // protocol == 0x0800 == IPV4

45 00 00 30          // IP START total length: 0x0030 == 48
aa b6 40 00          // identification: 0xaab6  flags:2 fragoffset:0 
80 06 c3 99          // ttl:0x80   protocol=0x06=TCP    header checksum=0xc399
c0 a8 00 c0          // source IP = 192.168.0.192
d4 3a f6 d4          // dest IP   = 212.58.246.212

05 0b 01 bb          // TCP START source port=1291  dest port=443 = HTTPS
50 06 19 e0          // SEQ NUMBER = 0x500619e0
00 00 00 00          // ACK NUMBER = 0x00000000
70 02 ff ff          // data offset = 0x7. Implies two 32-bit words of option data. flags=0x02==SYN BIT SET   Windows size is 0xffff=65535
85 fb 00 00          // checksum=0x85fb.  Urgent=0x0000
02 04 05 b4          // option data
01 01 04 02          // option data
© www.soinside.com 2019 - 2024. All rights reserved.