0% found this document useful (0 votes)
9 views96 pages

Mod 2

The document outlines the syllabus for the Computer Networks course at Dayananda Sagar University, focusing on the Data Link Layer's functions, error detection and correction methods, and flow control protocols. Key topics include link layer addressing, error detection techniques like parity checks and cyclic redundancy checks, and various flow control protocols such as Stop-and-Wait and Sliding Window. It also discusses the Medium Access Control sublayer and its role in managing network communication.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views96 pages

Mod 2

The document outlines the syllabus for the Computer Networks course at Dayananda Sagar University, focusing on the Data Link Layer's functions, error detection and correction methods, and flow control protocols. Key topics include link layer addressing, error detection techniques like parity checks and cyclic redundancy checks, and various flow control protocols such as Stop-and-Wait and Sliding Window. It also discusses the Medium Access Control sublayer and its role in managing network communication.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 96

Dayananda Sagar University

School of Engineering
Devarakaggalahalli, Harohalli Kanakapura Road, Dt, Ramanagara, Karnataka 562112

Department of Computer Science & Engineering


(Artificial Intelligence & Machine Learning)

COMPUTER NETWORKS
SEMESTER – V & III Semester
Course Code: 22AMXXXX /
23AMXXXX
 Dr. G. Naveen Babu, Associate Dean- SOE, DSU.
 Dr. Hanumanth Sastry Sistla Professor, Department of CSE(AI&ML), SoE, DSU.
 Dr. Mude Nagarjuna Naik, Assistant Professor, Dept. of CS&E (AIML) SoE, DSU.
 Dr. Sumith Kumar Yadav, Assistant Professor, Dept. of CS&E (AIML) SoE, DSU.
 Prof. Pradeep Kumar K, Assistant Professor, Dept. of CS&E (AIML) SoE, DSU.
 Prof. Pavithra A, Assistant Professor, Dept. of CS&E (AIML) SoE, DSU.
Syllabus
UNIT – II 08 Hours
Link layer addressing; (TB1-Ch10)
Error detection and correction: Cyclic codes, checksum, forward error correction;
(TB1-Ch10)
Data link control: DLC services, data link layer protocols; (TB1-Ch11 & TB2-Ch3)
Media access control: Random access, virtual LAN. (TB1-Ch12, Ch15)

28/02/2025 2
28/02/2025 3
28/02/2025 4
• 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 main responsibility of the Data Link Layer is


• Providing a well defined service interface to the network layer
• Dealing with transmission errors
• Regulating the flow of data so that slow receivers are not swamped by fast senders
To accomplish these goals the DLL takes the packets it gets from the network layer and encapsulates them
into frames for transmission.

• The Data Link Layer protocols are Ethernet, token ring 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
link, PPP on the second link.

28/02/2025 5
28/02/2025 6
28/02/2025 7
28/02/2025 8
28/02/2025 9
Error detection and correction

28/02/2025 10
• Ways of doing Error Control :
There are basically two ways of doing Error control as given
below :

28/02/2025 11
1. Error Correction :
 Error correction, as name suggests, simply means correction or solving or fixing of errors.
 It means reconstruction of original data that is error-free.
 But error correction method is very costly and is very hard.

2. Error Detection :
 Error detection, as name suggests, simply means detection or identification of errors.
 These errors may cause due to noise or any other impairments during transmission from transmitter to
the receiver, in communication system.
 It is class of technique for detecting garbled i.e. unclear and distorted data or message.

28/02/2025 12
28/02/2025 13
28/02/2025 14
28/02/2025 15
28/02/2025 16
Data can be corrupted during transmission.
For reliable communication, errors must be detected
and corrected.

28/02/2025 17
Types of Errors

28/02/2025 18
Single-Bit Error
In a single-bit error, only one bit in the data unit has
changed.

28/02/2025 19
Multiple-Bit Error
In Multiple-bit error, more than one bit in the data unit
has changed.

28/02/2025 20
Burst Error

A burst error means that 2 or more


bits in the data unit have changed.

28/02/2025 21
Error detection
 Error detection means to decide whether the
received data is correct or not without having a copy of the
original message.

 Error detection uses the concept of redundancy,


which means adding extra bits for detecting errors at the
destination.

28/02/2025 22
Error Detection Methods

 Redundancy

 Parity Check

 Cyclic Redundancy Check (CRC)

 Checksum

28/02/2025 23
Error Detection
 Redundancy

28/02/2025 24
Four types of redundancy checks are used
in data communications

28/02/2025 25
Vertical Redundancy Check
(VRC)

28/02/2025 26
Vertical Redundancy Check
(VRC)
Performance

It detect single bit error


It detect burst errors only if the total number of
errors is odd.

28/02/2025 27
Longitudinal Redundancy Check
(LRC)

28/02/2025 28
Longitudinal Redundancy Check
(LRC)
Performance

 LCR increases the likelihood of detecting burst errors.

 If two bits in one data units are damaged and two bits in exactly
the same positions in another data unit are also damaged, the
LRC checker will not detect an error.

28/02/2025 29
VRC and LRC

28/02/2025 30
Cyclic Redundancy Check
(CRC)

28/02/2025 31
Cyclic codes
•A CRC code with C(7, 4)

28/02/2025 32
CRC Encoder & Decoder

28/02/2025 33
• Division in CRC Encoder

28/02/2025 34
• Division in CRC Encoder

28/02/2025 35
• Division in CRC Encoder

28/02/2025 36
Simulation of division in CRC encoder

28/02/2025 37
Checksum

28/02/2025 38
Checksum
At the sender

The unit is divided into k sections, each of n bits.


All sections are added together using one’s
complement to get the sum.
The sum is complemented and becomes the
checksum.
The checksum is sent with the data

28/02/2025 39
Checksum
At the receiver

The unit is divided into k sections, each of n bits.


All sections are added together using one’s
complement to get the sum.
The sum is complemented.
If the result is zero, the data are accepted:
otherwise, they are rejected.

28/02/2025 40
Checksum
Performance

The checksum detects all errors involving an odd


number of bits.
It detects most errors involving an even number of bits.
If one or more bits of a segment are damaged and the
corresponding bit or bits of opposite value in a second
segment are also damaged, the sums of those columns
will not change and the receiver will not detect a
problem.

28/02/2025 41
Error Correction
It can be handled in two ways:
1) receiver can have the sender retransmit the
entire data unit.
2) The receiver can use an error-correcting code,
which automatically corrects certain errors.

28/02/2025 42
Error Correction
 To correct an error, the receiver reverses the value
of the altered bit. To do so, it must know which bit is in
error.
 Number of redundancy bits needed
• Let data bits = m
• Redundancy bits = r
Total message sent = m+r

The value of r must satisfy the following relation:


2r ≥ m+r+1
28/02/2025 43
Error Correction

28/02/2025 44
Error Correction
 To correct an error, the receiver reverses the value
of the altered bit. To do so, it must know which bit is in
error.
 Number of redundancy bits needed
• Let data bits = m
• Redundancy bits = r
Total message sent = m+r

The value of r must satisfy the following relation:


2r ≥ m+r+1
28/02/2025 45
28/02/2025 46
• Approaches to Flow Control :
Flow Control is classified into two categories –

28/02/2025 47
• Feedback – based Flow Control :
In this control technique, sender transmits data or information or frame to receiver, then
receiver transmits data back to sender and also allows sender to transmit more amount
of data or tell sender about how receiver is processing or doing.

• This means that sender transmits data or frames after it has received
acknowledgments from user.

• Rate – based Flow Control :


In this control technique, usually when sender sends or transfer data at faster speed to
receiver and receiver is not being able to receive data at the speed, then mechanism
known as built-in mechanism in protocol will just limit or restricts overall rate at which
data or information is being transferred or transmitted by sender without any feedback
or acknowledgment from receiver.

28/02/2025 48
28/02/2025 49
Simplex Protocol
The Simplex protocol is hypothetical protocol designed for unidirectional data transmission
over an ideal channel, i.e. a channel through which transmission can never go wrong. It has
distinct procedures for sender and receiver. The sender simply sends all its data available
onto the channel as soon as they are available to its buffer. The receiver is assumed to
process all incoming data instantly. It is hypothetical since it does not handle flow control or
error control.

28/02/2025 50
Properties of Simplex Protocol:
• The design of Simplex Protocol is based on 2 procedures i.e. Sender and Receiver.
• Both Sender and Receiver run in the data link layer but the sender runs in the data link layer of
the source machine while Receiver runs in datalink layer of the destination machine.
• It is designed for Uni-directional data transmission.
• Sender and receiver are always ready for data processing.
• Both of them have infinite buffer space available.
• The communication links never losses any data frames.
• It is considered as unrealistic as it does not handle flow control or error correction.

28/02/2025 51
Stop – and – Wait Protocol
Stop – and – Wait protocol is for noiseless channel too. It provides unidirectional data
transmission without any error control facilities. However, it provides for flow control so that
a fast sender does not drown a slow receiver. The receiver has a finite buffer size with
finite processing speed. The sender can send a frame only when it has received indication
from the receiver that it is available for further data processing.

The primitives of stop and wait protocol are:


Sender side
Rule 1: Sender sends one data packet at a time.
Rule 2: Sender sends the next packet only when it receives the acknowledgment of the previous
packet.
Receiver side
Rule 1: Receive and then consume the data packet.
Rule 2: When the data packet is consumed, receiver sends the acknowledgment to the sender.

28/02/2025 52
Stop and Wait
• Source transmits single frame
• Wait for ACK
• If received frame damaged, discard it
• Transmitter has timeout
• If no ACK within timeout, retransmit
• If ACK damaged, transmitter will not recognize it
• Transmitter will retransmit
• Receiver gets two copies of frame
• Use ACK0 and ACK1

28/02/2025 53
Stop and Wait
Stop and Wait - Pros and Cons

• Simple
• Inefficient

28/02/2025 54
Sliding Window Protocol

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.

28/02/2025 55
Sliding Window Protocol

28/02/2025 56
Go – Back – N ARQ
Go – Back – N ARQ provides for sending multiple frames before receiving the acknowledgement 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
acknowledgement of a frame is not received within the time period, all frames starting from that
frame are retransmitted.

28/02/2025 57
Go – Back – N ARQ

28/02/2025 58
Go – Back – N ARQ

28/02/2025 59
Go – Back – N ARQ

28/02/2025 60
Go – Back – N ARQ

28/02/2025 61
Go – Back – N ARQ

28/02/2025 62
Selective Repeat ARQ
This protocol also provides for sending multiple frames before receiving the
acknowledgement for the first frame. However, here only the erroneous or lost frames are
retransmitted, while the good frames are received and buffered.

28/02/2025 63
Selective Repeat ARQ

28/02/2025 64
Medium Access Control
The protocols used to determine who goes next on a multi-access
channel belong to a sublayer of the data link layer called the MAC
(Medium Access Control) sublayer.
Technically, the MAC sublayer is the bottom part of the data link layer.

28/02/2025 65
Medium Access Control
• The IEEE has subdivided data link layer into two sublayers: logical link control (LLC) and media access control
(MAC).
• Figure IEEE standard for LANs

28/02/2025 66
Medium Access Control
• Framing LLC defines a protocol data unit (PDU) that is somewhat similar to that of HDLC.
• The header contains a control field like the one in HDLC; this field is used for flow and error
control. The two other header fields define the upper-layer protocol at the source and destination
that uses LLC.
• These fields are called the destination service access point (DSAP) and the source service access
point (SSAP). The other fields defined in a typical data link control protocol such as HDLC are
moved to the MAC sublayer.
• In other words, a frame defined in HDLC is divided into a PDU at the LLC sublayer and a frame
at the MAC sublayer, as shown in above Figure.
• Need for LLC The purpose of the LLC is to provide flow and error control for the upper-layer
protocols that actually demand these services.

28/02/2025 67
Media Access Control
• Definition: MAC is the sublayer of the Data Link Layer that controls
access to the physical transmission medium.

• Key Role: Determines how devices on a network communicate and


share the same transmission medium without collisions.

Types of Media Access Control

• Controlled Access: Centralized control over who can transmit (e.g., Token passing, Polling).
• Random Access: Decentralized, contention-based access to the shared medium.
• Channelization: Dividing the available bandwidth into distinct channels (e.g., FDMA, TDMA,
CDMA).

28/02/2025 68
Media Access Control

28/02/2025 69
Random Access
Definition: A decentralized approach where any device can attempt to access the medium whenever it
has data to send.

• Characteristics:
• No dedicated control for granting access.
• Collision-prone but resolved using specific techniques.

Types of Random Access Protocols:


1. ALOHA:
I. Pure ALOHA: Send data anytime, wait for an acknowledgment.
II. Slotted ALOHA: Data sent in specific time slots, reducing collisions.
2. Carrier Sense Multiple Access (CSMA):
I. CSMA: Devices sense the medium before transmitting.
II. CSMA with Collision Detection (CSMA/CD): Used in Ethernet, detects and manages collisions.
III. CSMA with Collision Avoidance (CSMA/CA): Used in wireless networks, avoids collisions by sending intent
signals.

28/02/2025 70
Random Access Protocol
In this protocol, all the station has the equal priority to send the data over a channel.

• In random access protocol, one or more stations cannot depend on another station nor any station
control another station.

• Depending on the channel's state (idle or busy), each station transmits the data frame. However, if
more than one station sends the data over a channel, there may be a collision or data conflict.

• Due to the collision, the data frame packets may be lost or changed. And hence, it does not receive
by the receiver end.

• Following are the different methods of random-access protocols for broadcasting frames on the
channel.
o Aloha
o CSMA
o CSMA/CD
o CSMA/CA

28/02/2025 71
ALOHA Random Access Protocol
It is designed for wireless LAN (Local Area Network) but can also be used in a shared medium
to transmit data.

• Using this method, any station can transmit data across a network simultaneously when a
data frameset is available for transmission.

• Aloha Rules
 Any station can transmit data to a channel at any time.
 It does not require any carrier sensing.
 Collision and data frames may be lost during the transmission of data through multiple
stations.
 Acknowledgment of the frames exists in Aloha. Hence, there is no collision detection.
 It requires retransmission of data after some random amount of time.

28/02/2025 72
ALOHA Random Access Protocol
Pure Aloha

• Whenever data is available for sending over a channel at stations, we use Pure Aloha.

• In pure Aloha, when each station transmits data to a channel without checking whether
the channel is idle or not, the chances of collision may occur, and the data frame can
be lost.

• When any station transmits the data frame to a channel, the pure Aloha waits for the
receiver's acknowledgment.

• If it does not acknowledge the receiver end within the specified time, the station waits
for a random amount of time, called the backoff time (Tb).

• And the station may assume the frame has been lost or destroyed. Therefore, it
retransmits the frame until all the data are successfully transmitted to the receiver.

28/02/2025 73
Pure ALOHA Random Access Protocol

28/02/2025 74
Vulnerable time:
• The vulnerable time is in which there is a possibility of collision. We assume that the stations send fixed-length
frames with each frame taking Tfr S to send. The following figure shows the vulnerable time for station A.
• Station A sends a frame at time t. Now imagine station B has already sent a frame between t - Tfr and t. This leads
to a collision between the frames from station A and station B. The end of B's frame collides with the beginning of
A's frame.
• On the other hand, suppose that station C sends a frame between t and t + Tfr . Here, there is a collision
between frames from station A and station C. The beginning of C's frame collides with the end of A's frame. We
see vulnerable time during which a collision may occur in pure ALOHA , is 2 times the frame transmission time.
• Pure Aloha vulnerable time = 2* Tfr

28/02/2025 75
Procedure for Pure ALOHA

28/02/2025 76
• The time-out period is equal to the maximum possible round-trip propagation delay, which is
twice the amount of time required to send a frame between the two most widely separated
stations (2 x Tp) The back-off time TB is a random value that normally depends on K (the
number of attempted unsuccessful transmissions). The formula for TB depends on the
implementation. One common formula is the binary exponential back-off.

• In this method, for each retransmission, a multiplier in the range 0 to 2K - 1 is randomly chosen
and multiplied by Tp (maximum propagation time) or Tfr (the average time required to send out
a frame) to find TB' Note that in this procedure, the range of the random numbers increases
after each collision. The value of Kmax is usually chosen as 15.

28/02/2025 77
Slotted ALOHA
Slotted Aloha

• The slotted Aloha is designed to overcome the pure Aloha's efficiency because pure Aloha
has a very high possibility of frame hitting. In slotted Aloha, the shared channel is divided
into a fixed time interval called slots.

• So that, if a station wants to send a frame to a shared channel, the frame can only be sent
at the beginning of the slot, and only one frame is allowed to be sent to each slot.

28/02/2025 78
Slotted ALOHA
• In slotted ALOHA we divide the time into slots of Tfr s and force the station to send only at the
beginning of the time slot. The following figure shows an example of frame collisions in slotted ALOHA.
• Because a station is allowed to send only at the beginning of the synchronized time slot, if a station
misses this moment, it must wait until the beginning of the next time slot.
• This means that the station which started at the beginning of this slot has already finished sending its
frame. But, still there is the possibility of collision if two stations try to send at the beginning of the
same time slot. However, the vulnerable time is now reduced to one-half, equal to Tfr. The following
figure shows the situation.

28/02/2025 79
CSMA (Carrier Sense Multiple Access)
CSMA (Carrier Sense Multiple Access)

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

28/02/2025 80
CSMA (Carrier Sense Multiple Access)
• The possibility of collision still exists because of propagation delay, when a station sends a frame, it still
takes time (although very short) for the first bit to reach every station and for every station to sense it. In
other words, a station may sense the medium and find it idle, only because the first bit sent by another
station has not yet been received. At time t1 station B senses the medium and finds it idle, so it sends a
frame. At time t2 (t2> t1) station C senses the medium and finds it idle because, at this time, the first bits
from station B have not reached station C. Station C also sends a frame. The two signals collide and both
frames are destroyed.

28/02/2025 81
CSMA (Carrier Sense Multiple Access)
Vulnerable Time:

The vulnerable time for CSMA is the propagation time Tp. This is the time needed for a signal to propagate from
one end of the medium to the other. When a station sends a frame, and any other station tries to send a frame during
this time, a collision will result. But if the first bit of the frame reaches the end of the medium, every station will
already have heard the bit and will refrain from sending. The following figure shows the worst case. The leftmost
station A sends a frame at time t1 which reaches the rightmost station D at time t1 + Tp. The gray area shows the
vulnerable area in time and space.

28/02/2025 82
CSMA (Carrier Sense Multiple Access)

28/02/2025 83
CSMA (Carrier Sense Multiple Access)
(i) I-persistent CSMA
• In this method, station that wants to transmit data continuously senses the channel to check whether the channel
is idle or busy.
• If the channel is busy, the station waits until it becomes idle.
• When the station detects an idle-channel, it immediately transmits the frame with probability 1. Hence it is
called I-persistent CSMA.
• This method has the highest chance of collision because two or more stations may find channel to be idle at the
same time and transmit their frames.
• When the collision occurs, the stations wait a random amount of time and start allover again.

28/02/2025 84
CSMA (Carrier Sense Multiple Access)

Drawback of I-persistent
• The propagation delay time greatly affects this protocol. Let us suppose, just after the station I begins its
transmission, station 2 also became ready to send its data and senses the channel. If the station I signal has not yet
reached station 2, station 2 will sense the channel to be idle and will begin its transmission. This will result in
collision. Even if propagation delay time is zero, collision will still occur. If two stations became .ready in the middle
of third station’s transmission, both stations will wait until the transmission of first station ends and then both will
begin their transmission exactly simultaneously. This will also result in collision.

28/02/2025 85
CSMA (Carrier Sense Multiple Access)

(ii)Non-persistent CSMA

• In this scheme, if a station wants to transmit a frame and it finds that the channel is busy (some other station is
transmitting) then it will wait for fixed interval oftime.
• After this time, it again checks the status of the channel and if the channel is free it will transmit.
• A station that has a frame to send senses the channel.
• If the channel is idle, it sends immediately.
• If the channel is busy, it waits a random amount of time and then senses the channel again.
• In non-persistent CSMA the station does not continuously sense the channel for the purpose of capturing it when
it detects the end of previous transmission.

28/02/2025 86
CSMA (Carrier Sense Multiple Access)

(ii)Non-persistent CSMA

Advantage of non-persistent
• It reduces the chance of collision because the stations wait a random amount of time. It is unlikely that two or
more stations will wait for same amount of time and will retransmit at the same time.
Disadvantage of non-persistent
• It reduces the efficiency of network because the channel remains idle when there may be stations with frames
to send. This is due to the fact that the stations wait a random amount of time after the collision.

28/02/2025 87
CSMA (Carrier Sense Multiple Access)

28/02/2025 88
CSMA (Carrier Sense Multiple Access)
(iii) p-persistent CSMA

• This method is used when channel has time slots such that the time slot duration is equal to or greater than the
maximum propagation delay time.
• Whenever a station becomes ready to send, it senses the channel.
• If channel is busy, station waits until next slot.
• If channel is idle, it transmits with a probability p.
• With the probability q=l-p, the station then waits for the beginning of the next time slot.
• If the next slot is also idle, it either transmits or waits again with probabilities p and q.
• This process is repeated till either frame has been transmitted or another station has begun transmitting.
• In case of the transmission by another station, the station acts as though a collision has occurred and it waits a
random amount of time and starts again.
Advantage of p-persistent
• It reduces the chance of collision and improves the efficiency of the network.

28/02/2025 89
CSMA (Carrier Sense Multiple Access)

28/02/2025 90
CSMA (Carrier Sense Multiple Access)

28/02/2025 91
CSMA (Carrier Sense Multiple Access)

If the frame is successfully received, the station sends another frame. If any collision is detected in the
CSMA/CD, the station sends a jam/ stop signal to the shared channel to terminate data transmission.

After that, All the stations it waits for a random time before sending a frame to a channel.

28/02/2025 92
CSMA (Carrier Sense Multiple Access)

28/02/2025 93
Virtual LAN (VLAN)
Definition: VLAN is a logical subdivision of a physical network, grouping devices into the same broadcast domain
regardless of their physical location.

Purpose: Enhances network security, reduces congestion, and improves manageability by separating traffic..

VLAN Characteristics
Segmentation: Logical network segmentation across different switches.

Isolation: Devices within the same VLAN can communicate, but traffic is restricted from other VLANs unless routed.

Flexibility: Devices can be grouped by function, not location.

Efficiency: Reduces unnecessary broadcast traffic.

28/02/2025 94
Virtual LAN (VLAN)
Purpose:
Identifies which VLAN a particular packet belongs to.

Methods:
 Port-based VLANs: Traffic tagged based on the physical port.
 IEEE 802.1Q Tagging: Industry-standard for VLAN tagging.
 Trunk Ports: Allow VLAN-tagged traffic across multiple VLANs.

Common VLAN Types:


 Default VLAN: Usually VLAN 1, where all ports are members by default.
 Data VLAN: Used for user-generated traffic.
 Voice VLAN: Dedicated for voice traffic (e.g., IP phones).
 Management VLAN: Used for management traffic like SNMP.
 Native VLAN: VLAN that does not tag frames when sent over trunk ports.

28/02/2025 95
Virtual LAN (VLAN)
Benefits of VLANs

 Enhanced Security: Isolate sensitive data.


 Better Traffic Management: Reduces broadcast storms and network congestion.
 Simplified Network Management: Easier to manage logical groups of devices.
 Cost-effective: Reduces the need for physical segregation through switches and routers

28/02/2025 96

You might also like