I do not understand how to fragment a IP datagram.
Let's say the original datagram has a total size of 302 (20bytes header and 282 bytes payload). My datagram needs to be fragmented since it goes through a network of 128MTU. I have to fragment it and add 20 header for each new fragments.
-
Fragment 1 124 total length (104 bytes payload)
-
Fragment 2 124 total length (104 bytes payload)
-
Fragment 3 94 total length (74 bytes payload)
If I addition that it gives me indeed the original payload. I do not understand how to find those numbers…
Why couldn't it be
- Fragment 1 114 total length (94 bytes payload)
- Fragment 2 114 total length (94 bytes payload)
- Fragment 3 114 total length (94 bytes payload)
(282/128(MTU)) > 2 so I need 3 fragments. 3Fragments = 60 bytes header added
60 +282 = 342 342/3 = 114 total lenght for each fragments.
My question is…
How and why should I get 124 124 and 94?
Best Answer
The IP fragmentation and reassembly is described by the RFCs. You must fragment on 64-bit boundaries. There are RFCs dealing with this, and other sites which will describe the fragmentation and reassembly process in depth; you can do a search to find them
Start with RFC 791, INTERNET PROTOCOL: