IP header checksum calculation If an IP header is 0x45000030
Solution
Please follow the data and description :
CheckSum :
A check sum is basically a value that is computed from data packet to check its integrity. Through integrity, we mean a check on whether the data received is error free or not. This is because while traveling on network a data packet can become corrupt and there has to be a way at the receiving end to know that data is corrupted or not. This is the reason the checksum field is added to the header.
The given IP header is :
4500 0030 4422 4000 8006 0000 8c7c 19ac ae24 1e2b
Lets first map these values with the header,
a) Here the first integers \'45\' corresponds to the first two fields in the header that us \'4\' corresponds to the IP version and \'5\' corresponds to the header length respectively. Now that since the header length is described in 4 byte of words so the actual header length reaches out to be 5 x 4 = 20 bytes.
b) \'00\' corresponds to TOS or the type of service. This value of TOS indicated normal operation.
c) \'0030\' corresponds to total length field of IP header. So in this case the total length of IP packet is 60.
d) \'4422\' corresponds to the identification field.
e) Now moving on to the \'4000\', this can be divided into two bytes. These two bytes divided into 3 bits and 13 bits respectively corresponds to the flags and fragment offset of IP header fields respectively.
f) The same way the \'8006\' can be divided into two groups as \'80\' and \'06\'. The first byte corresponds to the TTL field and the second byte corresponds to the protocol field of the IP header. Here \'06\' indicates that the protocol is TCP.
g) \'0000\' corresponds to the checksum which is set at the source end that is more simpler the which sent the packet. This field will be set to zero while computing the checksum at destination end.
h) The next set of bytes correspond to the source IP address and the destination IP address in the IP header.
 Lets convert all these values into binary format :
 4500 - 0100010100000000
0030 - 0000000000110000
4422 - 0100010000100010
4000 - 0100000000000000
8006 - 1000000000000110
0000 - 0000000000000000
8c7c - 1000110001111100
19ac - 0001100110101100
ae24 - 1010111000100100
1e2b - 0001111000101011
 Now lets add these binary values one by one :
a)
 4500 - 0100010100000000
0030 - 0000000000110000
 -----------------------------
 0100010100110000
b)
 0100010100110000
4422 - 0100010000100010
 -----------------------------
 1000100101010010
c)
 1000100101010010
4000 - 0100000000000000
 -----------------------------
 1100100101010010
d)
 1100100101010010
8006 - 1000000000000110
 -----------------------------
 10100100101011000 - carry bit, add it to the result
0100100101011001
e)
 0100100101011001
0000 - 0000000000000000
 -----------------------------
 0100100101011001
f)
 0100100101011001
8c7c - 1000110001111100
 -----------------------------
 1101010111010101
g)
 1101010111010101
19ac - 0001100110101100
 -----------------------------
 1110111110000001
h)
 1110111110000001
ae24 - 1010111000100100
 -----------------------------
 011001110110100101 - carry bit, add it to the result
1001110110100110
i)
 1001110110100110
1e2b - 0001111000101011
 -----------------------------
 1011101111010001
 So now BBD1 - 1011101111010001 is our final result of summing up all the 16 bit words in the header.
As a last step we just need to do a one’s compliment of it to obtain the checksum.
442E - 0100010000101110.
So the CheckSum is 442E - 0100010000101110.
 Hope this is helpful.



