A Little Bit About IP Checksums

The role of checksums in IP headers is actually very important.  THey are used to make sure that data is not corrupted during it’s journey from the source address to the destination.  TCP/IP uses a specific algorithm to check the data which involves dividing the checksum data in separate 16 bit fields.  Every one of those fields has a 1 complement performed on it and all of these are added together.  The final value of this calculation is considered the checksum.

What Happens to the Checksum in this example – German IP address on YouTube ?
You can see  the checksum in the 10th and 11th byte of the IP header.  It only includes fields in the IP header.  The major difference of this method to other protocols is that the checks are performed ’en route’ by the individual routers that make up an IP packets journey. Normally embedded protocols would work out their checksum at the destination.

So what happens if the checksum doesn’t match?  Well nothing complicated the affected datagram is simply discarded.  This is one of the difficulties in troubleshooting IP problems as the host isn’t even informed of the issue.  The idea is that error reporting is performed by the higher layer protocols which have better error management built into them.  Of course it’s not always needed, if you’re streaming video across the internet like this – http://www.proxyusa.com/bbciplayerabroad2012 then the odd malformed packet is no big deal but with critical application data then you’ll need to get other protocols involved.

The algorithm is quite a simple one, and some criticise it’s simplicity.  So why isn’t the algorithm a bit more complicated which is able to give a reliable check?  Well the problem is that this checksum computation is completed for every packet that a router or network device receives.  A simpler algorithm is essential for one factor and that is speed.  It really is a very fast algorithm and for a 16 bit checksum fairly reliabel on the whole.  Of course if you want to delve deeper in the inner workings of theIP checksum then it’s worth checking out the RFC – here’s the link – RFC 1071.