5

When an IPv4 datagram comes to a router for forwarding, does it always update the value of the header checksum field?

1 Answer 1

10

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.

2
  • 6
    Note 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.