Data Link Layer in OSI Model
Data Link Layer in OSI Model
Department
Data Communication (SWEG2106)
Individual Assignment
Name: Meheretabe Abayneh
Id: ETS0912/16
Section: C
The data link layer is the second layer from the bottom in the OSI (Open System Interconnection)
network architecture model. It is responsible for the node-to-node delivery of data within the same local
network. Its primary role is to ensure error-free transmission of information. Data Link Layer is also
responsible for encoding, decoding, and organizing the outgoing and incoming data, plus may also
provide the means to detect and possibly correct errors that can occur in the physical layer.
This is considered the most complex layer of the OSI model as it hides all the underlying complexities of
the hardware from the other layers above.
It is concerned with the local delivery of frames between nodes on the same level of the network. Data-
link frames, as these protocol data units are called, do not cross the boundaries of a local area network.
Inter-network routing and global addressing are higher-layer functions, allowing data-link protocols to
focus on local delivery, addressing, and media arbitration. In this way, the data link layer is analogous to a
neighborhood traffic cop; it endeavors to arbitrate between parties contending for access to a medium,
without concern for their ultimate destination. When devices attempt to use a medium simultaneously,
frame collisions occur. Data-link protocols specify how devices detect and recover from such collisions,
and may provide mechanisms to reduce or prevent them.
And it uses various protocols operating at the data link layer, but the most common are Ethernet, Point-to-
point protocol (PPP), High-level data link control (HDLC)
Devices operating at the Data Link Layer include Switch , Bridge, Network Interface Card (NIC),
Wireless Access Point (WAP), and Layer 2 Switches
The data link layer is further divided into two sub-layers, which are as follows:
The uppermost sublayer, LLC, multiplexes protocols running at the top of the data link layer, frame
sequencing and synchronization, and optionally provides flow control, acknowledgment, and error
notification.
Multiplexing network protocol: the LLC enables multiple network layer protocols to exist over
the same physical medium by distinguishing between them. This is achieved through the use of
Service Access Points (SAPs), which help in directing data to the appropriate network protocol.
Flow control and Error management: it manages the pacing of data flow between devices to
prevent overwhelming receivers and implements error detection mechanisms to ensure data
integrity. This includes generating acknowledgments for received frames and notifying higher
layers of any detected errors.
Frame sequencing and synchronization: the LLC 7ensures that frames are properly sequenced
and synchronized, maintaining the correct order of data as it is transmitted and received.
This sublayer manages the device’s interaction, responsible for addressing frames, and also controls
physical media access. The data link layer receives the information in the form of packets from the
Network layer, it divides packets into frames and sends those frames bit-by-bit to the underlying physical
layer.
The Media Access Control sublayer also performs frame synchronization, which determines the start and
end of each frame of data in the transmission bitstream. It entails one of several methods: timing-based
detection, character counting, byte stuffing, and bit stuffing.
Character counting tracks the count of remaining characters in the frame header. This method,
however, is easily disturbed if this field is corrupted.
Byte stuffing precedes the frame with a special byte sequence such as DLE STX and succeeds it
with DLE ETX. Appearances of DLE (byte value 0x10) have to be escaped with another DLE. The
start and stop marks are detected at the receiver and removed, as well as the inserted DLE
characters.
Bit stuffing replaces these start and end marks with flags consisting of a special bit pattern (e.g., a
0, six 1 bits, and a 0). Occurrences of this bit pattern in the data to be transmitted are avoided by
inserting a bit. To use the example where the flag is 01111110, a 0 is inserted after 5 consecutive 1's
in the data stream. The flags and the inserted 0's are removed at the receiving end. This makes for
arbitrarily long frames and easy synchronization for the recipient. The stuffed bit is added even if
the following data bit is 0, which could not be mistaken for a sync sequence, so that the receiver can
unambiguously distinguish stuffed bits from regular bits.
Let’s delve deeper into the three types of media access control protocols:
1. Contended access. Also known as random access, this model involves multiple devices contending
for access to the communication channel. The first device to “speak” gets to transmit its data, and
others need to wait. For example, this method is often used in Ethernet networks. However, they
include mechanisms to handle data collisions that occur when two devices transmit simultaneously.
2. Controlled access. Popularly known as scheduled access, this model requires that devices follow a
predetermined schedule or sequence to access a communication channel. So, it’s a more organized
approach, preventing collisions and ensuring a fair distribution of access time.
3. Contention-free access: known as hybrid access, this protocol allows for a combination of
contended and controlled access methods. So, hybrid access provides a balance between efficiency
and organization. In this model, devices may contend for initial access, but once granted, they
follow a more structured approach.
Due to interference or network problems, the bits that are passed on the network are subject to being
altered. The altered bits lead to unauthentic data being transferred to the receiver. This situation, when the
information on the receiver’s side is not equal to the information sent by the sender, is called an error.
a. Single-Bit Error: - This is when only one of the bits of the data has been corrupted.
b. Burst Error: - If there are two or more bits that have been corrupted in the data, it is known as
a Burst Error. We determine the Burst Error from the bit that is first corrupted to the bit corrupted
at the last.
To avoid these errors, we use error-detecting techniques that help us in detecting if an error has occurred
during the message transmission.
This is one of the most basic among all the error detection techniques. By this method, all single-
bit errors that are there in the code word are detected.
In this technique, a redundant bit or also known as a parity bit, is added at the end of the data
where: - 1.
Therefore, the total number of 1’s becomes even, and that is the reason it is called even parity checking.
On the receiving end, the redundant bit is calculated from the data bits received and is compared
with the redundant bit that has been received. If the two values differ, it means an error has
occurred in the data bit, and that is how an error is detected in this process.
As mentioned above, only the single-bit errors can be detected, which are very rare.
If two bits (i.e., if the no. of bits changed is not odd) are corrupted, then it is not able to detect the
errors.
Two-dimensional parity check
Here, the data words (block of data) are arranged on one another like a 2-D matrix.
Parity bits for each row are calculated, which is similar to the simple parity check.
Redundant bits are calculated for all the columns too, then both are sent along with the original
data.
On the receiver’s side, the parity bits are checked with the parity bits calculated on the data that
has been received.
If two of the bits in a data unit get corrupted along with two bits that are exactly at the same
position in another data unit, then by this method we would not be able to detect the error.
4-bit errors or more (in some cases) cannot be detected using this approach.
2) Checksum
In this method, the data is divided into equal parts ‘k’, each of m bits.
On the side of the sender, these parts are divided by using the 1’s complement arithmetic to obtain
the sum. It complements the resulting sum to obtain the checksum.
This checksum is appended to the original data, and therefore the checksum segment or checksum
field is also sent along with the segment of the data.
When the segments are received, all the received segments are added along with the checksum by
using 1’s complement arithmetic to obtain the sum. The resulting sum is complemented.
If at the end we got zero as our result, the data received is accepted; otherwise, it is discarded.
As we can see from the above figure, the sender calculates the sum y using 1’s complement arithmetic, by
which they get the sum as ‘10001111’, which is complemented, and the result checksum becomes
‘01110000’. This checksum field is transmitted along the data segments as shown in the figure.
As we can observe from the above figure that when the transmitted bits (data segments + checksum) are
received, they are added using 1’s complement arithmetic. At the end, the resultant sum is complemented
and we get ‘0’, indicating that the data received is correct and has not been corrupted.
This is one of the most efficient and widely used error detection techniques. It is based on binary
division of the data bits by a divisor that is a predetermined number that is agreed upon by the
communication system.
Firstly, a string of 0’s is appended and the no. of 0’s appended is 1 less than the number of bits in
the Divisor OR if the predetermined number is in the form of a polynomial (can be converted into
a binary number), the no. of 0’s is equal to the degree of the polynomial.
Then, on the sender’s side, binary division is performed on the newly extended data by the
predetermined number.
Now, the remainder obtained from this division replaces the 0’s that were appended after the end
of the original data, and these bits are known as CRC bits (they are selected from the LSB of the
remainder).
This makes our final data to be sent exactly divisible by the predetermined number, and the
resulting data is sent to the receiver
For example: -
Let us say we have a data set of 100100. And we have the divisor as 1101 generated from the polynomial
given, i.e., x3+x2+1.
Now, we will have to append the original data with several 0s being 1 less than the number of bits in the
divisor. Here, there are 4 bits in the predetermined number. Therefore, the dividend is 100100000(i.e.,
100100 and 000) and the divisor is 1101.
We can see that our resulting data here becomes (message CRC bits) ‘100100001’
At the receiver’s side, the binary division is carried out on the received data by the predetermined
number. If, after dividing, we have no remainder, the receiver will accept this data. Otherwise, it
will discard the data (if the data was correct, it should have been divisible by the divisor).
For example: -
Let’s continue the previous example, we have ‘100100001’ as our incoming data. Let us see by dividing it
by 1101, which is the divisor that we have.
Here, we see that we have no remainder and therefore the data is not corrupted and it is in its original
form, and hence it will be accepted.
The Cyclic redundancy check can detect all odd errors, single bit errors, and burst errors of
length equal to the polynomial degree.
As we learned in the previous lesson, the first step in switches' operational logic is to receive an Ethernet
frame from the transmitting node. Depending on the type of switching methodology in use, the switch
needs to receive and examine a different number of bytes before going to the next operational step and
ultimately switch the frame to the outgoing port or ports. There are two main switching modes:
o Fragment-free switching
o Fast-forward switching
Store-and-Forward mode
Both switching modes base their forwarding decisions on the destination MAC address of the Ethernet
frames. They also learn MAC addresses and build their MAC tables as they examine the source MAC
address (SMAC) fields in the Ethernet header as frames are being forwarded. These switching modes
differ in how much of the frame must be received and examined by the switch before the frame starts
being forwarded out the egress port.
In this switching method, the frame has to be received entirely before a forwarding decision is made
based on destination MAC address lookup. Once received and buffered, the switch will compare the FCS
field of the frame against its frame-check-sequence (FCS) calculations to ensure the integrity and
correctness of the data. If the CRC values don't match, the frame is marked as invalid and dropped. If the
values match, the destination and the source MAC addresses are examined before the frame is forwarded.
This method creates higher latency than the other three and discards frames smaller than 64 bytes(runts)
and larger than 1518 bytes (giants) by default.
Cut-Through Switching
An Ethernet switch that uses cut-through switching can make a forwarding decision as soon as it gets the
first couple of bytes of the incoming frame. The switch does not have to wait for the rest of the frame to
start switching the frame to the outgoing port.
Fragment-Free Mode
Switches operating in this mode must receive and examine the first 64 bytes of the frame and then
make a forwarding decision. Why do they need exactly 64 bytes? In an Ethernet LAN, collision
fragments are detected in the first 64 bytes. This switching mode is no longer widely used these
days, so we only mention it for reference.
A cut-through switch can make a forwarding decision as soon as it gets the destination MAC
address of the frame, which means it needs only the first 6 bytes. It does not have to wait for the rest
of the Ethernet frame to make its forwarding decision.
Reference
Wikipedia - https://en.wikipedia.org/wiki/Data_link_layer?utm_source=chatgpt.com
Geeksforgeeks-https://www.geeksforgeeks.org/data-link-layer/?
utm_source=chatgpt.com
Medium - https://medium.com/%40ommranglani/understanding-the-sublayers-of-the-
data-link-layer-llc-and-mac-497f702de40e
Multitech-https://multitech.com/iot-wiki/media-access-control-mac/?
utm_source=chatgpt.com
Network Academy - https://www.networkacademy.io/ccna/ethernet/store-and-forward-
vs-cut-through-switching?utm_source=chatgpt.com