Now let us see what happens on
Intermediate machine that is the Machine B and machine C
We have studied the data encapsulation process
Happening on machine A which is the sending machine and we have studied the data decapsulation process happening on that
Receiving machine that is the destination machine
but the tcp/ip stack of
Intermediate machine B and C also plays some role in forwarding the data
So let us see what happens in the tcp/ip stack of with respect to machine B and machine C
Which are neither sending machine nor receiving machine, but they are forwarding machines
So when let us say that the Machine B receives the data from the machine A
Again the data link layer of the Machine B picks up the data from the wire
It detaches the Mac header and
The data link layer handover the rest of the packet to the layer running above it. That is the network layer
Now as I said that machine B is a forwarding machine. it has to forward the data to the destination machine D
So Network layer on the machine B will check that the destination machine that is specified in the network header is not equal to
Machine B. That is machine B now knows that
This packet is not for me
Therefore machine B decides to forward the data to the next hop towards D now
Which is the next hop machine which leads to machine D from machine B?
Such a next hop is machine C
so network layer on machine B shifts the data back to the data link layer and
Now the data has to travel from machine B to machine C. That is between B and C
Therefore a new Mac header is prepared by the data link layer and attached to the message
This new Mac header will contains the MAC address of the Machine B and the MAC address of the machine C
That is hop by hop
that is hop by hop and
The data link layer eventually places the data on the physical wire or the link
So the point to note here is that on the intermediate machine that is machine B and machine C
Data encapsulation and data decapsulation happens between data link layer and network layer
The transport layer do not play any role on intermediate machines
The same thing exactly same thing happens on intermediate machine C
So to summarize the entire process of data transmission from the machine A to the Machine D
The diagram shows the journey of the packet through the tcp/ip stack of all the machines
So you can see that on intermediate machine B and machine C
The packet goes from physical layer up to the network layer in the tcp/ip stack and then from network layer back to the physical layer
That is like this
Right, so that's all about data encapsulation and decapsulation
So note that data encapsulation and decapsulation partially happens on intermediate machines
Why I am saying partially because encapsulation
Happens from Network layer till up to physical layer and decapsulation happens from physical layer up to Network layer
The transport layer do not play any role on intermidiate machines
Another thing to note here is that whenever the machine
Decides to forwards the data to the next hop, it updates the Mac header
so between machine B and machine C
the Mac header will be the MAC address of the machine B and MAC address of the machine C and in between machine C and
Machine D, the MAC address would be the MAC address of the machine C and the MAC address of the machine D
So MAC address keeps on changing
Hop by hop. We will formally study all this process in detail
When we will be learning L2 routing and L3 routing in the subsequent modules
So going forward let us summarize the layer functions
That is the function of each layer in the tcp/ip stack
So as you know that the transport layer encodes only
The application identities which are communicating with each other
Therefore transport layer has the responsibility of process to process delivery
Transport layer knows about the receiving process as well as sending process, but transport layer do not know that
Application 2 is running on which machine in the network
You can see that in the transport header we encode only the process information
We do not encode about the machine information
that is we do not encode the any identity of machine D or machine A
Similarly the role of the network layer is to
deliver the data packet from source machine to destination machine. network layer knows nothing about
App 2
But network layer knows that
what is the destination machine and
What is the next hop to reach D.
So this information
Comes from the network layer, but network layer is not aware that on a destination machine D, which is the process
to communicate that is app 2
So you can see that in the network layer header. We encode only the source machine and destination machine identity
And next comes the data link layer, which is responsible for hop by hop traversal of a packet
the data link layer knows only the information about next hop
the data link layer do not know anything about
The receiving process or sending process that is APP 2 or APP 1 and the data link layer
Do not know that where the packet is eventually destined for. so you can see that each layer in the tcp/ip
stack has its own share of interest has its own share of
information which is used
In taking the packet, which is used
in actually setting up the communication between
application 1 and application 2
So all these layers combine their information put together and use the information
Intelligently to make the communication possible between the processes running on different machines in the network. So
Going forward let us summarize the
Data encapsulation and decapsulation concepts. So each layer has its own well-defined functions to perform
all layers of the tcp/ip stack work closely to make the packet journey happen from application 1 to application 2
The responsibilities of each layer is well-defined and isolated from each other
Each layer hides its own information which is abstracted away from the layer above and below it.
For Example the network layer doesn't need to know anything about app 2
Or network layer knows that which is a source machine and destination machine. it do not know that
What application process are trying to communicate and also the network layer do not know anything about
the mac layer info of
next hop.
to illustrate this
That is the network layer knows that the next hop
Machine is B. But what is the MAC address of machine B? That information
Network layer do not know. The network layer relies on data link layer to know the MAC address of the machine B
Now when you will be learning l 3 routing and L 2 routing combined together, you will know that
Why would you need Mac layer information of the next hop machine.
So let us discuss some terminologies here
When the application generates a data, that piece of data is actually called data
When that data is passed to the transport layer, we call that piece of data as segment
when segment is passed to the network layer, we called that chunk of data as packet and
When the packet is handed over to the data link layer, then we call that chunk of data as frame
So you can see that these are the different terminologies that is used at different layers of the tcp/ip stack
If somebody tells you a frame it means that he is talking about the data link layer
if somebody is talking you about the
Segment it means that he is talking about the segment
he is talking about the transport layer and
Eventually when the data is placed on the wire we just refer to that data as bits
Right. So I hope the terminology is very much clear