Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
14 views138 pages

CNS Unit 02 RBN

Cns

Uploaded by

sonidev0725
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views138 pages

CNS Unit 02 RBN

Cns

Uploaded by

sonidev0725
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 138

Prof. R. B.

Nawale
Asst. Professor
Dept. of Computer Engineering
Sinhgad College of Engineering, Pune 1
Computer Network and Security
T.E. Computer Engineering Semester I
Unit II
Data Link Layer

2
Data Link Layer
 The communication channel that connects the adjacent nodes is
known as links, and in order to move the datagram from source to the
destination, the datagram must be moved across an individual link.
 The main responsibility of the Data Link Layer is to transfer the
datagram across an individual link.
 The Data link layer protocol defines the format of the packet
exchanged across the nodes as well as the actions such as Error
detection, retransmission, flow control, and random access.
 The Data Link Layer protocols are Ethernet, token ring, FDDI and
PPP.
 An important characteristic of a Data Link Layer is that datagram
can be handled by different link layer protocols on different links in a
path. For example, the datagram is handled by Ethernet on the first
3
link, PPP on the second link.
Data Link Layer
Functions
 Framing & Link access:
• Data Link Layer protocols encapsulate each network frame within a Link layer frame before the
transmission across the link.
• A frame consists of a data field in which network layer datagram is inserted and a number of
data fields.
• It specifies the structure of the frame as well as a channel access protocol by which frame is to
be transmitted over the link.
Functions
 Reliable delivery: (hop to hop)
• Data Link Layer provides a reliable delivery service, i.e., transmits the network layer datagram
without any error.
• A data link layer mainly provides the reliable delivery service over the links as they have higher
error rates and they can be corrected locally, link at which an error occurs rather than forcing to
retransmit the data.
Functions
 Flow control: (stop and wait)
• A receiving node can receive the frames at
a faster rate than it can process the frame.
• Without flow control, the receiver's buffer
can overflow, and frames can get lost.
• To overcome this problem, the data link
layer uses the flow control to prevent the
sending node on one side of the link from
overwhelming the receiving node on
another side of the link.
Functions
 Error detection: (Parity Check, Checksum and Cyclic Redundancy Check (CRC))
• Errors can be introduced by signal attenuation and noise.
• Data Link Layer protocol provides a mechanism to detect one or more errors.
• This is achieved by adding error detection bits in the frame and then receiving node can
perform an error check.

 Error correction: (Hamming Codes)


• Error correction is similar to the Error detection, except that receiving node not only detect
the errors but also determine where the errors have occurred in the frame.

 Half-Duplex & Full-Duplex:


• In a Full-Duplex mode, both the nodes can transmit the data at the same time.
• In a Half-Duplex mode, only one node cPraofn.B.Rt.rBam
E,Piutnet-4
h1e data at the same time. 8
Data Link Layer -Sublayers
The two common sublayers are:

• Logical Link Control


Logical Link Control (LLC) places
information in the frame that identifies
which Network layer protocol is being
used for the frame. This information
allows multiple Layer 3 protocols, such as
IP and IPX, to utilize the same network
interface and media.

• Media Access Control


Media Access Control (MAC) provides
Data Link layer addressing and delimiting
of data according to the physical signaling
requirements of the medium and the type
of Data Link layer protocol in use. 9
Data Link Layer Design Issues
 The data link layer has a number of specific functions it can carry out. These functions include
1. Providing a well-defined service interface to the network layer.
2. Dealing with transmission errors.
3. Regulating the flow of data so that slow receivers are not swamped by fast senders.
 To accomplish these goals, the data link layer takes the packets it gets from the network layer and
encapsulates them into frames for transmission.
 Each frame contains a frame header, a payload field for holding the packet, and a frame trailer,
as illustrated in Fig.
Services Provided to the Network Layer

 The data link layer can be designed to offer various services.


 The actual services offered can vary from system to system.
 Three reasonable possibilities that are commonly provided are

1. Unacknowledged connectionless service.


2. Acknowledged connectionless service.
3. Acknowledged connection-oriented service
Services Provided to the Network Layer

 1. Unacknowledged connectionless service.

• Service consists of having the source machine send independent frames to the destination
machine without having the destination machine acknowledge them.
• No logical connection is established beforehand or released afterward.
• If a frame is lost due to noise on the line, no attempt is made to detect the loss or recover
from it in the data link layer.
• This class of service is appropriate when the error rate is very low so that recovery is left
to higher layers.
Services Provided to the Network Layer

 2. Acknowledged connectionless service.


• Service in which data frames are sent or transmitted from destination to source machine
with acknowledgment and without connection established among source and destination
machine.
• The source machine sends or transmits data frames to the destination machines and in
return, the destination machine provides an acknowledgment to the source machine, so
this service is known as acknowledged service.
• Along with this, there is no connection established between the source and destination
machine, therefore it is known as connectionless service
Services Provided to the Network Layer
 3. Acknowledged connection-oriented service.
• Service in which data frames are sent or transmitted from destination to source machine
with acknowledgment and connection established among source and destination machine
before any transmission of data.
• The source machine sends or transmits data frames to the destination machines and in
return, the destination machine provides an acknowledgment to the source machine, so
this service is known as acknowledged service.
• Along with this, there is a connection established between the source and destination
machine before any data transfer, therefore it is known as a connection-oriented service.
• It does not support any multicast or broadcast addressing. It only supports individual
addressing.
1. Flow control 2. Sequencing of data 3. Error indication and recovery 14
Framing
 Framing is function of Data Link Layer that is used to separate message from source or
sender to destination or receiver or simply from all other messages to all other destinations just
by adding sender address and destination address.
 The destination or receiver address is simply used to represent where message or packet is to
go.
 Sender or source address is simply used to help recipient to acknowledge receipt.
 Frames are generally data unit of data link layer that is transmitted or transferred among
various network points.
 Frames includes complete and full addressing, protocols that are essential, and information
under control.
Framing
Framing

 Methods of Framing :

1. Character Count
2. Flag Byte with Character Stuffing
3. Starting and Ending Flags, with Bit Stuffing
Character Count

 This method is rarely used and is generally required to count total number of
characters that are present in frame.
 This is be done by using field in header.
 Character count method ensures data link layer at the receiver or destination about
total number of characters that follow, and about where the frame ends.
 There is disadvantage also of using this method i.e., if anyhow character count is
disturbed or distorted by an error occurring during transmission, then destination or
receiver might lose synchronization.
Character Count
Flag Byte with Character Stuffing
 Character stuffing is also known as byte stuffing
 In byte stuffing, special byte that is basically known as ESC (Escape Character) that has predefined
pattern is generally added to data section of the data stream or frame when there is message or
character that has same pattern as that of flag byte.
 But receiver removes this ESC and keeps data part that causes some problems or issues. In simple
words, we can say that character stuffing is addition of 1 additional byte if there is presence of ESC
or flag in text.
Flag Byte with Character Stuffing
Starting and Ending Flags, with Bit Stuffing
 Bit stuffing is also known as bit-oriented framing or bit-oriented approach.
 In bit stuffing, extra bits are being added by network protocol designers to data streams.
 It is generally insertion or addition of extra bits into transmission unit or message to be transmitted
as simple way to provide and give signaling information and data to receiver and to avoid or ignore
appearance of unintended or unnecessary control sequences.
 It is type of protocol management simply performed to break up bit pattern that results in
transmission to go out of synchronization.
 Bit stuffing is very essential part of transmission process in network and communication protocol.
It is also required in USB.

(a) The original data.


(b) The data as they appear on the line.
(c) The data as they are stored in the receiver's memory after
destuffing. 22
Starting and Ending Flags, with Bit Stuffing
Starting and Ending Flags, with Bit Stuffing

Enter 0 after five


consecutive 1’s
Starting and Ending Flags, with Bit Stuffing
Error Detection and Correction

 Types of Errors

• Whenever bits flow from one point to another, they are subject to
unpredictable changes because of interference.
• This interference can change the shape of the signal.
• In a single-bit error, a 0 is changed to a 1 or a 1 to a O.
• In a burst error, multiple bits are changed. For example, a 11100 s burst of
impulse noise on a transmission with a data
Single-Bit Error
 The term single-bit error means that only 1 bit of a given data unit (such as a byte,
character, or packet) is changed from 1 to 0 or from 0 to 1.
 Figure shows the effect of a single-bit error on a data unit.
 Single-bit errors are the least likely type of error in serial data transmission
Burst Error
 The term burst error means that 2 or more bits in the data unit have changed from 1 to 0 or from 0 to 1.
 Note that a burst error does not necessarily mean that the errors occur in consecutive bits.
 The length of the burst is measured from the first corrupted bit to the last corrupted bit. Some bits in
between may not have been corrupted.
 A burst error is more likely to occur than a single-bit error.
 The duration of noise is normally longer than the duration of 1 bit, which means that when noise affects
data, it affects a set of bits.
 The number of bits affected depends
on the data rate and duration of noise.
 Figure shows the effect of a
burst error on a data unit.
In this case, 100010001000011 was
sent, but 0101110101100011 was
received.
Redundancy

 The central concept in detecting or correcting errors is redundancy.


 To be able to detect or correct errors, we need to send some extra bits with our data.
 These redundant bits are added by the sender and removed by the receiver.
 Their presence allows the receiver to detect or correct corrupted bits.

 Detection Versus Correction


• The correction of errors is more difficult than the detection.
• In error detection, we are looking only to see if any error has occurred.
• In error correction, we need to know the exact number of bits that are corrupted and more
importantly, their location in the message.
• The number of the errors and the size of the message are important factors.
Error-Detection
Error Detection - Parity Check

 The parity check is done by adding an extra bit, called parity bit to the data to
make a number of 1s either even in case of even parity or odd in case of odd
parity.
 While creating a frame, the sender counts the number of 1s in it and adds the
parity bit in the following way
 In case of even parity: If a number of 1s is even then parity bit value is 0. If the
number of 1s is odd then parity bit value is 1.
 In case of odd parity: If a number of 1s is odd then parity bit value is 0. If a
number of 1s is even then parity bit value is 1.
Error Detection - Parity Check
 On receiving a frame, the receiver counts the number of 1s in it.
 In case of even parity check, if the count of 1s is even, the frame is accepted, otherwise, it is
rejected. A similar rule is adopted for odd parity check.
 The parity check is suitable for single bit error detection only
Error Detection -Cyclic redundancy check (CRC)
 CRC is based on binary division.
 In CRC, a sequence of redundant bits, called
cyclic redundancy check bits, are appended to the
end of data unit so that the resulting data unit
becomes exactly divisible by a second,
predetermined binary number.
 At the destination, the incoming data unit is
divided by the same number.
 If at this step there is no remainder, the data unit is
assumed to be correct and is therefore accepted.
 A remainder indicates that the data unit has been
damaged in transit and therefore must be rejected.
Error Detection -Cyclic redundancy check (CRC)
Hamming Code
 Encoding a message by Hamming Code
Step 1 − Calculation of the number of redundant bits.
Step 2 − Positioning the redundant bits.
Step 3 − Calculating the values of each redundant bit.
 Step 1 − Calculation of the number of redundant bits.
 If the message contains m number of data bits, r number of redundant bits are added to it so
that is able to indicate at least (m + r + 1) different states.
 Here, (m + r) indicates location of an error in each of bit positions and one additional state
indicates no error.
 Since, r bits can indicate 2r states, 2r must be at least equal to (m + r + 1). Thus the following
equation should hold − 2r ≥ 𝑚 + 𝑟 + 1

 If the data is of 7 bits, i.e. m = 7, the minimum value of r that will satisfy the above equation
is 4, (16 ≥ 7 + 4 + 1). The total number of bits in the encoded message, (m + r) = 11. This is
referred as (11,4) code 35
Hamming Code

 If the data is of 7 bits, i.e. m = 7, the minimum value of r that will satisfy the above
equation is 4, (16 ≥ 7 + 4 + 1). The total number of bits in the encoded message, (m + r) =
11. This is referred as (11,4) code

 2r ≥ 𝑚 + 𝑟 + 1 put r =1 then 21 = 2 ≥ 7+ 1 + 1 (Not satisfying the equation)

 2r ≥ 𝑚 + 𝑟 + 1 put r =2 then 22 = 4 ≥ 7+ 2 + 1 (Not satisfying the equation)

 2r ≥ 𝑚 + 𝑟 + 1 put r =3 then 23 = 8 ≥ 7+ 3 + 1 (Not satisfying the equation)

 2r ≥ 𝑚 + 𝑟 + 1 put r =4 then 24 = 16 ≥ 7+ 4 + 1 (satisfying the equation)


Hamming Code
 Step 2 − Positioning the redundant bits.
 The r redundant bits placed at bit positions of powers of 2, i.e. 20 = 1, 21 = 2, 22 = 4, 23 = 8,
24 = 16 etc. They are referred in the rest of this text as r1 (at position 1), r2 (at position 2), r3
(at position 4), r4 (at position 8) and so on.
 If, m = 7 comes to 4, the positions of the redundant bits are as follows −
Hamming Code
 Step 3 − Calculating the values of each redundant bit.
Suppose the data to be transmitted is 1011001, the bits will be placed as follows:
Hamming Code
R1 bit is calculated using parity check at all the bits positions whose binary representation
includes a 1 in the least significant position. R1: bits 1, 3, 5, 7, 9, 11

To find the redundant bit R1, we check for even parity. Since the total number of 1’s in all the
bit positions corresponding to R1 is an even number the value of R1 (parity bit’s value) = 0
Hamming Code
R2 bit is calculated using parity check at all the bits positions whose binary representation
includes a 1 in the second position from the least significant bit. R2: bits 2,3,6,7,10,11

To find the redundant bit R2, we check for even parity. Since the total number of 1’s in all the
bit positions corresponding to R2 is odd the value of R2(parity bit’s value)=1
Hamming Code
R4 bit is calculated using parity check at all the bits positions whose binary representation
includes a 1 in the third position from the least significant bit. R4: bits 4, 5, 6, 7

To find the redundant bit R4, we check for even parity. Since the total number of 1’s in all the bi
positions corresponding to R4 is odd the value of R4(parity bit’s value) = 1
Hamming Code
R8 bit is calculated using parity check at all the bits positions whose binary representation
includes a 1 in the fourth position from the least significant bit. R8: bit 8,9,10,11

To find the redundant bit R8, we check for even parity. Since the total number of 1’s in all the bi
positions corresponding to R8 is an even number the value of R8(parity bit’s value)=0. Thus, the
data transferred is:
Hamming Code
 Decoding Code Decoding a message in Hamming Code
 Once and Once the receiver gets an incoming message, it performs recalculations to detect errors and
correct correct them. The steps for recalculation are −
Step 1 − Calculation of the number of redundant bits.
Step 2 − Positioning the redundant bits.
Step 3 − Parity checking.
Step 4 − Error detection and correction follows
 Calculation of the number of redundant bits
Using the same formula as in encoding, the number of redundant bits are ascertained.

2r ≥ 𝑚 + 𝑟 + 1
Where m is the number of data bits and r is the number of redundant bits
43
Hamming Code

 Positioning the redundant bits


The r redundant bits placed at bit positions of powers of 2, i.e. 1, 2, 4, 8, 16 etc.

 Parity checking
Parity bits are calculated based upon the data bits and the redundant bits using the same rule as
during generation of c1, c2, c3, c4 etc. Thus
c1 = parity(1, 3, 5, 7, 9, 11 and so on)
c2 = parity(2, 3, 6, 7, 10, 11 and so on)
c3 = parity(4, 5, 6, 7 and so on)
c4 = parity(8,9,10,11and so on)

44
Hamming Code
 Error detection and correction
The decimal equivalent of the parity bits binary values is calculated. If it is 0, there is no error.
Otherwise, the decimal value gives the bit position which has error. For example, if c1c2c3c4 =
1001, it implies that the data bit at position 9, decimal equivalent of 1001, has error. The bit is
flipped (converted from 0 to 1 or vice versa) to get the correct message.
Hamming Code

46
Flow Control
 Necessary when data is being sent faster than it can be processed by receiver
 The simplest, most effective, least expensive, and most commonly used method
for transmission error control.
 Using retransmission.
 Computer to printer is typical setting
 Can also be from computer to computer, when a processing program is limited in
capacity

Elementary Data Link Protocols


 Unrestricted Simplex Protocol
 Stop-and-Wait Protocol
Unrestricted Simplex Protocol
 Assume some facts like
1. Data is transmitted in only one
direction.
2. Both the network layers are always
ready for transmitting and
receiving.
3. We will ignore the processing time
4. Communication channel between
the data link layer will never
damage or loose the frames.
Stop-and-Wait Protocol
1. In this protocol we assume that
Data are transmitted in one
direction only
2. No errors occur (perfect channel)
3. The receiver can only process
the received information at a
finite rate
4. These assumptions imply that the
transmitter cannot send frames at
a rate faster than the receiver can
process them.
Stop-and-Wait Protocol
Stop-and-Wait Protocol
Stop-and-Wait Protocol for Noisy Channel
A Simplex Protocol for a Noisy Channel
A Simplex Protocol for a Noisy Channel
SLIDING WINDOW PROTOCOLS

 Sliding window protocols are data link layer protocols for reliable and sequential
delivery of data frames.
 The sliding window is also used in Transmission Control Protocol.
 In this protocol, multiple frames can be sent by a sender at a time before receiving an
acknowledgment from the receiver.
 The term sliding window refers to the imaginary boxes to hold frames.
 Sliding window method is also known as windowing.
SLIDING WINDOW PROTOCOLS
SLIDING WINDOW PROTOCOLS
SLIDING WINDOW PROTOCOLS
SLIDING WINDOW PROTOCOLS
SLIDING WINDOW PROTOCOLS
SLIDING WINDOW PROTOCOLS
The sliding window provides several benefits:

• It controls the speed of transmission so that no fast sender can overwhelm the
slower receiver

• It allows for orderly delivery, as we will show

• It allows for retransmission of lost frames, specific retransmission policy depends


on the specific implementations.

Types of Sliding Window Protocol

1. Go-Back-N
2. Selective Repeat
Go-Back-N PROTOCOL
 Go-Back-N ARQ protocol is also known as Go-Back-N Automatic Repeat Request.
 It is a data link layer protocol that uses a sliding window method.
 In this, if any frame is corrupted or lost, all subsequent frames have to be sent again.
 The size of the sender window is N in this protocol. For example, Go-Back-8, the size
of the sender window, will be 8.
 The receiver window size is always 1.
 If the receiver receives a corrupted frame, it cancels it.
 The receiver does not accept a corrupted frame.
 When the timer expires, the sender sends the correct frame again.
Go-Back-N PROTOCOL
Go-Back-N PROTOCOL
Go-Back-N PROTOCOL
Go-Back-N PROTOCOL
Go-Back-N PROTOCOL
Go-Back-N PROTOCOL
Go-Back-N PROTOCOL

Retransmission of all the frame in current


window if any occur during transmission of
frames
Go-Back-N PROTOCOL

Disadvantages of Go-Back-N ARQ

• If acknowledgment for a frame is not received, the whole window of frames is


retransmitted instead of just the corrupted frame. This makes the Go Back N ARQ
protocol inefficient.

• Retransmission of all the frames on detecting a corrupted frame increases channel


congestion and also increases the bandwidth requirement.

• It is more time-consuming because while retransmitting the frames on detecting a


corrupted frame, the error-free frames are also transmitted.
Selective Repeat PROTOCOL
 Selective Repeat ARQ is also known as the Selective Repeat Automatic Repeat Request.
 But if there is a lot of error in the frame, lots of bandwidth loss in sending the frames again.
So, we use the Selective Repeat ARQ protocol.
 The size of the sender window is always equal to the size of the receiver window.
 The size of the sliding window is always greater than 1.
 If the receiver receives a corrupt frame, it does not directly discard it.
 It sends a negative acknowledgment to the sender.
 The sender sends that frame again as soon as on the receiving negative acknowledgment.
 There is no waiting for any time-out to send that frame.
Selective Repeat PROTOCOL
Selective Repeat PROTOCOL
Selective Repeat PROTOCOL
Selective Repeat PROTOCOL
Selective Repeat PROTOCOL

Negative Ack. Send by the receiver for frame no. 02 and after
receiving the negativeAck. Sender sends frame no. 02 again
Selective Repeat PROTOCOL
HDLC

 High-level Data Link Control (HDLC) is a bit-oriented protocol for


communication over point-to-point and multipoint links.
 It implements the ARQ mechanisms
 HDLC is a simple protocol used to connect point to point serial devices. For
example, you have point to point leased line connecting two locations, in two
different cities.
 HDLC would be the protocol with the least amount of configuration required to
connect these two locations. HDLC would be running over the WAN, between the
two locations.
HDLC - Features
 Broadly HDLC features are as follows:
 Reliable protocol
• selective repeat or go-back-N
 Full-duplex communication
• receive and transmit at the same time
 Bit-oriented protocol
• use bits to stuff flags occurring in data . i.e, it does NOT recognize or interpret byte value
 Flow control
• adjust window size based on receiver capability
 Uses physical layer clocking and synchronization to send and receive frames
HDLC - Overview
 Defines three types of stations
1. Primary 2. Secondary 3. Combined
 Defines three types of data transfer mode
• Normal Response mode
• Asynchronous Balanced mode
 Three types of frames
• Unnumbered
• information
• Supervisory
HDLC-Types of Stations
 Primary station
• Has the responsibility of controlling the operation of data flow .
• Handles error recovery
• Frames issued by the primary station are called commands.
 Secondary station,
• Operates under the control of the primary station.
• Frames issued by a secondary station are called responses.
• The primary station maintains a separate logical link with each secondary station.
 Combined station,
• Acts as both as primary and secondary station.
HDLC - Data transfer mode
• In normal response mode (NRM),  Normal response mode (NRM)
the station configuration is
unbalanced.
• We have one primary station and
multiple secondary stations.
• A primary station can send
commands; a secondary station can
only respond.
• The NRM is used for both point-to-
point and multiple-point links, as
shown in Figure 82
HDLC - Data transfer mode
 Asynchronous balanced mode (ABM)

• In asynchronous balanced mode (ABM), the configuration is balanced.


• The link is point-to-point, and each station can function as a primary and a secondary
(acting as peers), as shown in Figure.
• This is the common mode today.
HDLC-Types of Frames

 HDLC defines three types of frames: information frames (I-frames), supervisory frames
(S-frames), and unnumbered frames (U-frames).
 I-frames are used to transport user data and control information relating to user data
(piggybacking).
 S-frames are used only to transport control information.
 U-frames are reserved for system management.
 Information carried by U-frames is intended for managing the link itself.
HDLC-Types of Frames

Each frame in HDLC may contain up to six fields, a beginning flag field, an address field, a
control field, an information field, a frame check sequence (FCS) field, and an ending flag
field. In multiple-frame transmissions, the ending flag of one frame can serve as the beginning
flag of the next frame.
HDLC-Types of Frames
 Flag field.
• The flag field of an HDLC frame is an 8-bit sequence with the bit pattern01111110 that
identifies both the beginning and the end of a frame and serves as a synchronization pattern
for the receiver.
 Address field.
• The second field of an HDLC frame contains the address of the secondary station.
• If a primary station created the frame, it contains a to address.
• If a secondary creates the frame, it contains a from address.
• An address field can be 1 byte or several bytes long, depending on the needs of the network.
One byte can identify up to 128 stations.
HDLC-Types of Frames
 Control field.
• The control field is a 1- or 2-byte segment of the frame used for flow and error control.
• The interpretation of bits in this field depends on the frame type.
 Information field.
• The information field contains the user's data from the network layer or management
information.
• Its length can vary from one network to another.
 FCS field.
• The frame check sequence (FCS) is the HDLC error detection field.
• It can contain either a 2- or 4-byte ITU-T CRC.
HDLC-Types of Frames (Control Field)
 Control Field for I-Frames
• I-frames are designed to carry user data from the network layer.
• The subfields in the control field are used to define these
functions.
• The first bit defines the type.
• If the first bit of the control field is 0, this means the frame is an
I-frame.
• The next 3 bits, called N(S), define the sequence number of the
frame.
 Control Field for S-Frames
• Supervisory frames are used for flow and error control whenever piggybacking is either
impossible or inappropriate.
• S-frames do not have information fields. If the first 2 bits of the control field is 10, this means the
frame is an S-frame.
• The last 3 bits, called N(R), corresponds to the acknowledgment number (ACK) or negative
acknowledgment number (NAK) depending on the type of S-frame.
• The 2 bits called code is used to define the same itself. 88
HDLC-Types of Frames (Control Field)

 Control Field for U-Frames


• Unnumbered frames are used to exchange session management and control information between
connected devices.
• Unlike S-frames, U-frames contain an information field, but one used for system management
information, not user data.
• U-frame codes are divided into two sections: a 2-bit prefix before the P/F bit and a 3-bit suffix
after the P/F bit.
• Together, these two segments (5 bits) can be used to create up to 32 different types of U-frames.
POINT-TO-POINT PROTOCOL (PPP)
 It is a data link layer protocol that resides in the layer 2 of the OSI model.
 It is used to encapsulate the layer 3 protocols and all the information available in the payload
in order to be transmitted across the serial links.
 The PPP protocol can be used on synchronous link like ISDN as well as asynchronous link
like dial-up. It is mainly used for the communication between the two devices.
 It can be used over many types of physical networks such as serial cable, phone line, trunk
line, cellular telephone, fiber optic links such as SONET.
 As the data link layer protocol is used to identify from where the transmission starts and
ends, so ISP (Internet Service Provider) use the PPP protocol to provide the dial-up access to
the internet.
Services provided by PPP

 It defines the format of frames through which the transmission occurs.


 It defines the link establishment process. If user establishes a link with a server, then "how
this link establishes" is done by the PPP protocol.
 It defines data exchange process, i.e., how data will be exchanged, the rate of the exchange.
 The main feature of the PPP protocol is the encapsulation. It defines how network layer data
and information in the payload are encapsulated in the data link frame.
 It defines the authentication process between the two devices. The authentication between the
two devices, handshaking and how the password will be exchanged between two devices are
decided by the PPP protocol.
Services provided by PPP
 It is a byte-oriented protocol as it provides the frames as a collection of bytes or characters.
 It is a WAN (Wide Area Network) protocol as it runs over the internet link which means
between two routers, internet is widely used.

 PPP has two main uses which are given below:


• It is widely used in broadband communications having heavy loads and high speed. For
example, an internet operates on heavy load and high speed.

• It is used to transmit the multiprotocol data between the two connected (point-to-point)
computers. It is mainly used in point-to-point devices, for example, routers are point-to-
point devices where PPP protocol is widely used as it is a WAN protocol not a simple
LAN ethernet protocol.
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.
The control field is a mandatory field where protocol supports flow and error control mechanism.
Frame format of PPP protocol

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

 Checksum: It is a 16-bit field which is generally used for error detection.


Transition phases of PPP protocol
 Dead: Dead is a transition phase which means
that the link is not used or there is no active
carrier at the physical layer.

 Establish: If one of the nodes starts working


then the phase goes to the establish phase. In
short, we can say that when the node starts
communication or carrier is detected then it
moves from the dead to the establish phase.

 Authenticate: It is an optional phase which


means that the communication can also moves
to the authenticate phase. The phase moves from
the establish to the authenticate phase only when
both the communicating nodes agree to make
the communication authenticated.
Transition phases of PPP protocol
 Network: Once the authentication is successful,
the network is established or phase is network.
In this phase, the negotiation of network layer
protocols take place.

 Open: After the establishment of the network


phase, it moves to the open phase. Here open
phase means that the exchange of data takes
place. Or we can say that it reaches to the open
phase after the configuration of the network
layer.

 Terminate: When all the work is done then the


connection gets terminated, and it moves to the
terminate phase.
MAC Sublayer

 The medium access control (MAC)


is a sublayer of the data link layer
of the open system interconnections
(OSI) reference model for data
transmission.
 It is responsible for flow control
and multiplexing for transmission
medium.
 It controls the transmission of data
packets via remotely shared
channels.
 It sends data over the network
interface card.
MAC Sublayer - Functions
 It provides an abstraction of the physical layer to the LLC and upper layers of the
OSI network.

 It is responsible for encapsulating frames so that they are suitable for transmission via
the physical medium.

 It resolves the addressing of source station as well as the destination station, or


groups of destination stations.

 It performs multiple access resolutions when more than one data frame is to be
transmitted. It determines the channel access methods for transmission.

 It also performs collision resolution and initiating retransmission in case of collisions.

 It generates the frame check sequences and thus contributes to protection against
transmission errors. 98
Taxonomy of Multiple-access protocols

99
Random Access Protocols
 let's use the example of mobile phone communication. Whenever you call someone, a
connection between you and the desired person is established, also anyone can call anyone.
 So here we have all the users (stations) at an equal priority, where any station can send data
depending on medium's state whether it is idle or busy, meaning that if you friend is talking to
someone else through the mobile phone, then its status is busy and you cannot establish a
connection and since all the users are assigned equal priority you can not disconnect your
friend's ongoing call and connect yours.

 The random access protocols consist of the following characteristics:


• There is no time restriction for sending the data (you can talk to your friend without a time
restriction).

100
ALOHA
 ALOHA is a system for coordinating and arbitrating access to a shared communication Networks
channel.
 The original system used for ground based radio broadcasting, but the system has been
implemented in satellite communication systems.
 A shared communication system like ALOHA requires a method of handling collisions that occur
when two or more systems attempt to transmit on the channel at the same time.
 In the ALOHA system, a node transmits whenever data is available to send.
 If another node transmits at the same time, a collision occurs, and the frames that were transmitted
are lost.
Pure ALOHA
Pure ALOHA

 In pure ALOHA, the time of transmission is continuous. Whenever a station has an


available frame, it sends the frame.
 If there is collision and the frame is destroyed, the sender waits for a random amount of
time before retransmitting it.
 After transmitting a frame, a station waits for a finite period of time to receive an
acknowledgement.

 If the acknowledgement is not received within this time, the station assumes that the frame
has been destroyed due to collision and resends the frame.
 A collision occurs if more than one frame tries to occupy the channel at the same time
Pure ALOHA
Pure ALOHA
Slotted ALOHA

 In slotted aloha, time is divided into slots.


 A sender may send a frame at the start of the time slot.
 If the sender does not send at the start then it will wait for the next slot.
 If two sender sends the frames at the beginning of the time slot, there will be a collision
and the frame will be garbled.
 If the acknowledgment is not received, the frame is retransmitted in a new slot.
Slotted ALOHA
CSMA
 It is a carrier sense multiple access based on media access protocol to sense the traffic on a
channel (idle or busy) before transmitting the data.
 It means that if the channel is idle, the station can send data to the channel. Otherwise, it must
wait until the channel becomes idle. Hence, it reduces the chances of a collision on a
transmission medium.

 CSMA Access Modes


 1-Persistent
• In the 1-Persistent mode of CSMA that defines each node, first sense the shared channel and if
the channel is idle, it immediately sends the data.
• Else it must wait and keep track of the status of the channel to be idle and broadcast the frame
unconditionally as soon as the channel is idle.
CSMA
 Non-Persistent
• It is the access mode of CSMA that defines before transmitting the data, each node must sense
the channel, and if the channel is inactive, it immediately sends the data. Otherwise, the station
must wait for a random time (not continuously), and when the channel is found to be idle, it
transmits the frames.

 P-Persistent
• It is the combination of 1-Persistent and Non-persistent modes. The P-Persistent mode defines
that each node senses the channel, and if the channel is inactive, it sends a frame with a P
probability. If the data is not transmitted, it waits for a (q = 1-p probability) random time and
resumes the frame with the next time slot.
CSMA
CSMA/CD
 Carrier Sense Multiple Access with Collision Detection (CSMA/CD) is a network
protocol for carrier transmission that operates in the Medium Access Control (MAC)
layer.
 It senses or listens whether the shared channel for transmission is busy or not, and
defers transmissions until the channel is free.
 The collision detection technology detects collisions by sensing transmissions from
other stations.
 On detection of a collision, the station stops transmitting, sends a jam signal, and then
waits for a random time interval before retransmission..
CSMA/CD
 The algorithm of CSMA/CD is:

• When a frame is ready, the transmitting station checks whether the channel is idle or
busy.

• If the channel is busy, the station waits until the channel becomes idle.

• If the channel is idle, the station starts transmitting and continually monitors the channel
to detect collision.

• If a collision is detected, the station starts the collision resolution algorithm.

• The station resets the retransmission counters and completes frame transmission.
CSMA/CD
 The algorithm of Collision Resolution is:

• The station continues transmission of the current frame for a specified time along with a
jam signal, to ensure that all the other stations detect collision.

• The station increments the retransmission counter.

• If the maximum number of retransmission attempts is reached, then the station aborts
transmission.

• Otherwise, the station waits for a backoff period which is generally a function of the
number of collisions and restart main algorithm.
CSMA/CD
CSMA/CA
 Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA) is a network
protocol for carrier transmission that operates in the Medium Access Control (MAC)
layer.
 In contrast to CSMA/CD (Carrier Sense Multiple Access/Collision Detection) that deals
with collisions after their occurrence, CSMA/CA prevents collisions prior to their
occurrence.

 The algorithm of CSMA/CA

 When a frame is ready, the transmitting station checks whether the channel is idle or
busy.

 If the channel is busy, the station waits until the channel becomes idle.

 If the channel is idle, the station waits for an Inter-frame gap (IFG) amount of time and
then sends the frame.
CSMA/CA

 After sending the frame, it sets a timer.

 The station then waits for


acknowledgement from the receiver. If
it receives the acknowledgement before
expiry of timer, it marks a successful
transmission.

 Otherwise, it waits for a back-off time


period and restarts the algorithm.
WDMA
 To allow multiple transmissions
at the same time, the spectrum is
divided up into channels
(wavelength bands).

 In this protocol, WDMA


(Wavelength Division Multiple
Access), each station is assigned
two channels.

 A narrow channel is provided as


a control channel to signal the
station, and a wide channel is
provided to the station can
output data frames.
WDMA
 Each channel is divided up into groups
of time slots as depicted in Figure
 Let us call the number of slots in the
control channel m and the number of
slots in the data channel n + 1, where n
of these are for data and the last one is
used by the station to report on its
status (mainly, which slots on both
channels are free).
 On both channels, the sequence of slots
repeats endlessly, with slot 0 being
marked in a special way so latecomers
can detect it.
 All channels are synchronized by a
single global clock. 118
WDMA
IEEE 802.3
 The IEEE 802.3 standard specifies a CSMA/CD bus network that supports 10-Mbps
transmission over baseband, broadband, and twisted pair cable.
 The networking standard closely resembles Ethernet. Both HP and IBM (and others)
support the IEEE 802.3 networking standards (HP for their native NS networking
product and IBM for their TCP/IP products).
IEEE 802.3
 Preamble: An 8 byte pattern of binary 1s and 0s
used to establish synchronization. The last bit of
the preamble is always 0.
 Start Frame Delimiter: An 8 bit pattern
indicating the formal start of the frame.
 Destination Address: An address specifying a
specific destination station, a group of stations,
or all stations in the LAN. This address can be
16 bits or 48 bits in length, but all stations in the
LAN must adhere to one format or the other.
IEEE 802.3
 Source Address: The address of the
originating station. This address has the same
length requirements as the destination address.
 Length: The length measured in bytes, of the
actual data, indicating the 802.2 header. This is
a 16 bit field.
 Padding: Extra, non-data bytes can be
inserted into the frame to make the overall
frame length more palatable to the physical
network.
IEEE 802.3
 Frame check sequence: At the end of the
frame is a 32 bit Cyclic Redundancy Check
(CRC) on the data starting with the destination
address the terminating at the end of the data
(not including any padding).
IEEE 802.3
 Advantages
• Short access delay at low load.
• MAC management is relatively simple, distributed.
• Huge installed base and significant operational experience.

 Disadvantages
• Operation at high traffic load is problematic.
• Variable/Unbounded delay-not well suited for real-time applications.
• Substantial analog component (collision detection).
IEEE 802.11
 IEEE has defined the specifications for a wireless LAN, called IEEE 802.11, which covers
the physical and data link layers
 Architecture : The standard defines two kinds of services: the basic service set (BSS) and
the extended service set
(ESS)

1. Basic Service Set


IEEE 802.11
2. Extended Service Set
IEEE 802.11
 Station Types
1. IEEE 802.11 defines three types of stations based on their mobility in a wireless LAN:
no-transition, BSS·transition, and ESS-transition mobility.
2. A station with no - transition mobility is either stationary (not moving) or moving only
inside a BSS.
3. A station with BSS-transition mobility can move from one BSS to another, but the
movement is confined inside one ESS.
4. A station with ESS-transition mobility can move from one ESS to another. However,
IEEE 802.11 does not guarantee that communication is continuous during the move.
IEEE 802.11
 MAC Sublayer
IEEE 802.11 - DSSS
IEEE 802.11/a - OFDM
 IEEE 802.11a OFDM describes the orthogonal frequency-division multiplexing
(OFDM) method for signal generation in a 5-GHz ISM band.
 OFDM is similar to FDM, with one major difference: All the sub bands are used by
one source at a given time.
 Sources contend with one another at the data link layer for access.
 The band is divided into 52 sub bands, with 48 sub bands for sending 48 groups of bits
at a time and 4 sub bands for control information.
 Dividing the band into sub bands diminishes the effects of interference.
 If the sub bands are used randomly, security can also be increased
IEEE 802.11/b DSSS
 IEEE 802.11 b DSSS describes the high-rate direct sequence spread spectrum (HRDSSS) method
for signal generation in the 2.4-GHz ISM band.
 HR-DSSS is similar to DSSS except for the encoding method, which is called complementary
code keying (CCK). CCK encodes 4 or 8 bits to one CCK symbol.
 To be backward compatible with DSSS, HR-DSSS defines four data rates: 1,2, 5.5, and 11 Mbps.
The first two use the same modulation techniques as DSSS.
 The 5.5-Mbps version uses BPSK and transmits at
1.375 Mbaudls with 4-bit CCK encoding.
The II-Mbps version uses QPSK and
transmits at 1.375 Mbps with 8-bit
CCK encoding.
Figure shows the modulation technique
IEEE 802.11/g

 IEEE 802.11g defines two different OFDM modulation formats.


 One, which is mandatory in 802.11g, is an exact copy of the 802.11a format except that
the carrier frequencies are in the 2.4 GHz band.
 We refer to this as "IEEE 802.11g OFDM".
 The other OFDM format is an optional format called DSSS-OFDM that combines an
802.11b-style single-carrier preamble with an 802.11a-style OFDM data payload.
 We refer to this as "IEEE 802.11g DSSS-OFDM".
 The 802.11a/g/j/p OFDM modulation analysis mode can demodulate and analyze either
of these OFDM formats.
IEEE 802.15
IEEE 802.15
 Today, Bluetooth technology is the implementation of a protocol defined by the IEEE
802.15 standard.
 The standard defines a wireless personal-area network (PAN) operable in an area the size
of a room or a hall.
 piconet and scatternet
 Bluetooth Layers
IEEE 802.16
 The 802.16 standard for 2-11 GHz is a wireless metropolitan area network (MAN)
technology that will provide broadband wireless connectivity to Fixed, Portable and
Nomadic devices.
 It can be used to connect 802.11
hot spots to the Internet,
provide campus connectivity, and
provide a wireless alternative to cable
and DSL for last mile broadband
access.
 WiMAX
Question Bank Unit 2
1. Illustrate various services offered by data link layer. [5]
2. What are different framing methods available? Explain any one in detail.
3. If all the physical links were to provide the reliable delivery service, would the TCP reliable
delivery service be redundant? Yes/No? Justify. [5]
4. Compare and contrast between HDLC and PPP.[5]
5. Explain PPP with phase diagram for bringing a live up[8]
6. Explain the working of PPP. It is based closely on HDLC which uses bit stuffing to prevent
accidental flag bytes within the payload from causing confusion? Give reason why PPP uses
character stuffing instead?[8]
7. What is the overhead to send an IP packet using PPP? Count only the overhead introduced by
PPP itself, not the IP header overhead.[5]
Question Bank Unit 2
8. Explain the sliding window protocol [4]
9. Explain Go-back-n protocol with neat diagram.[4]
10. Explain various methods of framing in data link layer. [8]
11. Explain in brief pure ALOHA, slotted ALOHA [6]
12. Explain CSMA/CD. [4]
13. Write the problems in static and dynamic channel allocation. [6]
14. Explain persistent and non-persistent CSMA. [4]
15. Explain Go back N Protocol? What are demerits of this Protocol?
16. What is difference between Go-back-n and selective repeate.
17. Explain Framing Method of DLL?
18. Explain in detail HDLC Frame FormaPrtof.Ba.Rn.Bdan SiCtsOEc,Puonen-4t1rol fields? 137
Question Bank Unit 2
8. 19. Explain the different frame formats for HDLC .[8]
20. Calculate CRC for the frame 110101001 and generator polynomial is x4+x2+1. What is the
transmitted frame?
21. Received code word is 1001100101011, divisor is 10101, find the received frame is correct
or not?
22. Generate the hamming code for data 10001011(Assume even Parity).
23. If 7-bit hamming code word is received by a receiver is 1011011, assume the even parity
state whether the receiving code word is correct or wrong? If wrong locate the bit in error.
24. In stop & Wail Protocol define & discus the handling of
a)Damaged Frame b)Lost Frame

Prof.B.R.Ban SCOE,Pune-41 138

You might also like