IP Checksum Calculation At the sender r Set

  • Slides: 4
Download presentation
IP Checksum Calculation At the sender r Set the value of the checksum field

IP Checksum Calculation At the sender r Set the value of the checksum field to 0. r Divide the header into 16 -bit words m Add all segments using one’s complement arithmetic r The final result is complemented to obtain the checksum At the receiver r Divide header into 16 -bit words, adds them, and complement’s the results r All zero’s => accept datagram, else reject 1

Binary Checksum Example 001 Carry from 16 th column 001 Carry from 13 th

Binary Checksum Example 001 Carry from 16 th column 001 Carry from 13 th column th 0001 Carry from 12 column th 0000 001 Carry from 5 column th 0000 0001 Carry from 4 column rd 0000 1 Carry from 3 column nd 0000 01 Carry from 2 column 0000 001 Carry from 1 st column 0000 1001 1000 0000 1111 1000 0001 1001 0001 1111 0010 0111 1001 1 0010 1101 0111 1000 1011 0100 1010 0101 2

UDP Checksum The pseudo-header r Add pseudo-header r Fill checksum with 0’s r Divide

UDP Checksum The pseudo-header r Add pseudo-header r Fill checksum with 0’s r Divide into 16 -bit words r r (adding padding if required) Add words using 1’s complement arithmetic Complement the result and put in checksum field Drop pseudo-header and padding Deliver UDP segment to IP 32 -bit source IP address 32 -bit destination IP address length 0’s protocol source port # dest port # length checksum data (add padding to make data a multiple of 16 bits) 32 bits 3

Checksum calculation at Receiver r Add pseudo-header to the UDP segment r Add padding,

Checksum calculation at Receiver r Add pseudo-header to the UDP segment r Add padding, if needed r Divide into 16 -bit words and add words using 1’s complement arithmetic r Complement result r If result is all 0’s m Drop pseudo-header and padding (if any) m Accept segment Else drop segment 4