If an error on a packet occurs on a router, who does detect the error, IP checksum or TCP checksum?
I have understood that the IPv4 checksum detects errors only inside the IP header and the TCP checksum detects errors inside all the segment and also errors that occurs on IP addresses, but I don't understand which errors are detected by whom.
IP Checksum vs TCP Checksum – Key Differences
checksumipipv4Networktcp
Related Topic
- TCP MTU – TCP Segment Length and TCP/IP Header Options
- UDP Checksum – Can It Be Inconclusive for Error Detection?
- UDP Checksum – Calculation on Improperly Padded Packets
- UDP Checksum – How to Verify Data Integrity with UDP Checksum
- TCP Checksum – Why TCP Checksum is Not 100% Reliable Despite Being a Reliable Data Transfer Method
- Should TCP Checksum Offload Be Disabled?
Best Answer
As your data travels up the network stack, it may be subject to error detection at each layer of the stack.
For example, ethernet has the FCS for its frames (other data link protocols may have their own way of detecting errors in a frame). Any frame that does not pass the FCS test is dropped, the payload never reaching the network layer.
IPv4 has a header checksum to detect errors in the layer-3 IPv4 packet header, and it discards any packets not matching the header checksum, the payload never reaching the transport layer. IPv6 has eliminated any error detection on its layer-3 packets. Remember that a bad address should not even be delivered to the host in the first place.
The transport protocol may, or may not, have error detection for the layer-3 packet payload (layer-4 segment or datagram). TCP has a checksum that covers the TCP pseudo header and payload. It is optional for UDP on IPv4, but mandatory for UDP on IPv6. Other transport protocols may have error detection, and others may not. If a transport protocols does not have error detection, it is up to the application to check for errors.