Today, I learned about the IP fragmentation and reassembly.
So, our network usually have MTU (Max Transimission Unit): maximum amount of data that a link-layer frame can carry (max size of an IP packet). Different data link protocols (like Ethernet, WiFi) have different MTUs.
The important point is that if a IP packet arrives at a router with larger size of packet than MTU, then the router divides it into smaller packet. See this picture to understand.
Large IP datagram is divided within net.
- one datagram becomes several datagrams
- "reassembled" only at the final destination
- IP header fields are used to identify and order fragments
- The packet is not reassembled at the next router: keep the net core simplel; meaning less computation on routers, so routers process packets faster.
- IP fragmentation is implemented if it is required again at next router.
Now we can see some example of IP fragmentation.
So if we have 4000 byte datagram, and MTU is 1500 bytes.
20 bytes are allocated to bytes header. It means the payload bytes is 3980.
This is how IP fragmentation works in this case.
MTU is 1500. 20 is for header and 1480 would be the data field.
The first offset is gonna be "0."
The second offset is gonna be 1480 / 8 = 185.
The third offset is gonna be (1480 + 1480)/8 = 370.
So, what is offset? 🤨
Offset is specified in units of 8-bytes chunks.
At the end of the fragmentation, the flag is 0 for the last fragment.
Now, we can go over the next example.
Example: 1600 byte datagram, MTU = 500 bytes.
It would be 480, 480, 480, 160 (sum should be 1600) are gonna be the payload size of each fragmentation.
With header, these are gonna be 500, 500, 500, 180.
The answer is like this:
The first offset is gonna be 0, second: 60, third: 120 and the last offset is 180.
So, this is helpful to understand how source is transmitted to router. If the TTL(Time to Live) is 0, then the network drops the packet.
'Computer Science 🌋 > Network Programming 🛰️' 카테고리의 다른 글
HTTP(3), Apr/11/2023 (0) | 2023.04.12 |
---|---|
HTTP(2), Apr/11/2023 (0) | 2023.04.12 |
HTTP(1), Apr/11/2023 (0) | 2023.04.12 |
IP Protocol, Apr/6/2023 (0) | 2023.04.07 |
DHCP, Apr/3/2023 (0) | 2023.04.03 |