Data Link Layer

fullgorgedcutNetworking and Communications

Oct 24, 2013 (3 years and 7 months ago)

67 views

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Chapter 5

Data Link

Layer

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Understand the functions of the data link layer.

Understand the concept of the hop
-
to
-
hop delivery compared to

host
-
to
-
host delivery and application
-
to
-
application delivery.

Understand the concept of access method and define different

access methods used in LANs and WANs .

After reading this chapter, the reader should

be able to:

O
BJECTIVES

Understand the addressing mechanism used in the data link

layer and how network layer addresses are mapped to data

layer addresses.

Understand how error control is handled at the data link layer.

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

DUTIES OF THE

DATA LINK LAYER

5.1

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Figure 5
-
1

Data link layer in the Internet model

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Figure 5
-
2

Data
-
link layer duties

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

HOP
-
TO
-
HOP

DELIVERY

5.2

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Figure 5
-
3

Hop
-
to
-
hop delivery

Transport layer :
application program to application program

Network layer :
host to host delivery (source to destination)

Datalink layer :
hop to hop


McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

PACKETIZING

5.3

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

packetizing


Different protocols have different names for the
packet at the data link layer


Most LANs (ethernet) refer to the packet as
frames.


ATM WAN refers to a packet as a cell


A header and trailer are usually added to a packet
received from the network layer


Header : length of the data, addressing information…


Trailer : error detection

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

ADDRESSING

5.4

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Technical Focus:


Addresses in Local Area Networks

The physical address for most computers on local area networks

is imprinted on the network card that is installed in the

computer.

If the user or network manager changes the network card

(because of a failure, for example), the physical address

of the computer is changed. In most cases, changing

the network card requires reconfiguration of the computer.

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Addressing


The data link layer addresses are called
physical addresses or MAC addresses and
are used to find the address of the next hop
in the hop to hop delivery


The physical address used by a LAN is
totally different from that used by a WAN


A LAN address is 6 bytes (48 bits) long


A WAN address is usually longer

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

ARP

(address resolution protocol)


Mapping the logical address (IP address) to the
physical address (MAC address) dynamically.


Anytime a host or a router needs to find the
physical address of another host or router on its
network, it sends an ARP query packet.


The packet includes the physical and IP addresses
of the sender and the IP address of the receiver.


Because the sender does not know the physical
address of the receiver, this query is broadcast
over the network.

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Figure 5
-
4

ARP operation

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

ERROR CONTROL

5.5

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Error control


In data communication, errors are inevitable


Using better equipment and more reliable
transmission media may reduce the
frequency of occurrence. But it can never
eliminate errors.


Detect and correct errors


McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Data can be corrupted during
transmission. For reliable
communication, errors must be
prevented, or detected and corrected.

Note:

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Source of errors


White noise :


due to the heat; is constant by nature


Impulse noise


It is a surprise signal that suddenly affects the medium


Can not be predicted


Effect of impulse noise depends on the speed of data
transmission


Crosstalk


It is the effect of one medium on another

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Source of errors


Echo


We have echo when a sending device receives some of
the energy it has sent


Jitter


It is the result of a change in the signal when it passes
through an electronic device


Attenuation


A signal may become too weak if it travels a lon
distance


Distortion


Harmonics are combined at the receiver, the signal is
not exactly the one sent by sender


McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

In a single
-
bit error, only 1 bit in the
data unit has changed.

Note:

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Figure 5
-
5

Single
-
bit error

ASCII STX : start of text

ASCII LF : line feed

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

A burst error means that two or more
bits in the data unit have changed.

Note:

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Figure 5
-
6


Burst error of length five

The errors not necessarily 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

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Error prevention


White noise : reduce the ambient temperture


Crosstalk : twist or shield the cable


Attenuation : repeaters


Errors are inevitable, for accuracy we need
to detect and correct errors

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Error detection uses the concept of
redundancy, which means adding
extra bits for detecting errors at the
destination.

Note:

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Figure 5
-
7

Redundancy

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Figure 5
-
8

Detection methods

Vertical redundancy check

Longitudinal redundancy check

cyclic redundancy check

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

In vertical redundancy check (VRC), a
parity bit is added to every data unit so
that the total number of 1s becomes
even.

Note:

Most common and last expensive mechanism for error detection.

Often called parity check.

A redundant bit (parity bit) is added to make the number of 1s even.

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Figure 5
-
9

Even parity VRC concept

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Figure 5
-
10

LRC

Longitudinal redundancy check


Calculate the parity bit for each column and create a new column

New column

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

In longitudinal redundancy check
(LRC), a block of bits is divided into
rows and a redundant row of bits is
added to the whole block.

Note:

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Figure 5
-
11

CRC

Cyclic redundancy check

Most powerful redundancy check.

Based on binary division rather than binary addition.

CRC remainder is appended to the end of the data.

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Error correction


Once the data are detected, the receiver has
3 choice :


Simply discard the data


Discard the data but request a retransmission


Correct the data


Data correction is select when the data
packet is very small and we need the
accurcy but can not wait for retransmission


Very difficult to achieve if there are more
than a few bits in error.

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Error correction using
retransmission


If the sender has not received positive news in due
time, the frame is retransmitted.


The frame is damage :


The receiver send a negative acknowledgement


The receiver does not send an acknowledgement


The acknowledgement is lost


There are two protocols for retransmission :


Stop and wait automatic repeat request


Sliding window automatic repeat request

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Figure 5
-
12

Stop and wait ARQ

Only the fate of one frame at any moment is unknown

After sending a frame the sender stops and waits before the next


frame is sent

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Technical Focus:


Procedure for Stop
-
And
-
Wait ARQ

The sending device keeps a copy of the last frame transmitted

until it receives an acknowledgment for that frame

Both data frames and ACK frames are

numbered 0 and 1 alternately. A data 0 frame is acknowledged

by an ACK 1 frame.

If an error is discovered in a data frame, a negative

acknowledgment (NAK) frame is returned.


If an expected acknowledgment is not received within an

allotted time period, the sender assumes that the last data

frame was lost in transit and sends it again.

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Figure 5
-
13

Sliding
-
window ARQ

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Technical Focus:


Procedure for Sliding
-
Window ARQ

The sending device keeps copies of all transmitted frames until

they have been acknowledged.

In addition to ACK frames, a receiver can return a NAK frame

if the data have been received damaged. The NAK frame

tells the sender to retransmit a damaged frame.

Like stop
-
and
-
wait ARQ, the sending device in sliding
-
window

ARQ is equipped with a timer to enable it to handle lost

acknowledgments.

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

FLOW CONTROL

5.6

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Flow control refers to a set of
procedures used to restrict the amount
of data the sender can send before
waiting for acknowledgment.

Note:

Buffer : the rate of transmission is faster than check and


process , for this reason, each receiving device has a block

of memory called buffer, reserved for storing incoming data

until they are processed.

If the buffer begins to fill up, the receiver must tell the sender

to halt transmission until it is once again able to receive.

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

MEDIUM ACCESS

CONTROL

5.1

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Figure 5
-
14

Medium access methods

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Figure 5
-
15

Select

The select procedure is used whenever the primary has

something to sent.

The select procedure has priority over the poll procedure


Know if

the secondary


is ready to

accept the data

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Figure 5
-
16

Poll

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

The poll/select method is mostly used
in time
-
sharing systems when a central
computer is used to control other
computers.

Note:

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Token passing


In the token passing method, the permit is
passed from one computer to another.


Stations are arranged around a physical or
logical ring


Permit is a small frame called token.


If a station needs to send data, it waits for
the token and captures it.


After capturing the token, the station send
one or more frames.


McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Figure 5
-
17

Token passing network

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Random access


The station checks to make sure the medium
is idle.(carrier sense)


If the medium is idle, the station can send
data.


There is still a potential for collision.to
detect collision and send the data again, the
station needs to continue monitoring the
medium.

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

CSMA/CD


Carrier sense multiple access with collision
detection.


Check the level of energy in the medium to tell the
idleness of the medium.


Frame from a distant station might be undetectable


If the stations discovered a collision(a very high
level of energy), they know that their frames have
been destroyed


To minimize the risk of collision, two stations
each wait a random amount of time

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

CSMA/CA


Collision is avoided by sending a special
frame to tell other stations how long it is
usuing the medium before sending data.


If it receives no objection from any other
station, it means that it can send data

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

Token passing is used mostly by local
area networks (LANs). We discuss
LANs in Chapter 9.

Note:

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

CSMA/CD is used in the Ethernet
LAN discussed in Chapter 9.

Note:

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

CSMA/CA is used in the wireless
LANs discussed in Chapter 10.

Note:

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

DATA LINK

PROTOCOLS

5.8

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

A data link protocol is a set of
specifications used to implement the
data link layer.

Note:

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

In a character
-
oriented protocol, the
frame is interpreted as a series of
characters. In a bit
-
oriented protocol,
the frame or packet is interpreted as a
series of bits.

Note:

McGraw
-
Hill

©
The McGraw
-
Hill Companies, Inc.

All bit
-
oriented protocols are related

to high
-
level data link control

(HDLC),

a bit
-
oriented protocol.

Note: