0% found this document useful (0 votes)
4 views

unit-2

The data link layer of the OSI model is responsible for converting raw transmission into reliable links, managing tasks such as framing, physical addressing, flow control, error control, and access control. It consists of two sub-layers: Logical Link Control (LLC) and Media Access Control (MAC), each handling specific functions related to data transmission and error detection. Protocols like HDLC and PPP operate at this layer, providing mechanisms for data framing, error detection, and establishing connections between devices.

Uploaded by

gargh403
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

unit-2

The data link layer of the OSI model is responsible for converting raw transmission into reliable links, managing tasks such as framing, physical addressing, flow control, error control, and access control. It consists of two sub-layers: Logical Link Control (LLC) and Media Access Control (MAC), each handling specific functions related to data transmission and error detection. Protocols like HDLC and PPP operate at this layer, providing mechanisms for data framing, error detection, and establishing connections between devices.

Uploaded by

gargh403
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 54

Data Link Layer

The data link layer in the OSI (Open System


Interconnections) Model, is in between the
physical layer and the network layer. This layer
converts the raw transmission facility provided
by the physical layer to a reliable and error-free
link.

1
Responsibilities of the data link layer
Responsibilities of the data link layer include the following:

• Framing- The data link layer divides the stream of bits received from the
network layer into manageable data units called frames.
• Physical addressing- If frames are to be distributed to different systems on
the network, the data link layer adds a header to the frame to define the
sender and/or receiver of the frame. If the frame is intended for a system
outside the sender's network, the receiver address is the address of the
device that connects the network to the next one.
• Flow control- If the rate at which the data are absorbed by the receiver is
less than the rate at which data are produced in the sender, the data link
layer imposes a flow control mechanism to avoid overwhelming the
receiver.
• Error control- The data link layer adds reliability to the physical layer by
adding mechanisms to detect and retransmit damaged or lost frames. It
also uses a mechanism to recognize duplicate frames. Error control is
normally achieved through a trailer added to the end of the frame.
• Access control- When two or more devices are connected to the same
link, data link layer protocols are necessary to determine which device has
control over the link at any given time.
2
Data Link Layer
The data link layer is divided into two sub-layers :

Logical Link Control Sub-layer (LLC)

Provides the logic for the data link, Thus it controls the synchronization, flow control, and error checking functions of
the data link layer. Functions are –

(i) Error Recovery.


(ii) It performs the flow control operations.
(iii) User addressing.

Media Access Control Sub-layer (MAC)

It is the second sub-layer of data-link layer. It controls the flow and multiplexing for transmission medium. Transmission
of data packets is controlled by this layer. This layer is responsible for sending the data over the network interface card.
Functions are –

(i) To perform the control of access to media.


(ii) It performs the unique addressing to stations directly connected to LAN.
(iii) Detection of errors.

3
Data Link Layer Protocols(DLL)
• Synchronous Data Link Protocol (SDLC): SDLC is a protocol for transmitting
synchronous, code-transparent, serial-by-bit data across a
communications line.
• High-Level Data Link Protocol (HDLC): HDLC is a series of data link layer
communication protocols for sending data between network points or
nodes.
• Serial Line Interface Protocol (SLIP): SLIP is an Internet protocol that
allows users to connect to the Internet via a computer modem.
• Point to Point Protocol (PPP): PPP is used to connect two computer
systems. Computers use PPP to communicate through a telephone
network or the Internet.
• Link Control Protocol (LCP): LCP is a component of (PPP) that is in charge
of establishing, configuring, testing, managing, and terminating
transmission lines. It also imparts negotiation for option setup and
features used by the two endpoints of the links.
• Link Access Procedure (LAP): LAP protocols are Data Link Layer protocols
that are used to frame and transfer data via point-to-point lines.
• Network Control Protocol (NCP): NCP is a mechanism for establishing and
configuring various Network Layer protocols for Point-to-Point Protocol
(PPP) connections.

4
High-Level Data Link Control (HDLC)
• High-Level Data Link Control (HDLC) basically provides
reliable delivery of data frames over a network or
communication link.
• HDLC provides various operations such as framing, data
transparency, error detection, and correction, and even
flow control.
• HDLC (High-Level Data Link Control) is a bit-oriented
protocol that is used for communication over
the point-to-point and multipoint links.
• HDLC protocol implements the mechanism of
ARQ(Automatic Repeat Request). With the help of the
HDLC protocol,full-duplex communication is possible.
• HDLC is the most widely used protocol and offers
reliability, efficiency, and a high level of Flexibility.

5
Transfer Modes in HDLC
The HDLC protocol offers two modes of transfer
that mainly can be used in different
configurations. These are as follows:
• Normal Response Mode(NRM)
• Asynchronous Balance Mode(ABM)

6
Normal Response Mode(NRM)
• In this mode, there are one primary station and multiple secondary
stations. Where the primary station can send the commands and the
secondary station can only respond.
• This mode is used for both point-to-point as well as multiple-point links
works.

7
Asynchronous Balance Mode(ABM)
• In this mode, the link is point-to-point, and each station can function as a
primary as well as secondary.
• Asynchronous Balance mode(ABM) is a commonly used mode today.

8
HDLC Frames
• In order to provide the flexibility that is necessary to support all the
options possible in the modes and Configurations that are just
described above. There are three types of frames defined in the
HDLC:
• Information Frames(I-frames)
These frames are used to transport the user data and the control
information that is related to the user data. If the first bit of the
control field is 0 then it is identified as I-frame.
• Supervisory Frames(S-frames)
These frames are only used to transport the control information. If
the first two bits of the control field are 1 and 0 then the frame is
identified as S-frame
• Unnumbered Frames(U-Frames)
These frames are mainly reserved for system management. These
frames are used for exchanging control information between the
communicating devices.

9
HDLC Frames

10
Basic Frame Structure of HDLC I-Frame

11
Basic Frame Structure of HDLC I-Frame
Flag Field- This field of the HDLC frame is mainly a sequence of 8-bit
having the bit pattern 01111110 and it is used to identify the beginning
and end of the frame. The flag field mainly serves as a synchronization
pattern for the receiver.
Address Field- It is the second field of the HDLC frame and it mainly
contains the address of the secondary station. This field can be 1 byte or
several bytes long which mainly depends upon the need of the network.
In case if the frame is sent by the primary station, then this field contains
the address(es) of the secondary stations. If the frame is sent by the
secondary station, then this field contains the address of the primary
station.
Control Field- This is the third field of the HDLC frame and it is a 1 or 2-
byte segment of the frame and is mainly used for flow control and error
control. Bits interpretation in this field mainly depends upon the type of
the frame.
Information Field- This field of the HDLC frame contains the user's data
from the network layer or the management information. The length of
this field varies from one network to another.
FCS Field- FCS means Frame check sequence and it is the error detection
field in the HDLC protocol. There is a 16 bit CRC code for error detection.

12
Point to Point Protocol (PPP)
• Point to Point Protocol, in short, is commonly referred to as PPP.
• It is a data link layer protocol that resides in the Data Link Layer of the OSI
model.
• Point to Point Protocol is one of the communication protocols of the Data Link
Layer which transmits multiprotocol data between two directly connected
computers.
• It is a byte-oriented protocol that is widely employed in broadband
communications having quite heavy loads and high speeds.
• This protocol defines how two devices can authenticate with each other.
• PPP protocol also defines the format of the frames that are to be exchanged
between the devices.
• This protocol also defines how the data of the network layer are encapsulated
in the data link frame.
• This protocol also provides connection over multiple links.
• Point-to-Point Protocol (PPP) is a TCP/IP protocol that is used to connect one
computer system to another. Computers use PPP to communicate over the
telephone network or the Internet.
• A PPP connection exists when two systems physically connect through a
telephone line. You can use PPP to connect one system to another. For
example, an established PPP connection between a branch office and a central
office allows either office to transfer data to the other through the network.
13
Frame format of PPP protocol

14
Frame format of PPP protocol
• Flag: The flag field is used to indicate the start and end of the
frame. The flag field is a 1-byte field that appears at the beginning
and the ending of the frame. The pattern of the flag is similar to the
bit pattern in HDLC, i.e., 01111110.
• Address: It is a 1-byte field that contains the constant value which is
11111111. These 8 ones represent a broadcast message.
• Control: It is a 1-byte field which is set through the constant value,
i.e., 11000000. It is not a required field as PPP does not support the
flow control and a very limited error control mechanism.
Protocol: It is a 1 or 2 bytes field that defines what is to be carried
in the data field. The data can be a user data or other information.
• Payload: The payload field carries either user data or other
information. The maximum length of the payload field is 1500
bytes.
• FCS: It is a 16-bit field which is generally used for error detection.

15
PPP Stack
In PPP stack, there are three set of protocols:
• Link Control Protocol (LCP)
The role of LCP is to establish, maintain, configure, and
terminate the links.
• Authentication protocols
There are two types of authentication protocols, i.e., PAP
(Password Authenticate protocols), and CHAP (Challenged
Handshake Authentication Protocols).
• Network Control Protocol (NCP)
NCP allows the PPP link to support multiple network layer
protocols, such as Internet Protocol (IP), Internetwork
Packet Exchange (IPX)

16
How Authentication Protocol Works?
PAP (Password Authentication Protocols)

PAP is less secure as compared to CHAP as in case of PAP protocol, password


is sent in the form of a clear text. It is a two-step process. Suppose there are
two routers, i.e., router 1 and router 2. In the first step, the router 1 wants to
authenticate so it sends the username and password for the authentication.
In the second step, if the username and password are matched then the
router 2 will authenticate the router 1 otherwise the authentication failed.
17
How Authentication Protocol Works?

18
How Authentication Protocol Works?
• Step 1: Suppose there are two routers, i.e., router 1 and router 2. In this
step, router 1 sends the username but not the password to the router 2.
• Step 2: The router 2 maintains a database that contains a list of allowed
hosts with their login credentials. If no data is found which means that the
router 1 is not a valid host to connect with it and the connection gets
terminated. If the match is found then the random key is passed. This
random key along with the password is passed in the MD5 hashing
function, and the hashing function generates the hashed value from the
password and the random key (password + random key). The hashed value
is also known as Challenge. The challenge along with the random key will
be sent to the router 1.
• Step 3: The router 1 receives the hashed value and a random key from the
router 2. Then, the router 1 will pass the random key and locally stored
password to the MD5 hashing function. The MD5 hashing function
generates the hashed value from the combination of random key and
password. If the generated hashed value does not match with the received
hashed value then the connection gets terminated. If it is matched, then
the connection is granted. Based on the above authentication result, the
authentication signal that could be either accepted or rejected is sent to
the router 2.

19
Bitstuffing
Bit stuffing is the insertion of non information
bits into data. Note that stuffed bits should not
be confused with overhead bits.

20
Error Detection and Correction
An Error is a situation when the message
received at the receiver end is not identical to
the message transmitted.
Types of Errors
• Single-Bit Error
• Multiple-Bit Error
• Burst Error

21
Single Bit Error
The only one bit of a given data unit is changed
from 1 to 0 or from 0 to 1

22
Multiple-Bit Error

• More than one bit received in the frame is


found to be corrupted

23
Burst Error
• Two or more continious bits are changed
from 0 to 1 or from 1 to 0 is known as Burst
Error

24
Error Detection Methods
• Simple Parity Check
• Two-dimensional parity check
• Checksum
• CRC

25
Simple Parity Check
• Even parity: To check for even parity, if the total
number of 1s is even, then the value of the parity
bit is 0. If the total number of 1s occurrences is
odd, then the value of the parity bit is 1.
• Odd Parity: To check for odd parity, if the total
number of 1s is even, then the value of parity bit
is 1. If the total number of 1s is odd, then the
value of parity bit is 0.

26
Simple Parity Check
Even Parity

27
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.

28
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.
29
Two-Dimensional Parity Check

30
Drawbacks Of 2D Parity Check
• If two bits in one data unit are corrupted and
two bits exactly the same position in another
data unit are also corrupted, then 2D Parity
checker will not be able to detect the error.
• This technique cannot be used to detect the 4-
bit errors or more in some cases.

31
Checksum
Step-1: The data is split into k segments of m bits each
in the checksum error detection technique.
Step-2: To get the total, the segments are summed at
the sender’s end using 1’s complement arithmetic. To
obtain the checksum, a complement of the sum is
taken.
Step-3: The checksum segment is sent with the data
segments.
Step-4: To obtain the total, all received segments are
summed using 1’s complement arithmetic at the
receiver’s end. The sum is then calculated.
Step-5: If the result is 0, the data is accepted;
otherwise, it is rejected.
32
Checksum

33
Cyclic Redundancy Check (CRC)
Step-1: In CRC technique, a string of n 0s is appended to the
data unit, and this n number is less than the number of bits in
a predetermined number, known as divisior which is n+1 bits.
Step-2: Secondly, the newly extended data is divided by a
divisor using a process is known as binary division. The
remainder generated from this division is known as CRC
remainder.
Step-3: Thirdly, the CRC remainder replaces the appended 0s
at the end of the original data.
Step-4: This newly generated unit is sent to the receiver.
Step-5: The receiver receives the data followed by the CRC
remainder.
Step-6: The receiver will treat this whole unit as a single unit,
and it is divided by the same divisor that was used to find the
CRC remainder.

34
Cyclic Redundancy Check (CRC)

35
36
Error Correction
Error Correction codes are used to detect and
correct the errors when data is transmitted from
the sender to the receiver.
• 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.
37
Forward error correction by Hamming Code
Algorithm of Hamming code:
• Add ‘r’ redundant bit to the 'd' bits
information to make data as d+r using the
formula

• A decimal value will be assigned by the position


of each (d+r) digit.
• In positions the 'r' bits will
be placed.
• The parity bits are again calculated on the
receiver's end. The position of an error defines
the parity bit's decimal value.

38
Example
• Let's understand the concept of Hamming
code through an example:
• Suppose the original data is 1010 which is to
be sent.

39
Determining the position of the
redundant bits
The number of redundant bits is 3. The three bits are
represented by r1, r2, r4. The position of the redundant
bits is calculated with corresponds to the raised power
of 2. Therefore, their corresponding positions are 1, 21,
22.
Representation of Data on the addition of parity
bits:

40
Determining the Parity bits
Determining the r1 bit
• The r1 bit is calculated by performing a parity
check on the bit positions whose binary
representation includes 1 in the first position.

41
Determining r2 bit
• The r2 bit is calculated by performing a parity check on
the bit positions whose binary representation includes
1 in the second position.

• We observe from the above figure that the bit


positions that includes 1 in the second position are 2,
3, 6, 7. Now, we perform the even-parity check at these
bit positions. The total number of 1 at these bit
positions corresponding to r2 is odd, therefore, the
value of the r2 bit is 1.
42
Determining r4 bit
• The r4 bit is calculated by performing a parity check on
the bit positions whose binary representation includes
1 in the third position.

We observe from the above figure that the bit positions


that includes 1 in the third position are 4, 5, 6, 7. Now, we
perform the even-parity check at these bit positions. The
total number of 1 at these bit positions corresponding to
r4 is even, therefore, the value of the r4 bit is 0.

43
• Data transferred is given below:

Suppose the 4th bit is changed from 0 to 1 at the receiving end, then
parity bits are recalculated.

44
Parity check at Receiver End
R1 bit
he bit positions of the r1 bit are 1,3,5,7

We observe from the above figure that the binary


representation of r1 is 1100. Now, we perform the
even-parity check, the total number of 1s appearing
in the r1 bit is an even number. Therefore, the value
of r1 is 0.
45
R2 bit
• The bit positions of r2 bit are 2,3,6,7.

• We observe from the above figure that the


binary representation of r2 is 1001. Now, we
perform the even-parity check, the total
number of 1s appearing in the r2 bit is an
even number. Therefore, the value of r2 is 0.

46
R4 bit
The bit positions of r4 bit are 4,5,6,7.

We observe from the above figure that the binary


representation of r4 is 1011. Now, we perform the
even-parity check, the total number of 1s appearing in
the r4 bit is an odd number. Therefore, the value of r4
is 1.

47
Sliding Window Protocol
• The sliding window is a technique for sending
multiple frames at a time. It controls the data
packets between the two devices where reliable
and gradual delivery of data frames is needed. It
is also used in TCP (Transmission Control
Protocol).
• In this technique, each frame has sent from the
sequence number. The sequence numbers are
used to find the missing data in the receiver end.
The purpose of the sliding window technique is to
avoid duplicate data, so it uses the sequence
number.

48
49
Types of Sliding Window Protocol

Sliding window protocol has two types:


• Go-Back-N ARQ
• Selective Repeat ARQ

50
Go – Back – N ARQ

• Go – Back – N ARQ provides for sending


multiple frames before receiving the
acknowledgment for the first frame. It uses
the concept of sliding window, and so is also
called sliding window protocol. The frames are
sequentially numbered and a finite number of
frames are sent. If the acknowledgment of a
frame is not received within the time period,
all frames starting from that frame are
retransmitted.
51
52
Selective Repeat ARQ
• This protocol also provides for sending
multiple frames before receiving the
acknowledgment for the first frame. However,
here only the erroneous or lost frames are
retransmitted, while the good frames are
received and buffered.

53
54

You might also like