link layer - university of waterloocs456/w08/lectur… · · 2008-01-145: datalink layer 5-3...
TRANSCRIPT
5: DataLink Layer 5-1
Link Layer
r 5.1 Introduction and services
r 5.2 Error detection and correction
r 5.3Multiple access protocols
r 5.4 Link-layer Addressing
r 5.5 Ethernet
r 5.6 Link-layer switchesr 5.7 PPPr 5.8 Link Virtualization:
ATM, MPLS
5: DataLink Layer 5-2
Multiple Access Links and ProtocolsTwo types of “links”:r point-to-point
m PPP for dial-up accessm point-to-point link between Ethernet switch and host
r broadcast (shared wire or medium)m old-fashioned Ethernetm upstream HFCm 802.11 wireless LAN
shared wire (e.g., cabled Ethernet)
shared RF(e.g., 802.11 WiFi)
shared RF(satellite)
humans at a party(shared air, acoustical)
5: DataLink Layer 5-3
Multiple Access protocolsr single shared broadcast channel r two or more simultaneous transmissions by nodes:
interference m collision if node receives two or more signals at the same time
multiple access protocolr distributed algorithm that determines how nodes
share channel, i.e., determine when node can transmitr communication about channel sharing must use channel
itself! m no out-of-band channel for coordination
5: DataLink Layer 5-4
Ideal Multiple Access Protocol
Broadcast channel of rate R bps1. 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/M3. fully decentralized:
m no special node to coordinate transmissionsm no synchronization of clocks, slots
4. simple
We usually don’t achieve this ideal.
5: DataLink Layer 5-5
MAC Protocols: a taxonomyThree broad classes:r Channel Partitioning
m divide channel into smaller “pieces” (time slots, frequency, code)
m allocate piece to node for exclusive user Random Access
m channel not divided, allow collisionsm “recover” from collisions
r “Taking turns”m nodes take turns, but nodes with more to send can take
longer turns
5: DataLink Layer 5-6
Channel Partitioning MAC protocols: TDMA
TDMA: time division multiple accessr access to channel in "rounds" r each station gets fixed length slot (length = pkt
trans time) in each round r unused slots go idle r example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6
idle
1 3 4 1 3 4
6-slotframe
5: DataLink Layer 5-7
Channel Partitioning MAC protocols: FDMA
FDMA: frequency division multiple accessr channel spectrum divided into frequency bandsr each station assigned fixed frequency bandr unused transmission time in frequency bands go idle r example: 6-station LAN, 1,3,4 have pkt, frequency
bands 2,5,6 idle
freq
uenc
y ba
nds
time
FDM cable
5: DataLink Layer 5-8
Random Access Protocols
r When node has packet to sendm transmit at full channel data rate R.m no a priori coordination among nodes
r two or more transmitting nodes ? “collision”,r random access MAC protocol specifies:
m how to detect collisionsm how to recover from collisions (e.g., via delayed
retransmissions)r Examples of random access MAC protocols:
m slotted ALOHAm ALOHAm CSMA, CSMA/CD, CSMA/CA
5: DataLink Layer 5-9
Slotted ALOHA
Assumptions:r all frames same sizer time divided into equal
size slots (time to transmit 1 frame)
r nodes start to transmit only slot beginning
r nodes are synchronizedr if 2 or more nodes
transmit in slot, all nodes detect collision
Operation:r when node obtains fresh
frame, transmits in next slotm if no collision: node can
send new frame in next slot
m if collision: node retransmits frame in each subsequent slot with prob. p until success
5: DataLink Layer 5-10
Slotted ALOHA
Prosr single active node can
continuously transmit at full rate of channel
r highly decentralized: only slots in nodes need to be in sync
r simple
Consr collisions, wasting slotsr idle slotsr nodes may be able to
detect collision in less than time to transmit packet
r clock synchronization
5: DataLink Layer 5-11
Slotted Aloha efficiency
r suppose: N nodes with many frames to send, each transmits in slot with probability p
r prob that given node has success in a slot = p(1-p)N-1
r prob that any node has a success = Np(1-p)N-1
r max efficiency: find p* that maximizes Np(1-p)N-1
r for many nodes, take limit of Np*(1-p*)N-1
as N goes to infinity, gives:
Max efficiency = 1/e = .37
Efficiency : long-run fraction of successful slots (many nodes, all with many frames to send)
At best: channelused for useful transmissions 37%of time!
!
5: DataLink Layer 5-12
Pure (unslotted) ALOHAr unslotted Aloha: simpler, no synchronizationr when frame first arrives
m transmit immediately r collision probability increases:
m frame sent at t0 collides with other frames sent in [t0-1,t0+1]
5: DataLink Layer 5-13
Pure Aloha efficiencyP(success by given node) = P(node transmits) .
P(no other node transmits in [p0-1,p0] .
P(no other node transmits in [p0-1,p0] = p . (1-p)N-1 . (1-p)N-1
= p . (1-p)2(N-1)
… choosing optimum p and then letting n -> infty ...
= 1/(2e) = .18
even worse than slotted Aloha!
5: DataLink Layer 5-14
CSMA (Carrier Sense Multiple Access)
CSMA: listen before transmit:If channel sensed idle: transmit entire framer If channel sensed busy, defer transmission
r human analogy: don’t interrupt others!
5: DataLink Layer 5-15
CSMA collisions
collisions can still occur:propagation delay means two nodes may not heareach other’s transmission
collision:entire packet transmission time wasted
spatial layout of nodes
note:role of distance & propagation delay in determining collision probability
5: DataLink Layer 5-16
CSMA/CD (Collision Detection)CSMA/CD: carrier sensing, deferral as in CSMA
m collisions detected within short timem colliding transmissions aborted, reducing channel
wastage r collision detection:m easy in wired LANs: measure signal strengths,
compare transmitted, received signalsm difficult in wireless LANs: received signal strength
overwhelmed by local transmission strength r human analogy: the polite conversationalist
5: DataLink Layer 5-18
“Taking Turns” MAC protocols
channel partitioning MAC protocols:m share channel efficiently and fairly at high loadm inefficient at low load: delay in channel access,
1/N bandwidth allocated even if only 1 active node!
Random access MAC protocolsm efficient at low load: single node can fully
utilize channelm high load: collision overhead
“taking turns” protocolslook for best of both worlds!
5: DataLink Layer 5-19
“Taking Turns” MAC protocolsPolling:r master node
“invites” slave nodes to transmit in turn
r typically used with “dumb” slave devices
r concerns:m polling overhead m latencym single point of
failure (master)
master
slaves
poll
data
data
5: DataLink Layer 5-20
“Taking Turns” MAC protocolsToken passing:r control token passed
from one node to next sequentially.
r token messager concerns:
m token overhead m latencym single point of failure
(token)
T
data
(nothingto send)
T
5: DataLink Layer 5-21
Summary of MAC protocols
r channel partitioning, by time, frequency or codem Time Division, Frequency Division
r random access (dynamic), m ALOHA, S-ALOHA, CSMA, CSMA/CDm carrier sensing: easy in some technologies (wire), hard in
others (wireless)m CSMA/CD used in Ethernetm CSMA/CA used in 802.11
r taking turnsm polling from central site, token passingm Bluetooth, FDDI, IBM Token Ring
5: DataLink Layer 5-22
LAN technologiesData link layer so far:m services, error detection/correction, PPP,
multiple access Next: LAN technologiesm addressingm Ethernetm switches
5: DataLink Layer 5-23
Link Layer
r 5.1 Introduction and services
r 5.2 Error detection and correction
r 5.3Multiple access protocols
r 5.4 Link-Layer Addressing
r 5.5 Ethernet
r 5.6 Link-layer switchesr 5.7 PPPr 5.8 Link Virtualization:
ATM, MPLS
5: DataLink Layer 5-24
MAC Addresses
r Each node in a LAN has a link-layer address called a MAC (or LAN or physical or Ethernet) addressm used to indicate intended recipient of frame from
one interface to another physically-connected interface (on the same network link)
m 48 bit MAC address (for most LANs) burned in the adapter ROM
m usually written like this: 00:13:02:4B:80:D3m sometimes like this: 00-13-02-4B-80-D3
5: DataLink Layer 5-25
MAC AddressesEach adapter on LAN has unique LAN address
Broadcast address =FF-FF-FF-FF-FF-FF
= adapter
1A-2F-BB-76-09-AD
58-23-D7-FA-20-B0
0C-C4-11-6F-E3-98
71-65-F7-2B-08-53
LAN(wired orwireless)
5: DataLink Layer 5-26
MAC Addressesr Each adapter needs to have a unique MAC address
on its LAN (why?)m The easiest way to ensure this is to give each
adapter a globally unique MAC address.m Then any adapter can work on any LAN
(plug-and-play)
r MAC address allocation is administered by IEEEr Manufacturers buy a portion of the MAC address
space (to ensure uniqueness)m IEEE determines first 24 bits of MAC address for
each manufacturer.m The manufacturer creates unique combinations for
the last 24 bits of each adapter.
5: DataLink Layer 5-27
MAC Addressesr MAC addresses have a flat address structure
m If you move an adapter from one network to another, the address does not change
m We say MAC addresses are portable.
r We will see later that IP addresses are not portablem If you move a computer from one network to
another, its IP address does change
r Analogy:(a) MAC address: like Social Insurance Number(b) IP address: like postal address