SLUG Mailing List Archives
[chat] Technicalities of MTU - Calculating number of fragments.
- To: slug-chat@xxxxxxxxxxx
- Subject: [chat] Technicalities of MTU - Calculating number of fragments.
- From: mkraus@xxxxxxxxxxxxxxxxxxxxxx
- Date: Fri, 16 May 2003 12:23:16 +1000
G'day all...
This is for all you TCP/IP buffs out there.... All others may happily delete.... :)
What is the correct way of calculating number of fragments under IP?
I've been discussing with a lecturer regarding this - accordingly its a straightforward divide operation eg:
for a 2048 byte datagram over a PPP network (296 byte MTU) - 2048/296 = 6.91 = 7 fragments (must round up)
However, I say that as MTU includes maximum length of data that can be placed in a frame, which includes the IP header and data (ie. the total datagram size must fit within the MTU) you must also take into account the header that must be copied into each fragment, and will require additional overhead. (This isn't taking into account the offset calculations which can affect the size of a fragment, and therefore number of fragments.)
Header size may be 20 to 60 bytes per IP datagram. For the maximum header size 40 bytes will be straight header and 20 bytes of options. Options may or may not be copied to all fragments.
So for a 2048 byte datagram over a PPP network (296 byte MTU):
For a 20-byte header (minimum header size)
Data: 2048 - 20 = 2028 bytes
Data payload per fragment (MDDS): 296 - 20 = 276
Number of required fragments: 2028/276 = 7.35 = 8 (must round up)
For a 60-byte header (maximum header size, all options copied to each fragment)
Data: 2048 - 60 = 1988
Data payload per fragment (MDDS): 296 - 60 = 236
Number of required fragments: 1988/236 = 8.42 = 9 (must round up)
Therefore the number of fragments will be 8 to 9 (not counting any additional overhead caused by offset calculations)
Any guidance given regarding the correct way to calculate fragments appreciated.
Mike
---
Michael S. E. Kraus
Network Administrator
Capital Holdings Group (NSW) Pty Ltd
p: (02) 9955 8000