3

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.

0

3 Answers 3

7

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.

2

Routers only check the IPv4 header checksum. If the header is corrupted the packet is dropped. Payload or higher-layer errors are not detected here. IPv6 even drops the header checksum and leaves that to the upper layers.

TCP runs a checksum across the IP (pseudo) headers, the TCP headers and the TCP payload. Originally, this checksum is only checked by the end destination. However, some devices (esp. NAT routers) change the header fields and need to recalculate the checksums - before they do that they check the received checksums. Many firewalls also run checks on the present checksums.

Additionally, lower layers may run their own checksums. Most notably, Ethernet uses a frame checksum (FCS) across link layer networks. Some high-speed Ethernet physical-layer variants add forward error correction (FEC) that can detect and even correct smaller errors.

1

IPv4 checksum only checks for corruption in the IP header.

TCP checksum checks for corruption in both payload TCP header.

Your Answer

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

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