so next, let us see what happens
during data de-capsulation on machine D
which is a receiving machine
so,
the packet that was generated by the machine A
will be routed by the machine B
By the machine C and let us assume that
the packet eventually reaches the destination machine D
so, how TCP/IP stack
on machine D performs data decapsulation
let us see
so machine D picks up the data from the wire
that is it is data link layer which picks up the
data from the wire
or physical link
so you can see the data is read as it is
so MAC header contains the Mac address of machine C
and the MAC address of the machine D.
Just remember the data link layer always work
between adjacent nodes.
so machine D will eventually receives the data
from machine C and therefore
the MAC addresses specified in the MAC header
is the MAC address of the machine C and the
MAC address of machine D
you will understand the process
by virtue of which the content of the MAC
header keeps on changing between
adjacent machines. that is hop by hop
when we will be learning L2 routing
so anyways, once the data link layer
picks up the data, it detaches
its own header called MAC header and passes
the rest of the message to the layer running above it
that is the network layer. the network layer
does the same thing. It detaches its own header
and passes the rest of the message to the
layer running above it that is the transport layer.
transport layer knows that the message
has to be delivered to the application
APP 2 running on the destination machine D
remember that machine D is
some machine which could have multiple applications running
so the transport layer needs to know that
out of those many applications which appilcation
is interested in receiving this data.
and therefore it was required to
encode the identity of the receiving
application in the transport header
by the machine A
so transport layer eventually
shifts or handover the original
application data to the application
APP 2
so APP 2 eventually receives the data
so this is the entire cycle of data
encapsulation and data de-capsulation
now, let us see what happens
on intermediate machine that is the machine B
and machine C
we have studies that data encapsulation process
happening on the machine A which is the sending machine
and we have studied the data de capsulation process
happening on the
receiving machine that is the destination machine.
But, the TCP/IP stack
of indeterminate machine B and C
also plays some role in forwarding the data
so let us see what happens in the TCP/IP stack
with respect to machine B and machine C
which are neither sending machine nor receiving machine
but they are forwarding machines.