3. Introduction
Dr. K. Adisesha
3
Data-link Layer:
Data Link Layer is second layer of OSI Layered Model. This layer is one of the most
complicated layers and has complex functionalities and liabilities.
➢ Data link layer hides the details of underlying hardware and represents itself to upper
layer as the medium to communicate.
➢ Data link layer is responsible for converting data stream to signals bit by bit and to
send that over the underlying hardware.
4. Introduction
Dr. K. Adisesha
4
Data-link Layer:
The work of data link layer tends to get more complex when it is dealing with multiple
hosts on single collision domain.
➢ Data link layer has two sub-layers:
❖ Logical Link Control: It deals with protocols, flow-control, and error control
❖ Media Access Control: It deals with actual control of media
5. Data-link Layer
Dr. K. Adisesha
5
Logical link control (LLC) sub layer:
The LLC layer comes above the MAC layer and acts as an interface between the upper
layers and the MAC layer.
➢ The main functionality of the LLC layer is that it multiplexes the protocols over the
MAC layer while sending and de-multiplex the protocols while receiving.
➢ This layer controls the flow control.
➢ The error-checking of the data link layer is performed by LLC. It can also track the
acknowledgments.
➢ While transmitting data, if LLC detects any frame loss, immediately it sends back to
the source to transmit over again.
6. Data-link Layer
Dr. K. Adisesha
6
Medium access control (MAC) sub layer:
This layer acts as an interface between the physical layer and the LLC layer in the OSI
model.
➢ The main responsibility of the MAC layer is that it encapsulates the frames during
transmission so that, whether they are suitable.
➢ The MAC layer identifies and verifies the address of source stations and destinations.
➢ MAC layer performs multiple access resolution when there are more data frames.
➢ MAC layer coordinates with the physical layer to seize a shared channel by using
multiple MAC entities to avoid collisions.
➢ It is used as a network address for data transmission within a network segment like
Ethernet, Wi-Fi, and Bluetooth.
7. Data-link Layer
Dr. K. Adisesha
7
Functionality of Data-link Layer:
Data link layer does many tasks on behalf of upper layer. These are:.
➢ Framing
➢ Addressing
➢ Synchronization
➢ Error Control
➢ Flow Control
➢ Multi-Access
8. Data-link Layer
Dr. K. Adisesha
8
Functionality of Data-link Layer:
Data link layer does many tasks on behalf of upper layer. These are:.
➢ Framing: Data-link layer takes packets from Network Layer and encapsulates them
into Frames. Then, it sends each frame bit-by-bit on the hardware. At receiver’ end,
data link layer picks up signals from hardware and assembles them into frames.
➢ Addressing: Data-link layer provides layer-2 hardware addressing mechanism.
Hardware address is assumed to be unique on the link. It is encoded into hardware at
the time of manufacturing.
➢ Synchronization: When data frames are sent on the link, both machines must be
synchronized in order to transfer to take place.
9. Data-link Layer
Dr. K. Adisesha
9
Functionality of Data-link Layer:
Data link layer does many tasks on behalf of upper layer. These are:.
➢ Error Control: Sometimes signals may have encountered problem in transition and the
bits are flipped. These errors are detected and attempted to recover actual data bits. It
also provides error reporting mechanism to the sender.
➢ Flow Control: Stations on same link may have different speed or capacity. Data-link
layer ensures flow control that enables both machine to exchange data on same speed.
➢ Multi-Access: When host on the shared link tries to transfer the data, it has a high
probability of collision. Data-link layer provides mechanism such as CSMA/CD to
equip capability of accessing a shared media among multiple Systems.
10. Data-link Layer
Dr. K. Adisesha
10
Framing in Data Link Layer:
Frames are the units of digital transmission, particularly in computer networks and
telecommunications.
➢ Framing is a point-to-point connection between two computers or devices consisting of
a wire in which data is transmitted as a stream of bits.
➢ Frame is continuously used in Time Division Multiplexing process.
➢ A frame has the following parts −
❖ Frame Header − It contains the source and the destination
addresses of the frame.
❖ Payload field − It contains the message to be delivered.
❖ Trailer − It contains the error detection and error correction bits.
❖ Flag − It marks the beginning and end of the frame.
11. Data-link Layer
Dr. K. Adisesha
11
Framing in Data Link Layer:
Frames are the units of digital transmission, particularly in computer networks and
telecommunications.
➢ Framing can be of two types.
➢ Fixed-size: The frame is of fixed size and there is no need to provide boundaries to the
frame, the length of the frame itself acts as a delimiter.
➢ Variable size: In this, there is a need to define the end of the frame as well as the
beginning of the next frame to distinguish. This can be done in two ways:
❖ Length field – We can introduce a length field in the frame to indicate the length of the
frame. Used in Ethernet(802.3).
❖ End Delimiter (ED) – We can introduce an ED(pattern) to indicate the end of the frame.
Used in Token Ring.
12. Data-link Layer
Dr. K. Adisesha
12
Methods of Framing:
Frames are generally data unit of data link layer that is transmitted or transferred
among various network points.
➢ There are basically four methods of framing as given below –
❖ Character Count
❖ Flag Byte with Character Stuffing
❖ Starting and Ending Flags, with Bit Stuffing
❖ Encoding Violations
13. Data-link Layer
Dr. K. Adisesha
13
Link-layer Addressing:
A link-layer address is called a link address, called a physical address, and sometimes a
MAC address.
➢ When a datagram passes from the network layer to the data-link layer, the datagram
will be encapsulated in a frame and two data-link addresses are added to the frame
header.
➢ These two addresses are changed every time the frame moves from one link to another.
14. Data-link Layer
Dr. K. Adisesha
14
Format of MAC Address:
MAC Address is a 12-digit hexadecimal number (6-bit binary number), which is mostly
represented by Colon-Hexadecimal notation.
➢ The First 6 digits (say 00:40:96) of the MAC Address identify the manufacturer, called
the OUI (Organizational Unique Identifier).
➢ IEEE Registration Authority Committee assigns these MAC prefixes to its registered
vendors.
➢ Here are some OUI of well-known manufacturers:.
❖ CC:46:D6 - Cisco
❖ 3C:5A:B4 - Google, Inc.
❖ 3C:D9:2B - Hewlett Packard
❖ 00:9A:CD - HUAWEI TECHNOLOGIES CO.,LTD
15. Data-link Layer
Dr. K. Adisesha
15
Format of MAC Address:
MAC Address is a 12-digit hexadecimal number (6-bit binary number), which is mostly
represented by Colon-Hexadecimal notation.
➢ Types of MAC Address
❖ Unicast: A Unicast-addressed frame is only sent out to the
interface leading to a specific NIC.
❖ If the LSB (least significant bit) of the first octet of an
address is set to zero, the frame is meant to reach only one
receiving NIC.
❖ The MAC Address of the source machine is always
Unicast.
16. Data-link Layer
Dr. K. Adisesha
16
Format of MAC Address:
MAC Address is a 12-digit hexadecimal number (6-bit binary number), which is mostly
represented by Colon-Hexadecimal notation.
➢ Types of MAC Address
❖ Multicast: The multicast address allows the source to
send a frame to a group of devices.
❖ In Layer-2 (Ethernet) Multicast address, the LSB (least
significant bit) of the first octet of an address is set to
one.
❖ IEEE has allocated the address block 01-80-C2-xx-xx-xx
(01-80-C2-00-00-00 to 01-80-C2-FF-FF-FF) for group
addresses for use by standard protocols.
17. Data-link Layer
Dr. K. Adisesha
17
Format of MAC Address:
MAC Address is a 12-digit hexadecimal number (6-bit binary number), which is mostly
represented by Colon-Hexadecimal notation.
➢ Types of MAC Address
❖ Broadcast: Similar to Network Layer, Broadcast is also
possible on the underlying layer( Data Link Layer).
❖ Ethernet frames with ones in all bits of the destination address
(FF-FF-FF-FF-FF-FF) are referred to as the broadcast
addresses.
❖ Frames that are destined with MAC address FF-FF-FF-FF-FF-
FF will reach every computer belonging to that LAN segment.
18. Data-link Layer
Dr. K. Adisesha
18
Error Detection & Correction:
Data-link layer uses some error control mechanism to ensure that frames (data bit
streams) are transmitted with certain level of accuracy.
➢ There are many reasons such as noise, cross-talk etc., which may help data to get
corrupted during transmission.
➢ The upper layers work on some generalized view of network architecture and are not
aware of actual hardware data processing.
➢ Applications such as voice and video may not be that affected and with some errors
they may still function well.
➢ To understand how errors is controlled, it is essential to know what types of errors may
occur.
19. Error Detection & Correction
Dr. K. Adisesha
19
Error Detection:
Data-link layer uses some error control mechanism to ensure that frames (data bit
streams) are transmitted with certain level of accuracy.
➢ When data is transmitted from one device to another device, the system does not
guarantee whether the data received by the device is identical to the data transmitted by
another device.
➢ An Error is a situation when the message received at the receiver end is not identical to
the message transmitted.
➢ Errors can be classified into two categories:
❖ Single-Bit Error
❖ Burst Error
20. Error Detection & Correction
Dr. K. Adisesha
20
Types Of Errors:
Single-Bit Error:
➢ Single-Bit Error does not appear more likely in Serial Data Transmission mainly
occurs in Parallel Data Transmission.
➢ The only one bit of a given data unit is changed from 1 to 0 or from 0 to 1.
➢ For example, if eight wires are used to send the eight bits of a byte, if one of the wire is
noisy, then single-bit is corrupted per byte.
21. Error Detection & Correction
Dr. K. Adisesha
21
Types Of Errors:
Burst Error:
➢ Burst Errors are most likely to occur in Serial Data Transmission.
➢ The two or more bits are changed from 0 to 1 or from 1 to 0 is known as Burst Error.
➢ The Burst Error is determined from the first corrupted bit to the last corrupted bit.
➢ The number of affected bits depends on the duration of the noise and data rate..
22. Error Detection & Correction
Dr. K. Adisesha
22
Error Detecting Techniques:
Errors in the received frames are detected by means of Parity Check and Cyclic
Redundancy Check (CRC).
➢ In both cases, few extra bits are sent along with actual data to confirm that bits
received at other end are same as they were sent.
➢ The most popular Error Detecting Techniques are:
❖ Single Parity Check
❖ Two-dimensional Parity Check
❖ Checksum
❖ Cyclic Redundancy Check
23. Error Detection & Correction
Dr. K. Adisesha
23
Error Detecting Techniques:
Errors in the received frames are detected by means of Parity Check and Cyclic
Redundancy Check (CRC).
➢ In both cases, few extra bits are sent along with actual data to confirm that bits
received at other end are same as they were sent.
➢ The most popular Error Detecting Techniques are:
❖ Single Parity Check
❖ Two-dimensional Parity Check
❖ Checksum
❖ Cyclic Redundancy Check
24. Error Detection & Correction
Dr. K. Adisesha
24
Error Detecting Techniques:
Parity Check: One extra bit is sent along with the original bits to make number of 1s
either even in case of even parity, or odd in case of odd parity. .
➢ Single Parity Check: Single Parity checking is the simple mechanism and inexpensive
to detect the errors.
➢ If the number of 1s bits is odd, then parity bit 1 is appended and if the number of 1s
bits is even, then parity bit 0 is appended at the end of the data unit.
➢ At the receiving end, the parity bit is calculated from the received data bits and
compared with the received parity bit.
➢ This technique generates the total number of 1s even, so it is known as even-parity
checking.
25. Error Detection & Correction
Dr. K. Adisesha
25
Error Detecting Techniques:
Parity Check: One extra bit is sent along with the original bits to make number of 1s
either even in case of even parity, or odd in case of odd parity.
➢ Single Parity Check: Single Parity checking is the simple mechanism and inexpensive
to detect the errors.
➢ Drawbacks of Single Parity Checking
❖ It can only detect single-bit errors which are very
rare.
❖ If two bits are interchanged, then it cannot detect
the errors.
26. Error Detection & Correction
Dr. K. Adisesha
26
Error Detecting Techniques:
Two-Dimensional Parity Check: Performance can be improved by using Two-
Dimensional Parity Check which organizes the data in the form of a table.
➢ Parity check bits are computed for each row, which is equivalent to the single-parity
check.
➢ In Two-Dimensional Parity check, a block of bits is
divided into rows, and the redundant row of bits is added
to the whole block.
➢ At the receiving end, the parity bits are compared with
the parity bits computed from the received data.
27. Error Detection & Correction
Dr. K. Adisesha
27
Error Detecting Techniques:
Checksum: A Checksum is an error detection technique based on the concept of
redundancy.
➢ It is divided into two parts:
➢ Checksum Generator: A Checksum
is generated at the sending side.
➢ Checksum Checker: A Checksum is
verified at the receiving side.
28. Error Detection & Correction
Dr. K. Adisesha
28
Error Detecting Techniques:
Checksum: A Checksum is an error detection technique based on the concept of
redundancy.
➢ Checksum Generator: A Checksum is generated at the sending side.
❖ Checksum generator subdivides the data into equal segments of n bits each, and all these
segments are added together by using one's complement arithmetic.
❖ The sum is complemented and appended to the original data, known as checksum field.
❖ The extended data is transmitted across the network.
➢ Checksum Checker: A Checksum is verified at the receiving side.
❖ The receiver subdivides the incoming data into equal segments of n bits each, and all these
segments are added together, and then this sum is complemented.
❖ If the complement of the sum is zero, then the data is accepted otherwise data is rejected.
29. Error Detection & Correction
Dr. K. Adisesha
29
Error Detecting Techniques:
Cyclic Redundancy Check (CRC): This technique involves binary division of the data
bits being sent. The divisor is generated using polynomials.
➢ The sender performs a division operation on the bits being sent
and calculates the remainder.
➢ Before sending the actual bits, the sender adds the remainder at
the end of the actual bits.
➢ Actual data bits plus the remainder is called a codeword.
➢ The sender transmits data bits as codewords.
➢ the receiver performs division operation on codewords using the
same CRC divisor.
➢ If the remainder contains all zeros the data bits are accepted
otherwise rejected.
30. Error Detection & Correction
Dr. K. Adisesha
30
Error Correction:
Error Correction codes are used to detect and correct the errors when data is
transmitted from the sender to the receiver.
➢ For correcting the errors, one has to know the exact position of the error. To achieve
this, we have to add some additional redundant bits.
➢ Error Correction can be handled in two ways:
❖ Backward error correction: Once the error is discovered, the receiver requests the
sender to retransmit the entire data unit.
❖ Forward error correction: In this case, the receiver uses the error-correcting code
which automatically corrects the errors.
31. Error Detection & Correction
Dr. K. Adisesha
31
Error Correction:
Hamming code which can be applied to any length of the data unit and uses the
relationship between data units and redundant units.
➢ To determine the position of the bit which is in error, a technique developed by R.W
Hamming is used.
➢ Algorithm of Hamming code:
❖ An information of 'd' bits are added to the redundant bits 'r' to form d+r.
❖ The location of each of the (d+r) digits is assigned a decimal value.
❖ The 'r' bits are placed in the positions 1,2,.....2k-1.
❖ At the receiving end, the parity bits are recalculated. The decimal value of the
parity bits determines the position of an error.
32. Error Detection & Correction
Dr. K. Adisesha
32
Error Correction:
Determining the position of the redundant bits:
➢ Let's understand the concept of Hamming code through an example:
➢ Suppose the original data is 1010 which is to be sent.
❖ Total number of data bits 'd' = 4
❖ Number of redundant bits r : 2r >= d+r+1
2r>= 4+r+1
❖ Therefore, the value of r is 3 that satisfies the above relation.
❖ Total number of bits = d+r = 4+3 = 7;.
▪ The position of r1 = 1, 3, 5, 7.
▪ The position of r2 = 2, 3, 6, 7
▪ The position of r4 = 4, 5, 6, 7
33. Data Link Controls
Dr. K. Adisesha
33
Error Correction:
Data Link Control is the service provided by the Data Link Layer to provide reliable
data transfer over the physical medium.
➢ The Data link layer provides the coordination among the devices so that no collision
occurs.
➢ The Data link layer provides three functions:
❖ Line discipline
❖ Flow Control
❖ Error Control
34. Data Link Controls
Dr. K. Adisesha
34
Line Discipline in Data Link Layer:
Line Discipline is a functionality of the Data link layer that provides the coordination
among the link systems. It determines which device can send, and when it can send the
data.
➢ Line Discipline can be achieved in two ways:
❖ ENQ/ACK: Stands for Enquiry/Acknowledgement is used when there is no wrong
receiver available on the link and having a dedicated path between the two devices.
❖ Poll/select: The Poll/Select method of line discipline works with those topologies
where one device is designated as a primary station, and other devices are
secondary stations.
35. Data Link Controls
Dr. K. Adisesha
35
Enquiry/Acknowledgement :
END/ACK coordinates which device will start the transmission and whether the
recipient is ready or not.
➢ If the response to the ENQ is positive, the sender
will transmit its data, and once all of its data has
been transmitted, the device finishes its
transmission with an EOT (END-of-
Transmission) frame.
➢ If the response to the ENQ is negative, then the
sender disconnects and restarts the transmission at
another time.
36. Data Link Controls
Dr. K. Adisesha
36
Poll/select in Data Link Layer:
The Poll/Select method of line discipline works with those topologies where one device
is designated as a primary station, and other devices are secondary stations.
➢ In this, the primary device and multiple secondary
devices consist of a single transmission line, and all
the exchanges are made through the primary device.
➢ The primary device has control over the
communication link, and the secondary device
follows the instructions of the primary device.
➢ The select mode is used when the primary device
has something to send.
37. Data Link Controls
Dr. K. Adisesha
37
Flow Control in Data Link Layer:
Flow control in Data Link Layer simply restricts and coordinates number of frames or
amount of data sender can send just before it waits for an acknowledgement from
receiver.
➢ It is a set of procedures that tells the sender how much data it can transmit before the
data overwhelms the receiver.
➢ Flow control can also be understand as a speed matching mechanism for two stations.
➢ Flow Control is classified into two categories:
❖ Feedback – based Flow Control: This is used in the data link layer.
❖ Rate – based Flow Control: This is used in the network layer and the transport
layer.
38. Data Link Controls
Dr. K. Adisesha
38
Feedback – based Flow Control:
Feedback based Flow Control In these protocols, the sender sends frames after it has
received acknowledgments from the user.
➢ This is used in the data link layer.
➢ Data link layer uses feedback based flow control mechanisms. There are two main
techniques.
➢ Two methods have been developed to control the flow of data:
❖ Stop-and-wait: In the Stop-and-wait method, the sender waits for an
acknowledgement after every frame it sends.
❖ Sliding window: The Sliding Window is a method of flow control in which a
sender can transmit the several frames before getting an acknowledgement.
39. Data Link Controls
Dr. K. Adisesha
39
Error Control in Data Link Layer:
Error control in data link layer is the process of detecting and correcting data frames
that have been corrupted or lost during transmission.
➢ The error control mechanism in data link layer involves the following phases −
❖ Detection of Error − Transmission error, if any, is
detected by either the sender or the receiver.
❖ Acknowledgment − acknowledgment may be positive or
negative.
➢ Categories of Error Control:
❖ Stop and Wait ARQ
❖ Go-Back-N ARQ
❖ Selective Repeat ARQ