Tải bản đầy đủ (.ppt) (109 trang)

Link Layer and LANs

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 (1.89 MB, 109 trang )

Chapter 5
Link Layer and LANs

A note on the use of these ppt slides:
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.
Thanks and enjoy! JFK/KWR

Computer Networking:
A Top Down Approach
Featuring the Internet,
3rd edition.
Jim Kurose, Keith Ross
Addison-Wesley, July
2004.

All material copyright 1996-2006
J.F Kurose and K.W. Ross, All Rights Reserved
5: DataLink Layer

5-1


Chapter 5: The Data Link Layer


Our goals:
Ì understand principles behind data link layer

services:
r
r
r
r

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

Ì instantiation and implementation of various link

layer technologies

5: DataLink Layer

5-2


Link Layer
Ì 5.1 Introduction and
Ì
Ì
Ì
Ì


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

Ì 5.6 Hubs and switches
Ì 5.7 PPP
Ì 5.8 Link Virtualization:

ATM and MPLS

5: DataLink Layer

5-3


Link Layer: Introduction
Some terminology:

“link”

Ì hosts and routers are nodes
Ì communication channels that

connect adjacent nodes along
communication path are links

r
r
r

wired links
wireless links
LANs

Ì layer-2 packet is a frame,

encapsulates datagram

data-link layer has responsibility of
transferring datagram from one node
to adjacent node over a link
5: DataLink Layer

5-4


Link layer: context
Ì Datagram transferred by

different link protocols
over different links:
r

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

on last link

Ì Each link protocol

provides different
services
r

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

transportation analogy
Ì trip from Princeton to

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

Ì tourist = datagram
Ì transport segment =

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

5-5



Link Layer Services
Ì Framing, link access:
r
r
r

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!

Ì Reliable delivery between adjacent nodes
r we learned how to do this already (chapter 3)!
r seldom used on low bit error link (fiber, some twisted
pair)
r wireless links: high error rates
• Q: why both link-level and end-end reliability?
5: DataLink Layer

5-6


Link Layer Services (more)
Ì

Flow Control:
r


Ì

pacing between adjacent sending and receiving nodes

Error Detection:
r
r

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

Ì Error Correction:
r receiver identifies and corrects bit error(s) without
resorting to retransmission
Ì

Half-duplex and full-duplex
r

with half duplex, nodes at both ends of link can transmit,
but not at same time
5: DataLink Layer

5-7


Adaptors Communicating
datagram

sending
node

rcving
node

link layer protocol

frame

frame

adapter

adapter

Ì link layer implemented in Ì receiving side
r looks for errors, rdt, flow
“adaptor” (aka NIC)
control, etc
r Ethernet card, PCMCI
r extracts datagram, passes
card, 802.11 card
to rcving node
Ì

sending side:
r

r


encapsulates datagram in a Ì
frame
adds error checking bits,
Ì
rdt, flow control, etc.

adapter is semiautonomous
link & physical layers

5: DataLink Layer

5-8


Link Layer
Ì 5.1 Introduction and
Ì
Ì
Ì
Ì

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


Ì 5.6 Hubs and switches
Ì 5.7 PPP
Ì 5.8 Link Virtualization:

ATM

5: DataLink Layer

5-9


Error Detection
EDC= Error Detection and Correction bits (redundancy)
D = Data protected by error checking, may include header fields
• Error detection not 100% reliable!
• protocol may miss some errors, but rarely
• larger EDC field yields better detection and correction

5: DataLink Layer

5-10


Parity Checking
Single Bit Parity:
Detect single bit errors

Two Dimensional Bit Parity:
Detect and correct single bit errors


0

0

5: DataLink Layer

5-11


Internet checksum
Goal: detect “errors” (e.g., flipped bits) in transmitted
segment (note: used at transport layer only)
Sender:
Ì treat segment contents as

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

Receiver:
compute checksum of received
segment
Ì check if computed checksum
equals checksum field value:

r NO - error detected
r YES - no error detected. But
maybe errors nonetheless?
More later ….
Ì

5: DataLink Layer

5-12


Checksumming: Cyclic Redundancy Check
Ì view data bits, D, as a binary number
Ì choose r+1 bit pattern (generator), G
Ì goal: choose r CRC bits, R, such that
r
r

r

<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

Ì widely used in practice (ATM, HDLC)

5: DataLink Layer

5-13



CRC Example
Want:

D.2r XOR R = nG
equivalently:

D.2r = nG XOR R
equivalently:
if we divide D.2r by
G, want remainder R

R = remainder[

D.2r
G

]

5: DataLink Layer

5-14


Link Layer
Ì 5.1 Introduction and
Ì
Ì
Ì

Ì

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

Ì 5.6 Hubs and switches
Ì 5.7 PPP
Ì 5.8 Link Virtualization:

ATM

5: DataLink Layer

5-15


Multiple Access Links and Protocols
Two types of “links”:
Ì point-to-point
r PPP for dial-up access
r point-to-point link between Ethernet switch and host
Ì broadcast (shared wire or medium)
r Old-fashioned Ethernet
r upstream HFC

r 802.11 wireless LAN

5: DataLink Layer

5-16


Multiple Access protocols
Ì single shared broadcast channel
Ì two or more simultaneous transmissions by nodes:

interference
r

collision if node receives two or more signals at the same time

multiple access protocol
Ì distributed algorithm that determines how nodes
share channel, i.e., determine when node can transmit
Ì communication about channel sharing must use channel
itself!
r

no out-of-band channel for coordination

5: DataLink Layer

5-17



Ideal Multiple Access Protocol
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:
r
r

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

4. Simple

5: DataLink Layer

5-18


MAC Protocols: a taxonomy
Three broad classes:
Ì Channel Partitioning
r

r

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


Ì Random Access
r channel not divided, allow collisions
r “recover” from collisions
Ì “Taking turns”
r Nodes take turns, but nodes with more to send can take
longer turns

5: DataLink Layer

5-19


Channel Partitioning MAC protocols: TDMA
TDMA: time division multiple access
Ì access to channel in "rounds"
Ì each station gets fixed length slot (length = pkt

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

5: DataLink Layer

5-20


Channel Partitioning MAC protocols: FDMA
FDMA: frequency division multiple access

Ì channel spectrum divided into frequency bands
Ì each station assigned fixed frequency band
Ì unused transmission time in frequency bands go idle
Ì example: 6-station LAN, 1,3,4 have pkt, frequency

frequency bands

bands 2,5,6 idle

time

5: DataLink Layer

5-21


Random Access Protocols
Ì When node has packet to send
r transmit at full channel data rate R.
r no a priori coordination among nodes
Ì two or more transmitting nodes ➜ “collision”,
Ì random access MAC protocol specifies:
r how to detect collisions
r how to recover from collisions (e.g., via delayed
retransmissions)
Ì Examples of random access MAC protocols:
r slotted ALOHA
r ALOHA
r CSMA, CSMA/CD, CSMA/CA
5: DataLink Layer


5-22


Slotted ALOHA
Assumptions
Ì all frames same size
Ì time is divided into
equal size slots, time to
transmit 1 frame
Ì nodes start to transmit
frames only at
beginning of slots
Ì nodes are synchronized
Ì if 2 or more nodes
transmit in slot, all
nodes detect collision

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

5: DataLink Layer


5-23


Slotted ALOHA

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

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-24


Slotted Aloha efficiency
Efficiency is the long-run

fraction of successful slots
when there are many nodes,
each with many frames to send
Ì Suppose N nodes with

many frames to send,
each transmits in slot
with probability p
Ì prob that node 1 has
success in a slot
= p(1-p)N-1

Ì prob that any node has
a success = Np(1-p)N-1

Ì For max efficiency

with N nodes, find p*
that maximizes
Np(1-p)N-1
Ì For many nodes, take
limit of Np*(1-p*)N-1 as
N goes to infinity,
gives 1/e = .37

At best: channel
used for useful
transmissions 37%
of time!
5: DataLink Layer


5-25


Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Tải bản đầy đủ ngay
×