简体   繁体   中英

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.

IPv6的设计者决定在所有这些层上都没有必要将其删除,以支持其他层(例如您提到的那些层)的校验和。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM