kuchiku
kuchiku

Reputation: 113

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

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

Upvotes: 8

Views: 9915

Answers (3)

Ynk 1993
Ynk 1993

Reputation: 69

Ipv4 ensures only the address is correct ,so it calculates the checksum using only the address and not using the data,ensuring reliable transfer of data is not the network layer's job

Upvotes: 4

Sharad
Sharad

Reputation: 1058

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

Upvotes: 5

sarnold
sarnold

Reputation: 104050

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.

Upvotes: 11

Related Questions