Data Encapsulation
When a host transmits
data across a network to another device, the data goes through encapsulation:
it is wrapped with protocol information at each layer of the OSI model. Each
layer communicates only with its peer layer on the receiving device. To
communicate and exchange information, each layer uses Protocol Data Units
(PDUs). These hold the control information attached to the data at each layer
of the model. They are usually attached to the header in front of the data
field but can also be in the trailer, or end, of it. Each PDU is attached to
the data by encapsulating it at each layer of the OSI model, and each has a
specific name depending on the information provided in each header. This PDU
information is read only by the peer layer on the receiving device. After it’s
read, it’s stripped off, and the data is then handed to the next layer up.
Fig. 10 shows the PDUs
and how they attach control information to each layer. This figure demonstrates
how the upper-layer user data is converted for transmission on the network. The
data stream is then handed down to the Transport layer, which sets up a virtual
circuit to the receiving device by sending over a synch packet. Next, the data
stream is broken up into smaller pieces, and a Transport layer header (a PDU)
is created and attached to the header of the data field; now the piece of data
is called a segment. Each segment is sequenced so the data stream can be put
back together on the receiving side exactly as it was transmitted.
Fig - 10
Each segment is then
handed to the Network layer for network addressing and routing through the
internetwork. Logical addressing (for example, IP) is used to get each segment
to the correct network. The Network layer protocol adds a control header to the
segment handed down from the Transport layer, and what we have now is called a
packet or datagram. Remember that the Transport and Network layers work
together to rebuild a data stream on a receiving host, but it’s not part of
their work to place their PDUs on a local network segment—which is the only way
to get the information to a router or host.
Data Link layer is
responsible for taking packets from the Network layer and placing them on the
network medium (cable or wireless). The Data Link layer encapsulates each
packet in a frame, and the frame’s header carries the hardware address of the
source and destination hosts. If the destination device is on a remote network,
then the frame is sent to a router to be routed through an internetwork. Once
it gets to the destination network, a new frame is used to get the packet to
the destination host.
To put this frame on
the network, it must first be put into a digital signal. Since a frame is
really a logical group of 1s and 0s, the Physical layer is responsible for
encoding these digits into a digital signal, which is read by devices on the
same local network. The receiving devices will synchronize on the digital
signal and extract (decode) the 1s and 0s from the digital signal. At this point
the devices build the frames, run a CRC, and then check their answer against
the answer in the frame’s FCS field. If it matches, the packet is pulled from
the frame, and what’s left of the frame is discarded. This process is called
de-encapsulation. The packet is handed to the Network layer, where the address
is checked. If the address matches, the segment is pulled from the packet, and
what’s left of the packet is discarded. The segment is processed at the
Transport layer, which rebuilds the data stream and acknowledges to the
transmitting station that it received each piece. It then happily hands the
data stream to the upper-layer application.
Once the Transport
layer header information is added to the piece of data, it becomes a segment
and is handed down to the Network layer, along with the destination IP address.
The Network layer adds
a header, and adds the logical addressing (IP addresses), to the front of each
segment. The packet also has a protocol field that describes where it came from
(either UDP or TCP). This lets the Network layer hand the segment to the
correct protocol at the Transport layer when the packet reaches the receiving
host. It also has a protocol field that describes where it came from (either
UDP or TCP), so it can hand it to the correct protocol at the Transport layer
when it reaches the receiving host. The Network layer is responsible for
finding the destination hardware address that dictates where the packet should
be sent on the local network. It does this by using the Address Resolution
Protocol (ARP). IP at the Network layer looks at the destination IP address and
compares that address to its own source IP address and subnet mask. If it turns
out to be a local network request, the hardware address of the local host is
requested via an ARP request. It the packet is destined for a remote host, IP
will look for the IP address of the default gateway (router) instead.
The packet, along with
the destination hardware address of either the local host or default gateway,
is then handed down to the Data Link layer. The Data Link layer will add a
header to the front of the packet and the piece of data then becomes a frame.
This is shown on Fig. 11.
Fig - 11
The frame uses an
Ether-Type field to describe which protocol the packet came from at the Network
layer. Now, a cyclic redundancy check (CRC) is run on the frame, and the answer
to the CRC is placed in the Frame Check Sequence field found in the trailer of
the frame. The Frame is now ready to be handed down, one bit at a time, to the
Physical layer, which will use bit timing rules to encode the data in a digital
signal. Every device on the network segment will synchronize with the clock and
extract the 1s and 0s from the digital signal and build a frame. After the
frame is rebuilt, a CRC is run to make sure the frame is OK. If everything
turns out to be all good, the hosts will check the destination address to see
if the frame is for them.
No comments:
Post a Comment