Definition of Network Units: Fragment, Segment, Packet, Frame, Datagram

NetworkingIpDefinitionOsi

Networking Problem Overview


What units are used in network terminology? Where do we use them?

I know the following - but I'm not sure what their meaning is:

  • Fragment
  • Segment
  • Packet
  • Frame
  • Datagram

Can they be assigned to a specific OSI-Layer? Is it more complex?

Networking Solutions


Solution 1 - Networking

Taking from Section 1.2 in TCP/IP Illustrated: Vol 1 by Richard Stevens et al., consider the 4 layered TCP/IP stack:

        +-------------+-------------------------+
        | Application |  Telnet, FTP, etc       |
        +-------------+-------------------------+
        | Transport   |  TCP, UDP               |
        +-------------+-------------------------+
        | Network     |  IP, ICMP               |
        +-------------+-------------------------+
        | Link        | drivers, interface card | 
        +-------------+-------------------------+

Segment: If the transport protocol is TCP, the unit of data sent from TCP to network layer is called Segment.

Datagram: This is used in 2 layers. If the network protocol is IP, the unit of data is called Datagram. At transport layer, if protocol is UDP, we use datagram there as well. Hence, we differentiate them as UDP Datagram, IP Datagram.

Frame: Physical layer representation.

Packet: It is a more generic term used either transport layer or network layer. TCP Packet, UDP Packet, IP Packet etc. I have not seen it to represent Physical layer data units.

Fragment: My guess here is that when a unit of data is chopped up by a protocol to fit the MTU size, the resultant unit of data is called Fragments. But I am guessing.

Solution 2 - Networking

These terms are used to refer at which OSI layer we are referring to, the data remain same but the headers and trailers are getting added or removed.

In Phy layer i.e. physical layer the actual data is in "bits" i.e. 0 and 1.

When it reaches to data link layer or Layer 2 it becomes "frame" with source and destination mac address getting added.

When it reaches the third layer or the networking layer it becomes a "packet" with source and destination IP address attached to it.

Finally it become "segment" at Layer 4 or TCP/IP layer. Basically "segment" term is used for TCP connections and "datagrams" for UDP.

So what about other layers like : session, presentation and application ? In these layers the data is termed as "PDU" or "protocol data unit".

So when someone says, that a "frame" is being received by a networking device, then you know that the device is switch.

Router receives a packet and process it.

Solution 3 - Networking

The answer above is complete. Nevertheless, I think the term packet came from packet switching if I remembered that correctly ..

There are 2 types :

Circuit switching is a methodology of implementing a telecommunications network in which two network nodes establish a dedicated communications channel (circuit) through the network before the nodes may communicate. The circuit guarantees the full bandwidth of the channel and remains connected for the duration of the communication session. The circuit functions as if the nodes were physically connected as with an electrical circuit.(Wiki)

Packet switching is a digital networking communications method that groups all transmitted data – regardless of content, type, or structure – into suitably sized blocks, called packets.(Wiki)

I would have defined it myself, but just to be sure.

So here is the Packet Term. In regard of fragment I concur with Josua Schmid's answer.

Solution 4 - Networking

I agree with the answers above, but it is important to emphasize that this is assuming the TCP/IP stack. If we use the OSI model, which in my opinion is more widespread, we would have the following case:

Transport layer: Segment if TCP, Datagram if UDP Network layer: Datagram, Fragment can be used if split (it would still be a datagram) Data-Link layer: Frame in MAC sublayer, frame or bit in LLC sublayer (depends on what level you work with, they are not interchangeable) Physical layer: Bit

And as mentioned in previous answers packet is more generic, it can be used for Transport, Network or Data-Link layer, but NOT for the physical layer. At this level it has not been "packed" yet. So I would say this is the biggest difference between the TCP/IP Stack model and the OSI model. The OSI model breaks down the physical layer from the TCP/IP stack into two layers: Data Link and Physical.

Hope this helps.

Solution 5 - Networking

Frame as physical layer representation doesn't sound 100% accurate to me. It is mostly in the data-link layer, which is above the physical.

For a more operational definition, I would say that a frame is a protocol data unit that has means to determine its boundaries. Examples:

  • an HDLC frame has flags at the beginning and end and a bit stuffing
    mechanism
  • an Ethernet frame uses preamble and SFD
  • GFP uses HEC frame delineation, like ATM

A cell, as in ATM, just to introduce one term more, is a fixed-length frame.

A packet is instead a protocol data unit that relies on a lower layer unit to determine its boundaries. It may fit exactly in one frame or be broken into fragments if required. In the latter case fragmentation and reassembly mechanisms must be devised. Datagram is mostly a synonym for packet.

An application data stream can be broken into segments. A segment is carried over a datagram, then segments are reassembled into the original application stream. This is typically done by the TCP layer. So in TCP we have application stream over TCP segment over IP datagram over data-link frame. In UDP there is no segmentation, so the UDP datagram is one-to-one mapped onto the IP datagram.

Solution 6 - Networking

a Datagram is.... A self-contained, independent entity of data carrying sufficient information to be routed from the source to the destination computer without reliance on earlier exchanges between this source and destination computer and the transporting network. (... used in UDP)

a Segment is .... A protocol data unit which consists a TCP header and an application data piece (packet) which comes from the (upper) Application Layer

Solution 7 - Networking

Packet: The basic unit of communication between a source and a destination in a network is a packet. Packets are data units within the network layer in the OSI model. The packet is in a Network layer.

Fragment:Packets can often be larger than the maximum size, so each packet is also divided into smaller pieces of data called fragments. The Network layer is responsible for fragmentation.

Segment: A segment is a broken piece of a packet with a TCP header in each of them. segments increase the efficiency of network performance and improve security. Segments are in a Transport Layer.

Frame:Similar to a Packet, frames are small parts of a message in the network. a frame is the unit of data used in the OSI model’s data link layer.

Datagram:The datagram represents a data unit of transfer in networking. Data transmitted in a network is divided into smaller parts called datagrams. Transport layer

In addition, there is something class bit, this is in a Physical layer

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionschmijosView Question on Stackoverflow
Solution 1 - NetworkingBhaskarView Answer on Stackoverflow
Solution 2 - NetworkingguoView Answer on Stackoverflow
Solution 3 - NetworkingOmarView Answer on Stackoverflow
Solution 4 - NetworkingcestevezView Answer on Stackoverflow
Solution 5 - NetworkingHalberdierView Answer on Stackoverflow
Solution 6 - NetworkingrajaView Answer on Stackoverflow
Solution 7 - Networkingعبدالله الطوالهView Answer on Stackoverflow