1 第 2 章 ieee 802.11 网络 石高涛 [email protected] 天津大学计算机科学与技术学院
TRANSCRIPT
2
提纲
• 网络结构与协议家族• WiFi网络移动性支持• 无线网络MAC协议• IEEE 802.11与帧格式• WiFi能量管理与拥塞避免
3
网络结构与协议家族
44
802.11 Architecture – Two modes
5
基于无线路由器的 WiFi 网络
6
WiFi Direct• 2010 年 10 月, Wi-Fi Alliance ( Wi-Fi 联
盟)发布 Wi-Fi Direct 白皮书,• Wi-Fi Direct 标准是指允许无线网络中的设
备无需通过无线路由器即可相互连接。• 与蓝牙技术类似,这种标准允许无线设备以
点对点形式互连,而且在传输速度与传输距离方面则比蓝牙有大幅提升。
77
Applications
Single Hop (including directed connected)• Home networks• Enterprise networks (e.g., offices, labs, etc.)• Outdoor areas (e.g., cities, parks, etc.)
Multi-hops• Ad Hoc network of small groups (e.g.,aircrafts)• Balloon networks (Space Data Inc.)• Mesh networks (e.g., routers on lamp-posts)
88
IEEE 802.11 in OSI Model
Wireless
9
IEEE 802.11 协议栈
10
PHY spec• Infrared PHY (No products !)
– diffuse infrared– 1 and 2Mbps
• Radio PHY – Frequency hopping PHY– Direct Sequence PHY– CCA (clear channel assessment) - how to
sense a channel is clear:• energy level is above a threshold• can detect a signal• use both
Frequency Bands- ISM
ExtremelyLow
VeryLow
Low Medium High VeryHigh
UltraHigh
SuperHigh
Infrared VisibleLight
Ultra-violet
X-Rays
AudioAM Broadcast
Short Wave Radio FM BroadcastTelevision Infrared wireless LAN
902 - 928 MHz26 MHz
Cellular (840MHz)NPCS (1.9GHz)
2.4 - 2.4835 GHz
83.5 MHz(IEEE 802.11)
5 GHz(IEEE 802.11)
HyperLANHyperLAN2
• Industrial, Scientific, and Medical (ISM) bands• Unlicensed, 22 MHz channel bandwidth
1212Wireless LANsWireless LANs Prof. F. TobagiProf. F. Tobagi
802.11 DSSS and 802.11b PHY Specifications802.11 DSSS and 802.11b PHY Specifications
Frequency and rate in the standard
• 802.11 specifies 1 & 2 Mbps
• 802.11b specifies additional 5.5 & 11 Mbps rates
MAC Layer
2.4 GHz2.4 GHz
FHSSFHSS
1 Mbps
2 Mbps
2.4 GHz2.4 GHz
DSSSDSSS
1 Mbps
2 Mbps
InfraredInfrared
IRIR
1 Mbps
2 Mbps
5 GHz5 GHz
OFDMOFDM6, 9, 12,
18, 24, 36,
48, 54 Mbps
2.4 GHz2.4 GHz
DSSSDSSS
5.5 Mbps
11 Mbps
IEEE 802.11 IEEE 802.11a IEEE 802.11b
PH
Y L
ayer
Data Rates• The data rates supported by 802.11b standard
1, 2, 5.5 and 11Mbps• The data rates supported by 802.11g standard
1, 2 ,5.5, 11, 6, 9, 12, 18, 24, 36, 48 and 54• The data rates supported by 802.11a standard
6, 12 and 24Mbps are mandatory and9, 18, 36, 48 and 54Mbps are optional
• AP and IBSS creators announce set of Basic rates and supported rates in the Beacons and Probe Response packets.
• Station announces supported rate information in Probe Request and (Re) Association packets
14
Direct Sequence Spread Spectrum
15
• Each bit represented by multiple bits using spreading code
• Spreading code spreads signal across wider frequency band– In proportion to number of bits used– 10 bit spreading code spreads signal across 10 times
bandwidth of 1 bit code
• One method:– Combine input with spreading code using XOR– Input bit 1 inverts spreading code bit– Input zero bit doesn’t alter spreading code bit
11-chip Barker sequence in 802.11
Direct Sequence Spread Spectrum
16
Direct Sequence Spread Spectrum
• In a nutshell, the data stream is combined is via an XOR function with a high-speed pseudo-random numerical sequence (PN)
• The PRN specified by 802.11 is an 11 chip Barker Code
17
Direct Sequence Spread Spectrum
18
Direct Sequence Spread Spectrum Example
19
CCA (Clear Channel Assessment)
• CCA mechanism is used to determine when it is OK to transmit by a station.
• Energy Detection– A number of energy samples will be collected for the estima
te over sensing time.– Using these samples, the energy detection CCA mechanis
m estimates the power of the signal observed and compares the estimate to a threshold.
• Energy detection threshold is a function of Tx power– Tx power > 100 mW: -80 dBm (-76 dBm for 802.11b)– Tx power > 50 mW: -76 dBm (-73 dBm for 802.11b)– Tx power 50 mW: -70 dBm
• The CCA detection time is set to 15 s
20
WiFi网络移动性支持
21
Roaming in 802.11
22
Roaming Approach• Station decides that link to its current AP is poor• station uses scanning function to find another AP• station sends Reassociation Request to new AP• if Reassociation Response is successful
– then station has roamed to the new AP– else station scans for another AP
• if AP accepts Reassociation Request– AP indicates Reassociation to the Distribution Sy
stem– Distribution System information is updated– normally old AP is notified thru distributation sys
tem
23
Scanning• Scanning required for many functions
– finding and joining a network– finding a new AP while roaming– initializing an ad hoc network
• 802.11 MAC uses a common mechanism– Passive scanning
• by listening for Beacons– Active Scanning
• probe + response
24
Active scanning
Steps to Association:
Station sends ProbeAPs send Probe Respons
eStation selects best AP:Station sends Association
Request to select APAP sends Association Re
sponse
25
802.11b Physical Channels• 11 partially overlapping channels
– 11 channels, each 22MHz wide, placed 5MHz apart
– Channel 1 is placed at center freq. 2.412 GHz, Channel 2 at 2.417 GHz, and so on
– Channels 1, 6 & 11 is the only set of three nonoverlapping channels
26
IEEE 802.11 Handoff Procedure
• The overall handoff delay consists of the following components: – channel switching time, (4.8 ms)– Channel dwell time,(100 ms) – authentication delay and re-association delay. a
(few ms)
27
Fast Handoff with Null Dwell Time
Xi Chen and Daji Qiao, "HaND: Fast Handoff with Null Dwell Time for IEEE 802.11 Networks," IEEE InfoCom 2010
28
无线网络MAC协议
29
Multiple Access Control (MAC) Protocols
• MAC protocol: coordinates transmissions from different stations to minimize/avoid collisions
– (a) Channel Partitioning MAC protocols: TDMA, FDMA, CDMA
– (b) Random Access MAC protocols: CSMA, MACA
– (c) “Taking turns” MAC protocols: polling
• Goal: efficient, fair, simple, decentralized
30
Wired Vs Wireless Media Access
Both are on shared media.Then, what’s really the problem ?
31
The Trivial Solution
• Transmit and pray– Plenty of collisions --> poor throughput at high
load
AA CCBB
collision
32
The Simple Fix
• Transmit and pray– Plenty of collisions --> poor throughput at high
load
• Listen before you talk– Carrier sense multiple access (CSMA)– Defer transmission when signal on channel
AA CCBB
Don’ttransmit
Don’ttransmit
Can collisions still occur?Can collisions still occur?
3333
CSMA collisions
Collisions can still occur:Propagation delay non-zero between transmitters
When collision:Entire packet transmission time wasted
spatial layout of nodes
note:Role of distance & propagation delay in determining collision probability
34
CSMA/CD (Collision Detection)• Keep listening to channel
– While transmitting
• If (Transmitted_Signal != Sensed_Signal) Sender knows it’s a Collision ABORT
35
2 Observations on CSMA/CD
• Transmitter can send/listen concurrently– If (Transmitted - Sensed = null)? Then succes
s
• The signal is identical at Tx and Rx– Non-dispersive
Unfortunately …Both observations do not hold for wireless Because …………
36
A B
C D
Distance
Signalpower
A cannot send and listen in parallel
Signal not same at different locations
Wireless Medium Access Control
37
Collision Detection Difficult
• Signal reception based on SINR
– Transmitter can only hear itself
– Cannot determine signal quality at receiver
A CD
B
38
The Emergence of MACA, MACAW, & 802.11
• Wireless MAC proved to be non-trivial
• 1992 - research by Karn (MACA)
• 1994 - research by Bhargavan (MACAW)
• Led to IEEE 802.11 committee– The standard was ratified in 1999
39
IEEE 802.11与帧格式
40
Basic MAC Features• DCF: Carrier sense multiple access with collisio
n avoidance (CSMA/CA) based– based on carrier sense function in PHY called
Clear Channel Assessment (CCA)– CSMA/CA+ACK for unicast frames, with MAC l
evel recovery– parameterized use of RTS/CTS to protect agai
nst hidden nodes– frame formats to support both infrastructure a
nd ad-hoc networks• PCF (option, not been widely implemented)
– centralized, polling based– restricted to infrastructure network
41
Frame Format
Frame Control Field
• Addressing: Address 1 Address 2 Address 3 Address 4
– Ad hoc: DA SA BSSID -– From AP: DA BSSID SA -– To AP: BSSID SA DA - – AP to AP: RA TA DA SA
42
CSMA/CA+ACK: 4-way handshake
• MAC headers format differs per type– control frames: RTS, CTS, ACK– management frames, e.g. beacon, probe/probe
response, (re)-association request/response,– data frames
4343
CTS = Clear To Send
RTS = Request To Send
IEEE 802.11
D
Y
S
M
K
RTS
CTS
X
Carrier sense multiple access with collision avoidance (CSMA/CA)
4444
IEEE 802.11
D
Y
S
X
M
Ksilenced
silenced
silenced
silencedData
ACK
Carrier sense multiple access with collision avoidance (CSMA/CA)
45
802.11 Steps
• All nodes choose a random number– R = rand (0, CW_min)
• Each node counts down R– Continue carrier sensing while counting down– Once carrier busy, freeze countdown
• Whoever reaches ZERO transmits RTS– Neighbors freeze countdown, decode RTS– RTS contains (CTS + DATA + ACK) duration = T_co
mm– Neighbors set NAV = T_comm
• Remains silent for NAV time
4646
802.11 Steps
• Receiver replies with CTS– Also contains (DATA + ACK) duration.– Neighbors update NAV again
• Tx sends DATA, Rx acknowledges with ACK– After ACK, everyone initiates remaining countdown– Tx chooses new R = rand (0, CW_min)
• If RTS or DATA collides (i.e., no CTS/ACK returns)– Indicates collision– RTS chooses new random no. R1 = rand (0, 2*CW_mi
n)– Note Exponential Backoff Ri = rand (0, 2^i * CW_min)– Once successful transmission, reset to rand(0, CW_
min)
47
But is that enough?
48
RTS/CTS• Does it solve hidden terminals ?
– Assuming carrier sensing zone = communication zone
C
F
A B
E
D
CTS
RTS
E does not receive CTS successfully Can later initiate transmission to D.Hidden terminal problem remains.
E does not receive CTS successfully Can later initiate transmission to D.Hidden terminal problem remains.
CTS
49
Hidden Terminal Problem• How about increasing carrier sense range
??– E will defer on sensing carrier no collision
!!!
CB DData
A
E
CTS
RTSF
50
Hidden Terminal Problem• But what if barriers/obstructions ??
– E doesn’t hear C Carrier sensing does not help
CB DData
A
EF
CTS
RTS
51
Exposed Terminal• B should be able to transmit to A
– RTS prevents this
CA B
E
D
CTSRTS
52
Exposed Terminal• B should be able to transmit to A
– Carrier sensing makes the situation worse
CA B
E
D
CTSRTS
53
Thoughts !• 802.11 does not solve HT/ET completely
– Only alleviates the problem through RTS/CTS and recommends larger CS zone
• Large CS zone aggravates exposed terminals – Spatial reuse reduces A tradeoff– RTS/CTS packets also consume bandwidth– Moreover, backing off mechanism is also wasteful
The search for the best MAC protocol is still on. However, 802.11 is being optimized too.
Thus, wireless MAC research still alive
54
WiFi能量管理与拥塞避免
55
Limited Power in Mobile Devices
WLAN
Internet
Access Point (AP)
WiFi Phone
LaptopPDA
YouTube Servers
Windows/Real Media Server
Question: Can we reduce power consumption of Wireless Network Interface while satisfying the QoS requirement?
Web Server
Wireless NetworkInterface
is a major powerconsuming source!
56
Power Management in 802.11• A station can be in one of three states: - Transmitter on - Receiver only on - Dozing: Both transmitter and receivers off• Access point (AP) buffers traffic for dozing
stations• AP announces which stations have frames
buffered. Traffic indication map included in each beacon. All multicasts/broadcasts are buffered.
• Dozing stations wake up to listen to the beacon. If there is data waiting for it, the station sends a poll frame to get the data.
57
PSM Implementation at AP• Most APs implemented PSM packet delivery in
one of two ways: – Normal: Buffered PSM packets at the tail of the tran
smission queue are enqueued– High priority: Buffered PSM packets are queued the
packets in a separate transmission queue with a different priority.
NAPman: Network-Assisted Power Management for WiFi Devices. Eric Rozner. MobiSys, 2010.
58
DozyAP: Power-Efficient Wi-Fi Tethering
[MOBISYS '12] DozyAP: Power-Efficient Wi-Fi Tethering
59
What is Wi-Fi Tethering
Sharing a cellular data connection via Wi-Fi An Internet-capable mobile phone acts as a Soft
Access Point (SoftAP) Also known as “Mobile Hotspot”
soft access point (a.k.a., mobile hotspot)
[MOBISYS '12] DozyAP: Power-Efficient Wi-Fi Tethering
60
Nexus One(Android)
HTC HD7(WP)
iPhone 4(iOS)
Wi-Fi Tethering is a "Battery Killer"
Wi-Fi tethering disabled Wi-Fi tethering enabled
(idle)
Power Battery Life Power Battery Life
Nexus One 20 mW 259 hours 270 mW 19 hours
HTC HD7 32 mW 150 hours 302 mW 16 hours
iPhone 4 22 mW 247 hours 333 mW 16 hours
Even when idle, battery life is reduced from days to hours Practical usage will draw battery more quickly
Intuitively, the Wi-Fi interface should be put to sleep when the Wi-Fi network is idle
61
Sources of Idle Time
Network traffic is bursty and idle for most of time Speed discrepancy between cellular and Wi-Fi
Wi-Fi Cellular
up to 54Mbps for 802.11a/gup to 600Mbps for 802.11n
up to 2Mbps for 3GUp to 100Mbps for LTE 4G
Many opportunities SoftAP could and should sleep !
[MOBISYS '12] DozyAP: Power-Efficient Wi-Fi Tethering
62
Two way hand-shake protocol Sleep request Sleep response
SoftAP sleeps only if receiving sleep response
Sleep Request-Response Protocol
Ethernet Header(type = 0xffff)
TypeSequence Number
Sleep Duration
The Sleep “Request-Response” Protocol
0x1: sleep request0x2: sleep response
t0
t1
idle > threshold
t2
t3
sleep
any buffered data
YesNo
any delayeddata
YesNo
data
data
sleep request
sleep response
sleep request
sleep response data
SoftAP Client
63
Congestion Avoidance:IEEE 802.11 DCF
• Before transmitting a packet, randomly choose a backoff interval in the range [0,cw]– cw is the contention window
• Direct access when medium is sensed free longer than DIFS, otherwise defer and backoff
• “Count down” the backoff interval when medium is idle– Count-down is suspended if medium becom
es busy• When backoff interval reaches 0, transmit pack
et (or RTS)
64
DCF Example (count down)
data
waitB1 = 5
B2 = 15
B1 = 25
B2 = 20
data
wait
B1 and B2 are backoff intervalsat nodes 1 and 2
Let cw = 31
B2 = 10
65
Congestion Avoidance
• The time spent counting down backoff intervals contributes to MAC overhead
• Choosing a large cw leads to large backoff intervals and can result in larger overhead
• Choosing a small cw leads to a larger number of collisions (more likely that two nodes count down to 0 simultaneously)
66
Congestion Control
• Since the number of nodes attempting to transmit simultaneously may change with time, some mechanism to manage congestion is needed
• IEEE 802.11 DCF: Congestion control achieved by dynamically adjusting the contention window cw
67
Binary Exponential Backoff in DCF
• When a node fails to receive CTS in response to its RTS, it increases the contention window
– cw is doubled (up to an upper bound – typically 5 times)
• When a node successfully completes a data transfer, it restores cw to CWmin