Tugger the SLUGger!SLUG Mailing List Archives

Re: [chat] Technicalities of MTU - Calculating number of fragments.


mkraus@xxxxxxxxxxxxxxxxxxxxxx writes:

> This is for all you TCP/IP buffs out there.... All others may happily 
> delete.... :)

I'll give you some input, but I'm not buff. 
I don't claim that what I write is correct :)

> What is the correct way of calculating number of fragments under IP?

This could be taken a number of ways.

> 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)

I think its a vague question. If we are talking about 2048 bytes
of payload, then:

I would work out the MSS (maximum segment size), on a typical 
linux box, IP header is 20 bytes, TCP header is 38 bytes 
(with timestamps turned on), so MSS would be 296 - 58 = 238

Which means we can fit 238 bytes of TCP data (or payload) per packet, 
IP   20
TCP  38
DATA 238
--------
MTU  296

so 2048/238 = 9 packets.

With no timestamps, IP=20, TCP=20, MSS=256, 2048/256=8 packets.

Spreadsheets are great for playing with this stuff.