Fragmentation at Network Layer
Last Updated :
08 May, 2025
In computer networks, data is sent in small units called packets or datagrams. Sometimes, these datagrams are too large to pass through a network with a smaller size limit. To handle this, the datagram is broken into smaller parts is called fragmentation.
- IPv4 datagram can be as large as 65,535 bytes.
- Not all networks support such large packets due to their MTU (Maximum Transmission Unit).
- Fragmentation splits a large datagram into smaller fragments.
- Each fragment has its own header with necessary information.
- Fragmentation can be done at the source or by routers along the path.
- A datagram may be fragmented multiple times if needed.
- All fragments travel separately and may take different paths to the destination.
- Reassembly of fragments happens only at the destination.
Why is Fragmentation Needed?
When a large datagram is created by the source computer, it may need to travel through multiple networks to reach the destination. Each of these networks might support different maximum packet sizes. This leads to the need for fragmentation.
Although sending large datagrams is better for efficiency (because headers are not repeated), it’s not always possible due to the reasons below:
Reasons for Fragmentation
- Different Network Limits: Each network has a Maximum Transmission Unit (MTU) which is the largest packet size it can handle. If a datagram is larger than the MTU, it must be broken into smaller fragments.
- Unknown Path Information: The source computer doesn’t know the exact route the datagram will take, so it cannot predict the smallest MTU along the path.
- Header Overhead: Every fragment gets its own header, which wastes bandwidth if too many small fragments are created unnecessarily.
- Hardware and OS Limitations: Some systems have built-in limits on how much data they can send or receive in one packet.
- Standard Compliance: Some national or international network standards require packet sizes to be within specific limits.
- Protocol Differences: Different networks may use different protocols, and each protocol can have different allowed packet sizes.
- Long Transmission Time for Large Packets: Large packets stay in the network for a longer time, which may delay other packets.
- Error Handling: If a large packet gets corrupted, the entire packet must be retransmitted. With smaller fragments, only the affected one needs to be resent reducing error impact.
Header FormatThe fields that are related to fragmentation and reassembly of an IPv4 datagram are:
Identification
- This is a 16-bit field in the IPv4 header.
- It gives a unique number to each datagram sent from the source.
- The combination of the Identification field and source IP address helps to identify each datagram uniquely.
- When a datagram is sent, the system copies a counter value into this field and then increases the counter by 1 for the next datagram.
- If the datagram is broken into fragments, all fragments will have the same Identification number.
- At the destination, this number helps to match and reassemble the fragments into the original datagram.
Flags
- This is a 3-bit field in the IPv4 header.
- First bit: Reserved (not used).
- Second bit: Called the "Do Not Fragment (DF)" bit.
- If set to 1, the datagram must not be fragmented.
- If it cannot be sent due to size, it is discarded, and an ICMP error message is sent to the source.
- If set to 0, fragmentation is allowed.
- Third bit: Called the "More Fragments (MF)" bit.
- If set to 1, it means more fragments are coming.
- If set to 0, it means this is the last fragment or the datagram was not fragmented at all.
Fragment Offset
- This is a 13-bit field.
- It shows the position of the fragment in the original datagram.
- It tells the destination where to place this fragment when reassembling the full datagram.
- The offset is measured in units of 8 bytes.
Example:
Let’s say a large datagram has 4000 bytes of data. These bytes are numbered from 0 to 3999. Now, suppose this datagram is too large for the network and needs to be broken into 3 fragments.
Here’s how the fragmentation will happen:
First Fragment
- Carries bytes: 0 to 1399
- Fragment Offset: 0/8 = 0
- Explanation: This fragment starts at the beginning of the data. So its offset is 0.
Second Fragment
- Carries bytes: 1400 to 2799
- Fragment Offset: 1400/8 = 175
- Explanation: This fragment starts from byte 1400. Dividing by 8 gives offset 175.
Third Fragment
- Carries bytes: 2800 to 3999
- Fragment Offset: 2800/8 = 350
- Explanation: This is the last part, starting from byte 2800. Offset becomes 350.
Fragmentation ExampleFragmentation of Datagram
When data travels through a network, it is placed into a unit called a datagram. Every network, whether a Local Area Network (LAN) or a Wide Area Network (WAN), has a limit on the maximum size of data it can handle at a time. This limit is known as the Maximum Transmission Unit (MTU).
Step-by-Step Process
- Only the data part of the datagram is split into fragments.
- The header of the original datagram is copied into each fragment. This ensures that each fragment carries the necessary information for reassembly.
- Fragmentation can take place at:
- The source computer, or
- Any router along the path to the destination.
What Happens at Each Router
- A router receives a datagram that is wrapped inside a frame.
- The router performs the following tasks:
- Removes the frame to access the datagram (decapsulation).
- Checks the MTU of the next network. If the datagram is too large, it fragments it.
- Encapsulates the datagram or its fragments into a new frame suitable for the next network.
- The format and size of the frame depend on the physical network the data is being sent to next.
Why Fragmentation May Happen More Than Once
- The source computer does not know the exact path the datagram will take.
- It also does not know the MTU of every network along the path.
- Even if the source knows the MTU, the route may change in a connectionless network like the Internet.
- Therefore, routers may need to fragment the datagram again if it passes through a network with a smaller MTU.
Reassembly of Fragments
It takes place only at the destination and not at routers since packets take an independent path(datagram packet switching), so all may not meet at a router and hence a need of fragmentation may arise again. The fragments may arrive out of order also.

Algorithm:
- Destination should identify that datagram is fragmented from MF, Fragment offset field.
- Destination should identify all fragments belonging to same datagram from Identification field.
- Identify the 1st fragment(offset = 0).
- Identify subsequent fragments using header length, fragment offset.
- Repeat until MF = 0.
Efficiency:
Efficiency (e) = useful/total = (Data without header)/(Data with header)
Throughput = e * B { where B is bottleneck bandwidth }
Example: An IP router with a Maximum Transmission Unit (MTU) of 200 bytes has received an IP packet of size 520 bytes with an IP header of length 20 bytes. The values of the relevant fields in the IP header.
Explanation: Since MTU is 200 bytes and 20 bytes is header size so, the maximum length of data = 180 bytes but it can't be represented in fragment offset since it is not divisible by 8 so, the maximum length of data feasible = 176 bytes.
Number of fragments = (520/200) = 3.
Header length = 5 (since scaling factor is 4 therefore, 20/4 = 5)
Efficiency, e = (Data without header)/(Data with header) = 500/560 = 89.2 %

Problems Caused by IP Fragmentation
- Increased Load on Routers: When routers handle IP fragmentation, they must process and generate multiple fragments. This adds extra workload and can reduce overall network performance.
- Transmission Inefficiency: If any fragment is lost during transmission, the entire original packet needs to be resent and fragmented again. This leads to wasted bandwidth and delays.
- Out-of-Order Delivery: Fragments may arrive at the destination in a different order. Reordering them takes additional time and computing resources.
- Routing and Firewall Challenges: Since only the first fragment carries the complete upper-layer headers, fragmented packets can interfere with proper routing and firewall operations.
- NAT (Network Address Translation) Complications: IP fragmentation can disrupt NAT processes, as essential information might be missing in some fragments, causing issues in translating IP addresses correctly.
GATE Practice Questions -
- GATE CS 2013 | Question 65
- GATE-CS-2014-(Set-3) | Question 38
- GATE-CS-2015 (Set 2) | Question 65
- GATE-CS-2016 (Set 1) | Question 63
- GATE CS 2018 | Question 37
Similar Reads
Hamming Code in Computer Network
Hamming code is an error-correcting code used to ensure data accuracy during transmission or storage. Hamming code detects and corrects the errors that can occur when the data is moved or stored from the sender to the receiver. This simple and effective method helps improve the reliability of commun
10 min read
Back-off Algorithm for CSMA/CD
Prerequisite - Basics of CSMA/ CD, Collision Detection in CSMA/CD Back-off algorithm is a collision resolution mechanism which is used in random access MAC protocols (CSMA/CD). This algorithm is generally used in Ethernet to schedule re-transmissions after collisions. If a collision takes place betw
7 min read
Collision Detection in CSMA/CD
CSMA/CD (Carrier Sense Multiple Access/ Collision Detection) is a media access control method that was widely used in Early Ethernet technology/LANs when there used to be shared Bus Topology and each node ( Computers) was connected by Coaxial Cables. Nowadays Ethernet is Full Duplex and Topology is
7 min read
Efficiency of CSMA/CD
Prerequisite - Introduction to Ethernet, Basics of CSMA/ CD Carrier sense multiple access with collision detection (CSMA/CD) - The CSMA method does not tell us what to do in case there is a collision. Carrier sense multiple access with collision detection (CSMA/CD) adds to the CSMA algorithm to deal
3 min read
Efficiency Of Token Ring
Token Ring protocol is a communication protocol used in Local Area Network (LAN). In a token ring protocol, the topology of the network is used to define the order in which stations send. The stations are connected to one another in a single ring. It uses a special three-byte frame called a "token"
4 min read
Stop and Wait ARQ
Stop and Wait ARQ is a Sliding Window Protocol method used for the reliable delivery of data frames. The stop-and-wait ARQ is used for noisy channels or links to handle flow and error control between sender and receiver. The Stop and Wait ARQ protocol sends a data frame and then waits for an acknowl
9 min read
Sliding Window Protocol | Set 1 (Sender Side)
Reliable data transmission is critical in computer networking, particularly across long distances or in networks that have high latency. The Sliding Window Protocol is a critical component in obtaining this reliability. It is part of the OSI model's Data Link Layer and is used in several protocols,
8 min read
What is MAC Address?
To communicate or transfer data from one computer to another, we need an address. In computer networks, various types of addresses are introduced; each works at a different layer. A MAC address, which stands for Media Access Control Address, is a physical address that works at the Data Link Layer. I
12 min read
Collision Avoidance in wireless networks
We take a close look at so-called WiFi which is also known as IEEE standard 802.11 Consider the situation depicted in the figure, where each of the four nodes is able to send and receive signals that reach just the nodes to its immediate left and right. For example, B can exchange frames with A and
6 min read
Difference between Unicast, Broadcast and Multicast in Computer Network
The cast term here signifies some data(stream of packets) is being transmitted to the recipient(s) from the client(s) side over the communication channel that helps them to communicate. Let's see some of the "cast" concepts that are prevailing in the computer networks field. What is Unicast?This typ
5 min read