Tải bản đầy đủ (.pdf) (103 trang)

mạng máy tính nâng cao nguyễn đức thái chương 5 link layer and lan sinhvienzone com

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (2.17 MB, 103 trang )

om

Zo

ne

.C

Chapter 5
Link Layer and LANs

nh
Vi
en

A note on the use of these ppt slides:

Si

We’re making these slides freely available to all (faculty, students, readers).
They’re in PowerPoint form so you can add, modify, and delete slides
(including this one) and slide content to suit your needs. They obviously
represent a lot of work on our part. In return for use, we only ask the
following:
 If you use these slides (e.g., in a class) in substantially unaltered form,
that you mention their source (after all, we’d like people to use our book!)
 If you post any slides in substantially unaltered form on a www site, that
you note that they are adapted from (or perhaps identical to) our slides, and
note our copyright of this material.

Computer Networking:


A Top Down Approach

4th edition.
Jim Kurose, Keith Ross
Addison-Wesley, July
2007.

Thanks and enjoy! JFK/KWR
All material copyright 1996-2007
J.F Kurose and K.W. Ross, All Rights Reserved
SinhVienZone.com

5: DataLink Layer

/>
5-1


Chapter 5: The Data Link Layer

om

Our goals:

.C

 understand principles behind data link layer






Zo



error detection, correction
sharing a broadcast channel: multiple access
link layer addressing
reliable data transfer, flow control: done!

nh
Vi
en



ne

services:

 instantiation and implementation of various link

Si

layer technologies

SinhVienZone.com

5: DataLink Layer


/>
5-2


om

Link Layer
 5.1 Introduction and




.C

Zo

ne

 5.8 Link virtualization:

ATM, MPLS

nh
Vi
en



 5.7 PPP


Si



services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-layer
Addressing
5.5 Ethernet

 5.6 Link-layer switches

SinhVienZone.com

5: DataLink Layer

/>
5-3


Link Layer: Introduction

om

Some terminology:
 hosts and routers are nodes





ne

wired links
wireless links
LANs

nh
Vi
en



Zo

connect adjacent nodes along
communication path are links

.C

 communication channels that

 layer-2 packet is a frame,

Si

encapsulates datagram


data-link layer has responsibility of
transferring datagram from one node
to adjacent node over a link
SinhVienZone.com

5: DataLink Layer

/>
5-4


Link layer: context

e.g., Ethernet on first link,
frame relay on
intermediate links, 802.11
on last link

nh
Vi
en

om

Zo



 trip from Princeton to


 each link protocol

provides different
services

e.g., may or may not
provide rdt over link

Si



SinhVienZone.com

Lausanne
 limo: Princeton to JFK
 plane: JFK to Geneva
 train: Geneva to Lausanne

.C

different link protocols
over different links:

transportation analogy

ne

 datagram transferred by


 tourist = datagram
 transport segment =

communication link
 transportation mode =
link layer protocol
 travel agent = routing
algorithm
5: DataLink Layer

/>
5-5


Link Layer Services


reliable delivery between adjacent nodes




we learned how to do this already (chapter 3)!
seldom used on low bit-error link (fiber, some twisted
pair)
wireless links: high error rates
• Q: why both link-level and end-end reliability?

Si




nh
Vi
en

Zo



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!

.C



om

framing, link access:

ne



SinhVienZone.com


5: DataLink Layer

/>
5-6


flow control:




ne

error detection:

errors caused by signal attenuation, noise.
receiver detects presence of errors:
• signals sender for retransmission or drops frame

Zo



pacing between adjacent sending and receiving nodes

.C




nh
Vi
en



om

Link Layer Services (more)

 error correction:



receiver identifies and corrects bit error(s) without
resorting to retransmission

Si



half-duplex and full-duplex


with half duplex, nodes at both ends of link can transmit,
but not at same time
SinhVienZone.com

5: DataLink Layer


/>
5-7


Where is the link layer implemented?

om

 in each and every host



Ethernet card, PCMCI
card, 802.11 card
implements link, physical
layer

nh
Vi
en



 attaches into host’s

application
transport
network
link


cpu

memory

controller
link
physical

host
bus
(e.g., PCI)

physical
transmission

Si

system buses
 combination of
hardware, software,
firmware

host schematic

ne

Zo

“adaptor” (aka network
interface card NIC)


.C

 link layer implemented in

SinhVienZone.com

network adapter
card

5: DataLink Layer

/>
5-8


om

Adaptors Communicating
datagram

.C

datagram

Zo

nh
Vi
en


sending host

ne

controller

controller

receiving host

datagram

frame

Si

 sending side:
 encapsulates datagram in
frame
 adds error checking bits,
rdt, flow control, etc.
SinhVienZone.com

 receiving side
 looks for errors, rdt, flow
control, etc
 extracts datagram, passes
to upper layer at receiving
side

5: DataLink Layer

/>
5-9


om

Link Layer
 5.1 Introduction and




.C

Zo

ne

 5.8 Link Virtualization:

ATM. MPLS

nh
Vi
en




 5.7 PPP

Si



services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-layer
Addressing
5.5 Ethernet

 5.6 Link-layer switches

SinhVienZone.com

5: DataLink Layer

/>
5-10


Error Detection

.C

om


EDC= Error Detection and Correction bits (redundancy)
D = Data protected by error checking, may include header fields

otherwise

Si

nh
Vi
en

Zo

ne

• Error detection not 100% reliable!
• protocol may miss some errors, but rarely
• larger EDC field yields better detection and correction

SinhVienZone.com

5: DataLink Layer

/>
5-11


Parity Checking


om

Detect and correct single bit errors

Si

nh
Vi
en

Zo

ne

Detect single bit errors

Two Dimensional Bit Parity:

.C

Single Bit Parity:

SinhVienZone.com

0

0

5: DataLink Layer


/>
5-12


Internet checksum (review)

ne

.C

om

Goal: detect “errors” (e.g., flipped bits) in transmitted
packet (note: used at transport layer only)

 treat segment contents

Si

nh
Vi
en

as sequence of 16-bit
integers
 checksum: addition (1’s
complement sum) of
segment contents
 sender puts checksum
value into UDP checksum

field
SinhVienZone.com

Receiver:
 compute checksum of
received segment
 check if computed checksum
equals checksum field value:
 NO - error detected
 YES - no error detected.

Zo

Sender:

But maybe errors
nonetheless?

5: DataLink Layer

/>
5-13


 view data bits, D, as a binary number
 choose r+1 bit pattern (generator), G

.C

 goal: choose r CRC bits, R, such that


om

Checksumming: Cyclic Redundancy Check



ne

Zo



<D,R> exactly divisible by G (modulo 2)
receiver knows G, divides <D,R> by G. If non-zero remainder:
error detected!
can detect all burst errors less than r+1 bits

nh
Vi
en



Si

 widely used in practice (Ethernet, 802.11 WiFi, ATM)

SinhVienZone.com


5: DataLink Layer

/>
5-14


CRC Example

.C

om

Want:
D.2r XOR R = nG

ne

equivalently:
equivalently:

Si

nh
Vi
en

if we divide D.2r by
G, want remainder R

Zo


D.2r = nG XOR R

R = remainder[

SinhVienZone.com

D.2r
G

]

5: DataLink Layer

/>
5-15


om

Link Layer
 5.1 Introduction and




.C

Zo


ne

 5.8 Link Virtualization:

ATM, MPLS

nh
Vi
en



 5.7 PPP

Si



services
5.2 Error detection
and correction
5.3Multiple access
protocols
5.4 Link-layer
Addressing
5.5 Ethernet

 5.6 Link-layer switches

SinhVienZone.com


5: DataLink Layer

/>
5-16


Multiple Access Links and Protocols

om

Two types of “links”:

ne

.C

 point-to-point
 PPP for dial-up access
 point-to-point link between Ethernet switch and host

Si

nh
Vi
en

Zo

 broadcast (shared wire or medium)

 old-fashioned Ethernet
 upstream HFC
 802.11 wireless LAN

shared wire (e.g.,
cabled Ethernet)
SinhVienZone.com

shared RF
(e.g., 802.11 WiFi)

shared RF
(satellite)

humans at a
cocktail party
(shared air, acoustical)
5: DataLink Layer

/>
5-17


Multiple Access protocols

om

 single shared broadcast channel

interference



ne

.C

 two or more simultaneous transmissions by nodes:
collision if node receives two or more signals at the same time

Zo

multiple access protocol

nh
Vi
en

 distributed algorithm that determines how nodes



Si

share channel, i.e., determine when node can transmit
 communication about channel sharing must use channel
itself!
no out-of-band channel for coordination

SinhVienZone.com


5: DataLink Layer

/>
5-18


om

Ideal Multiple Access Protocol



no special node to coordinate transmissions
no synchronization of clocks, slots

4. simple

Si



nh
Vi
en

Zo

ne

.C


Broadcast channel of rate R bps
1. when one node wants to transmit, it can send at
rate R.
2. when M nodes want to transmit, each can send at
average rate R/M
3. fully decentralized:

SinhVienZone.com

5: DataLink Layer

/>
5-19


MAC Protocols: a taxonomy

.C

ne



divide channel into smaller “pieces” (time slots,
frequency, code)
allocate piece to node for exclusive use

Zo




om

Three broad classes:
 Channel Partitioning

nh
Vi
en

 Random Access
 channel not divided, allow collisions
 “recover” from collisions

Si

 “Taking turns”
 nodes take turns, but nodes with more to send can take
longer turns

SinhVienZone.com

5: DataLink Layer

/>
5-20


Channel Partitioning MAC protocols: TDMA


om

TDMA: time division multiple access

.C

 access to channel in "rounds"

ne

 each station gets fixed length slot (length = pkt

nh
Vi
en

Zo

trans time) in each round
 unused slots go idle
 example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6
idle

1

Si

6-slot
frame


SinhVienZone.com

3

4

1

3

4

5: DataLink Layer

/>
5-21


Channel Partitioning MAC protocols: FDMA

om

FDMA: frequency division multiple access

.C

 channel spectrum divided into frequency bands

ne


 each station assigned fixed frequency band

Zo

 unused transmission time in frequency bands go idle
 example: 6-station LAN, 1,3,4 have pkt, frequency

FDM cable
SinhVienZone.com

frequency bands

Si

nh
Vi
en

bands 2,5,6 idle

5: DataLink Layer

/>
5-22


om

Random Access Protocols


ne

.C

 When node has packet to send
 transmit at full channel data rate R.
 no a priori coordination among nodes

Zo

 two or more transmitting nodes ➜ “collision”,

nh
Vi
en

 random access MAC protocol specifies:
 how to detect collisions
 how to recover from collisions (e.g., via delayed
retransmissions)

Si

 Examples of random access MAC protocols:
 slotted ALOHA
 ALOHA
 CSMA, CSMA/CD, CSMA/CA
SinhVienZone.com


5: DataLink Layer

/>
5-23


ne

.C

Operation:
 when node obtains fresh
frame, transmits in next
slot
 if no collision: node can
send new frame in next
slot
 if collision: node
retransmits frame in
each subsequent slot
with prob. p until
success

Si

nh
Vi
en

Zo


Assumptions:
 all frames same size
 time divided into equal
size slots (time to
transmit 1 frame)
 nodes start to transmit
only slot beginning
 nodes are synchronized
 if 2 or more nodes
transmit in slot, all
nodes detect collision

om

Slotted ALOHA

SinhVienZone.com

5: DataLink Layer

/>
5-24


Zo

ne

.C


om

Slotted ALOHA

Si

nh
Vi
en

Pros
 single active node can
continuously transmit
at full rate of channel
 highly decentralized:
only slots in nodes
need to be in sync
 simple
SinhVienZone.com

Cons
 collisions, wasting slots
 idle slots
 nodes may be able to
detect collision in less
than time to transmit
packet
 clock synchronization
5: DataLink Layer


/>
5-25


×