开发者

why there is separate checksum in TCP and IP headers?

What is the need for having checksum at various layers ? For eg, there is a checksum in TCP layer and again in IP layer and also Ethernet layer has it. Is not it sufficient to have checksum at one 开发者_运维问答layer ?


All three layers are needed, for multiple reasons:

  • IP does not always run over ethernet (imagine IP over RS-232 serial, something every Cisco and Unix box can do)

  • IP does not checksum the data

  • TCP packets can be reassembled incorrectly from IP packets and fragments that each have perfect checksums

  • Even if reassembled correctly, software or other errors could be introduced in the layers between IP and TCP

  • Even if all software functions correctly, and TCP/IP is over ethernet, the limited size of the checksums can be accidently correct (and will be at some point, given enough packets) in the face of persistent errors, so having more than one checksum is helpful.

  • Every time a new header is introduced there is more to checksum, and the new layer can't see the header bits of the layer below.


Ethernet checksum is a hop to hop checksum - meaning that it is recomputed everytime the Ethernet header fields change. TCP/UDP checksum is a end-to-end checksum meaning it is computed by the sender and verified by the receiver. TCP/UDP checksums cover the entire segment. IP checksum covers only the header. Ethernet CRC covers the entire frame.


The designers of IPv6 decided it's not necessary at all those layers and removed it in favor of checksums at other layers (such as those you mentioned).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜