16

I'm reviewing the networking security unit of the class I'm in, and I had a question.

I know that datagrams are packets at the transport layer of the OSI model, whilst frames are the name for packets in the transport layer and network packets are in the network layer. I also know that each contains a header with overhead info like the source and destination IP addresses, as well as a payload of data. But I wasn't able to find anything about the subtler differences between the contents of datagrams, frames, and network packets. Are there any resources or diagrams you could point me to so I can further my understanding of these concepts?

Thank you!

1
  • 2
    Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can post and accept your own answer.
    – Ron Maupin
    Commented Jan 3, 2021 at 5:09

2 Answers 2

13

The terms Frame, Packet, and Segment exist to create abstractions from what one layer is responsible for verses the others.

To explain that, and to answer your question thoroughly, I'm going to start a bit "earlier" than what you are really asking.

Therefore...

  • When Layer 4 gets data, it adds to it a header which facilitates service to service delivery like TCP or UDP ports (among other things) -- this whole datagram is referred to as a Segment.
  • When Layer 3 gets data, it adds to it a header which facilitates end to end delivery like the source IP of the initial sender and the destination IP of the final recipient -- this whole datagram is referred to as a Packet.
  • When Layer 2 gets data, it adds to it a header which facilitates hop to hop delivery like the Source and Destination MAC addresses of the current "hop" in the network -- this whole datagram is referred to as a Frame.

The is essentially the process of Encapsulation, illustrated in this animation:

enter image description here

  • A Frame then, is the L2 header plus whatever data needs to be delivered to the next hop:

  • Frame: [L2 HDR][110011001010101011110000...010101]

  • You and I know that inside the frame is a L3 header and a L4 header and application data, but as far as L2 is concerned, everything inside is just a series of 1s and 0s that need to be delivered to another hop.

  • A Packet then, is the L3 header, plus whatever data needs to be delivered to the other end:

  • Packet: [L3 HDR][1010101011110000...010101]

  • You and I know that inside the packet is a L4 header and application data, but as far as L3 is concerned, everything inside is just a series of 1s and 0s that need to be another endpoint

  • A Segment then, is the L4 header, plus whatever data needs to be deliverred to the other service:

  • Segment: [L4 HDR][11110000...010101]

  • You and I know that inside the Segment is the application data which is to be processed by the receiving service

And the application data itself, of course, is going to differ with every application. HTTP for web requests, FTP for file transfers, and so on.

The term Datagram itself is simply the construct of a header and bits. And the terms above are simply the unique names for the particular Datagram that operates at each layer.

  • A Frame is the Datagram at L2
  • A Packet is the Datagram at L3
  • A Segment is the Datagram at L4
1
  • There's a problem with this answer - the same as with @JFL's (see my comment there)
    – z33k
    Commented Jul 9, 2018 at 12:13
9

Note:
the term datagram is used in various ways. If we stick to RFC1594 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.

and can be used to speak about any layer transmission unit.

I.E.

  • a packet is the Internet layer datagram
  • the frame is the network access layer datagram.
  • the transport layer datagram is a segment

Back to the question

From this answer on Stack Overflow

enter image description here

As you can see :

  • the application data receives a transport protocol header (UDP or TCP generally) and become a segment.

  • The segment receives an IP header and is now a packet

  • The packetreceives a frame header and a frame footer to form a frame

1
  • 1
    It's all very fine and dandy until you learn that if you went another step down the OSI layer hierarchy to Physical Medium, you would meet a packet again (as per this answer)
    – z33k
    Commented Jul 9, 2018 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.