When an IPv4 datagram comes to a router for forwarding, does it always update the value of the header checksum field?
1 Answer
Since the router changes the IPv4 header (it decrements the TTL), it needs to calculate a new value for the checksum, otherwise subsequent devices receiving the packet will think it is damaged.
This only applies to IPv4. IPv6 has eliminated the checksum, instead it relies on protocols above and below it to do any error checking.
-
6Note that the mathematical structure of a CRC allows updating the checksum after such a small change without processing the whole input to the CRC, so the calculation of the new value is cheaper than what one might expect. Jul 23, 2016 at 21:03
-
2@CodesInChaos, that is a good note for a TTL change, although it is a bigger change for things like NAT or fragmentation.– Ron Maupin ♦Jul 24, 2016 at 0:54