In this article, we learn what’s the exact difference between the term which is often misused in Computer Networks and a lot of confusion prevails on the usage of these terms. Before starting it is better to get acquainted with a term called Protocol Data Unit (PDU). The term PDU is used to refer to the packets in different layers of the OSI model. Thus PDU gives an abstract idea of the data packets. The PDU has a different meaning in different layers still we can use it as a common term. To give a clear picture:-
- The PDU of Transport Layer is called as a Segment.
- The PDU of Network Layer is called as a Packet.
- The PDU of the Data-Link Layer is called Frames.
This is the basic meaning of different terms used in Computer Networks. The Application layer can give any amount of data to the underlying layers, but it is not possible to send all the data given by the application layer to send directly. Thus, the TCP comes into the picture. The TCP helps break the data(given by application layer) into MSS(Maximum Segment Size) that the given network can handle so that further fragmentation doesn’t occur in the routers. And this TCP is also responsible for acknowledgements when segments are delivered.
1. Segment: The data from the application layer is broken into smaller parts as per the MSS of the network and the TCP header is added to the smaller parts. The size of the header can vary from 20B to 60B. But usually, the header is of size 20B(rest 40B are optional) The header of TCP includes:-
1. Source Port 2. Destination Port 3. Flag bits (like DF, MF, etc) 4. Sequence Number of the Segments 5. Checksum 6. Options Field
Source and Destination port are required because it tells in which PDU is to be delivered in the receiver host. The checksum field of the TCP is calculated by taking into account the TCP header, data and IP pseudo-header. The Checksum ensures that correct data is sent and received. Thus, after all these processing the broken data packets are called Segments.
2. Packets: The segments received from the Transport layer are further processed to form the Packets. The IP packet has a header of varying sizes from 20B to 60B. But usually, it is 20B. The IP header has many fields namely:-
1. Source IP Address 2. Destination IP Address 3. TTL(time to leave) 4. Identification 5. Protocol type 6. Version (version of protocol) 7. Options
Now let’s understand the concept, the IP body contains the Segment received from the Transport Layer without any of the modifications. To the IP body, the IP header is added which has the fields as mentioned above. The IP headers are continuously modified as the packets in the networks because TTL keeps on changing with each hop. Thus the IP header along with the body (which contains the segment from the Transport layer) makes the IP Packet or popularly only Packet. This layer is also responsible for fragmentation if required when MTU of the network is less . This fragmentation is done at the Routers.
3. Frames: The Packets received from the Network Layer further processed to form the Frames. Here is the Data link layer the header is added, the header consists of the fields.
1. Source Mac Address 2. Destination Mac Address 3. Data 4. Length 5. Checksum (CRC)
The source MAC address is resolved by using the ARP(Address Resolution Protocol). The Source and Destination MAC address would keep on modifying as the Frame moves in the network. The Modification of the MAC address is done by the Routers. Data is the segment that is received from the network layer. The length is the total MTU(maximum transferable unit) of the network. All concepts will be clear with the diagram given below.