Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why in a IPV4 packet, checksum is calculated against the IP header and not the entire packet like transport protocols tcp/udp?

Tags:

ipv4

Why in a IPV4 packet, checksum is calculated against the IP header and not on the data like transport protocols tcp/udp?

like image 894
kuchiku Avatar asked Feb 09 '12 03:02

kuchiku


2 Answers

It's a matter of speed: the Internet backbone routers direct millions of packets per second and calculating a checksum over the entire contents would drastically slow down the packet processing.

The IPv6 specification removes even the header checksum to allow routers to route packets even faster. (It's just one of many steps IPv6 has taken to reduce the amount of time routers must inspect every packet. It all adds up.) Discarding corrupted packets is now placed entirely on end nodes.

like image 197
sarnold Avatar answered Oct 07 '22 18:10

sarnold


There are two good reasons for this.

First, all higher-level protocols that encapsulate data in the IPv4 datagram have a checksum field that covers the whole packet. Therefore, the checksum for the IPv4 datagram does not have to check the encapsulated data.

Second, the header of the IPv4 packet changes with each visited router, but the data do not. So the checksum includes only the part that has changed. If the data were included, each router must recalculate the checksum for the whole packet, which means an increase in processing time.

source: Data Communications and Networking by Behrouz A. Forouzan

like image 36
Jim Avatar answered Oct 07 '22 19:10

Jim