The checksum field, Frame Check Sequence (FCS), is a data field for block security in the headers of the access procedures for local networks, as well as in the protocols of the network layer such as the HDLC protocol, the IP protocol or various transport protocols such as the TCP protocol and the UDP protocol.
The checksum field contains the bits for error checking the checksum field. The complete block information to be protected is used to form the block checksum. This can refer to the header only or can also include the data. The checksum is calculated on the sender side from the entire data block and entered in the corresponding data field. The receiver determines the checksum from the received data block and compares it with the transmitted checksum.
Checksum field in the IP, UDP and TCP headerIn the IP header, the header checksum field has a length of 16 bits, over which errors in the header are checked. In the IP checksum field, the ones complement of all 16-bit elements are added together and another ones complement is formed from the sum. Since the checksum can change when a data packet passes through a router, it must be recalculated in this case.
In the TCP header and UDP header, the data field for the checksum is also 2 octets long and takes into account all header parameters of its own header and the IP header on which the protocols are based.