Chap 2 DLL
Chap 2 DLL
Layer
Dr.K.Suresh
Babu Professor
of CSE JNTUH
Link 5-1
Link
layer
our goals:
understand principles behind link
layer services:
error detection, correction
sharing a broadcast channel:
multiple access
link layer addressing
local area networks: Ethernet,
VLANs
instantiation, implementation of
various link layer technologies
Link 5-2
Link layer:
introduction
terminology:
hosts and routers: nodes
communication channels global
ISP
that connect adjacent
nodes along
communication
wired links path:
links
wireless links
LANs
layer-2 packet:
frame,
encapsulates
datagram
data-link layer has responsibility
of transferring datagram from
one node to physically adjacent
node over a link
Link 5-3
Link layer: context
datagram transferred by transportation analogy:
different link protocols trip from Princeton to
over different links: Lausanne
e.g., Ethernet on first limo: Princeton to JFK
link, frame relay on plane: JFK to Geneva
intermediate links, train: Geneva to
802.11 on last link Lausanne
each link protocol tourist = datagram
provides different transport
services segment =
e.g., may or may communication
not provide rdt link
over link transportation mode =
link layer protocol
travel agent =
routing algorithm Link 5-4
Link layer
services
Providing services to the network layer:
Unacknowledged connectionless
service: Appropriate for low error rate
and real-time traffic. Ex: Ethernet
Acknowledged connectionless service:
Useful in
unreliable channels, WiFi.
Ack/Timer/Resend
Acknowledged connection-oriented
service: Guarantee frames are received
exactly once and in the right order.
Appropriate over long, unreliable links
such as a satellite channel or a long-
distance telephone circuit
Data Link Layer 5-
Link layer
services
framing, link access:
encapsulate datagram into frame, adding
header, trailer
channel access if shared medium
“MAC” addresses used in frame headers to
identify
source, dest
• different from IP address!
Physical Addressing:
The Data Link layer adds a header to the frame in order to define physical
address of the sender or receiver of the frame, if the frames are to be
distributed to different systems on the network.
reliable delivery between adjacent nodes
we learned how to do this already
seldom used on low bit-error link (fiber, some
twisted
pair) Link 5-6
Link layer services (more)
flow control:
pacing between adjacent sending and receiving nodes
error detection:
errors caused by signal attenuation, noise.
receiver detects presence of errors:
• signals sender for retransmission or drops frame
error correction:
receiver identifies and corrects bit error(s) without
resorting to retransmission
half-duplex and full-duplex
with half duplex, nodes at both ends of link can
transmit, but not
at same time
Link 5-7
2. Error Control: Error control is achieved by adding a trailer at the end of
the frame. Duplication of frames are also prevented by using this mechanism.
Data Link Layers adds mechanism to prevent duplication of frames.
Error detection: 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: Error correction is similar to the Error detection, except that
receiving node not only detects the errors but also determine where the errors
have occurred in the frame.
2. Access Control: Protocols of this layer determine which of the devices has
control over
the link at any given time, when two or more devices are connected to the same
link.
3. Reliable delivery: Data Link Layer provides a reliable delivery service, i.e.,
transmits the network layer datagram without any error. A reliable delivery
service is accomplished with transmissions and acknowledgements. 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.
4. 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
can transmit the data at the same time.
data ra datagra
g m m
controll controll
er er
stuffing.
Starting and ending flags,
3.
5-
Not
e
In a single-bit error, only 1 bit in the data
unit has changed.
Figure Single-bit
10.1 error
Not
e
A burst error means that 2 or more
bits in the data unit have changed.
Figure Burst error of
10.2 length 8
Error control mechanism may involve two possible
ways:
Error detection
Error correction
Redundancy : is the central
concept in detecting & correcting errors.
We need to send some extra bits with our data.
These redundant bits are added by the sender
and removed by the receiver .
Note
1block coding .
Note
In this section , we concentrate on
1. The receiver has (or can find) a list of valid
codewords.
2. The original codeword has changed to an
invalid one.
Example 10.2
Let us assume that k = 2 and n = 3. Table 10.1 shows the
list of datawords and codewords. Later, we will see
how to derive a codeword from a dataword.
Link Layer 5-
48
Parity checking
single bit parity: two-dimensional bit parity:
detect single detect and correct single bit
bit errors
errors
0 0
Link Layer 5-
49
Internet checksum
(review)
goal: detect “errors” (e.g., flipped bits) in transmitted
packet
(note: used at transport layer only)
sender: receiver:
treat segment compute checksum of
Link Layer 5-
51
CRC
example
want:
D.2r XOR R =
nG
equivalently:
D.2r = nG XOR
R
equivalently:
if we divide D.2r
by
G,Rwant D .2r
= ]
remainder
remainder[ G
R to
satisfy:
Link Layer 5-
52
Elementary Data Link Protocols
Protocols in the data link layer are designed so
that this layer can perform its basic functions:
framing, error control and flow control.
Framing is the process of dividing bit - streams
from physical layer into data frames whose size
ranges from a few hundred to a few thousand
bytes
does not respond when there is an error, how can the sender know which
frame to resend? To remedy this problem, the sender keeps a copy of the
sent frame. At the same time, it starts a timer. If the timer expires and
there is no ACK for the sent frame, the frame is resent, the copy is
held, and the timer is restarted. Since the protocol uses the stop-and-
wait mechanism,
frame there is of
and retransmitting only
theone specific
frame whenframe that needs an ACK
the timer Data Link Layer 5-
Error correction in Stop-and-Wait ARQ is done by keeping a copy of
Stop-and-Wait Automatic Repeat
Request
In Stop-and-Wait
ARQ, we use
sequence numbers to
number the frames.
The sequence
numbers are based
on modulo-2
arithmetic.
In
always Stop-and-Wait
announces
modulo in
ARQ, the
-2
sequencearithmetic
acknowledgment
number ofthe the
next frame expected.
the
receiver is more complex. Data Link Layer 5-
69
Selective Repeat Automatic Repeat
Request