Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a datagram of 3600 Bytes, an MTU of 800 Bytes, and so my number of fragments is 5.

I found that the first 4 fragments will be 800 bytes (including the 20B for the IP header) and the last will be 480 (including the IP header).

The offset for the first is of course 0, but when I calculate the offset for the second fragment I get this:

fragment 2 offset = 780 Bytes / 8 = 97.5

How do I handle getting a non integer number? Do I take the ceiling of it?

share|improve this question

closed as off topic by Mike Fitzpatrick, MaQleod, Diogo, Indrek, Dave Oct 4 '12 at 9:41

Questions on Super User are expected to relate to computer software or computer hardware within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

    
A complex number is a number that can be put in the form a + bi, where a and b are real numbers and i is called the imaginary unit, where i2 = −1 –  Nifle Oct 4 '12 at 6:58

1 Answer 1

Okay I figured it out, you're supposed to pick a payload size that is divisible by 8 and leave the remaining space for the header.

For my question I was getting 97.5 because 780 isn't divisible by 8, so I knocked my payload size down to 776 which when divided by 8 gives me 97.

I then use that value to calculate the fragment offset.

If you have an MTU that is 800 Bytes, your offset for a second fragment will be of course 97, and how that works into the actual packet is this:

  • IP Header = 20 Bytes
  • Payload = 776 Bytes
  • Unused space = 4 Bytes
share|improve this answer

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