L11_WiFiBluetoothx - Interactive Computing Lab

Download Report

Transcript L11_WiFiBluetoothx - Interactive Computing Lab

Chapter 6
Wireless and Mobile
Networks
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.
Computer Networking:
A Top Down Approach
5th edition.
Jim Kurose, Keith Ross
Addison-Wesley, April
2009.
Thanks and enjoy! JFK/KWR
All material copyright 1996-2009
J.F Kurose and K.W. Ross, All Rights Reserved
6: Wireless and Mobile Networks
6-1
Chapter 6: Wireless and Mobile Networks
Background:
 # wireless (mobile) phone subscribers now
exceeds # wired phone subscribers!
 computer nets: laptops, palmtops, PDAs,
Internet-enabled phone promise anytime
untethered Internet access
 two important (but different) challenges


wireless: communication over wireless link
mobility: handling the mobile user who changes point
of attachment to network
6: Wireless and Mobile Networks
6-2
Elements of a wireless network
network
infrastructure
wireless hosts
 laptop, PDA, IP phone
 run applications
 may be stationary
(non-mobile) or mobile

wireless does not
always mean mobility
6: Wireless and Mobile Networks
6-3
Elements of a wireless network
network
infrastructure
base station
 typically connected to
wired network
 relay - responsible
for sending packets
between wired
network and wireless
host(s) in its “area”
 e.g., cell towers,
802.11 access
points
6: Wireless and Mobile Networks
6-4
Elements of a wireless network
network
infrastructure
wireless link
 typically used to
connect mobile(s) to
base station
 also used as backbone
link
 multiple access
protocol coordinates
link access
 various data rates,
transmission distance
6: Wireless and Mobile Networks
6-5
Characteristics of selected wireless link
standards
Data rate (Mbps)
200
54
5-11
802.11n
802.11a,g
802.11b
4
1
802.11a,g point-to-point
data
802.16 (WiMAX)
UMTS/WCDMA-HSPDA, CDMA2000-1xEVDO
3G cellular
enhanced
802.15
.384
UMTS/WCDMA, CDMA2000
.056
3G
2G
IS-95, CDMA, GSM
Indoor
Outdoor
10-30m
50-200m
Mid-range
outdoor
Long-range
outdoor
200m – 4 Km
5Km – 20 Km
6: Wireless and Mobile Networks
6-6
Elements of a wireless network
network
infrastructure
infrastructure mode
 base station connects
mobiles into wired
network
 handoff: mobile
changes base station
providing connection
into wired network
6: Wireless and Mobile Networks
6-7
Elements of a wireless network
ad hoc mode
 no base stations
 nodes can only
transmit to other
nodes within link
coverage
 nodes organize
themselves into a
network: route among
themselves
6: Wireless and Mobile Networks
6-8
Wireless network taxonomy
single hop
infrastructure
(e.g., APs)
no
infrastructure
host connects to
base station (WiFi,
WiMAX, cellular)
which connects to
larger Internet
no base station, no
connection to larger
Internet (Bluetooth,
ad hoc nets)
multiple hops
host may have to
relay through several
wireless nodes to
connect to larger
Internet: mesh net
no base station, no
connection to larger
Internet. May have to
relay to reach other
a given wireless node
MANET, VANET
6: Wireless and Mobile Networks
6-9
Wireless Link Characteristics (1)
Differences from wired link ….
 decreased
signal strength: radio signal
attenuates as it propagates through matter
(path loss)
 interference from other sources: standardized
wireless network frequencies (e.g., 2.4 GHz)
shared by other devices (e.g., phone); devices
(motors) interfere as well
 multipath propagation: radio signal reflects off
objects ground, arriving ad destination at
slightly different times
…. make communication across (even a point to point)
wireless link much more “difficult”
6: Wireless and Mobile Networks
6-10
Wireless Link Characteristics (2)
 SNR: signal-to-noise ratio
larger SNR – easier to
extract signal from noise (a
“good thing”)
 SNR versus BER tradeoffs
 given physical layer:
increase power -> increase
SNR->decrease BER
 given SNR: choose physical
layer that meets BER
requirement, giving highest
thruput
10-1

• SNR may change with
mobility: dynamically adapt
physical layer (modulation
technique, rate)
10-2
BER
10-3
10-4
10-5
10-6
10-7
10
20
30
40
SNR(dB)
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
6: Wireless and Mobile Networks
6-11
Wireless network characteristics
Multiple wireless senders and receivers create
additional problems (beyond multiple access):
C
A
B
A
B
Hidden terminal problem
C
C’s signal
strength
A’s signal
strength
space
 B, A hear each other
Signal attenuation:
 A, C can not hear each other
 B, C hear each other
 B, C hear each other
 B, A hear each other
means A, C unaware of their
interference at B
 A, C can not hear each other
interfering at B
6: Wireless and Mobile Networks
6-12
IEEE 802.11 Wireless LAN
 802.11a
 802.11b
 5-6 GHz range
 2.4-5 GHz unlicensed spectrum
 up to 54 Mbps
 up to 11 Mbps
 802.11g
 direct sequence spread
spectrum (DSSS) in physical
 2.4-5 GHz range
layer
 up to 54 Mbps
• all hosts use same chipping
 802.11n: multiple antennae
code
 2.4-5 GHz range
 up to 200 Mbps
 all use CSMA/CA for multiple access
 all have base-station and ad-hoc network versions
6: Wireless and Mobile Networks
6-13
802.11 LAN architecture
 wireless host communicates
Internet
AP
hub, switch
or router
BSS 1
AP
BSS 2
with base station
 base station = access
point (AP)
 Basic Service Set (BSS)
(aka “cell”) in infrastructure
mode contains:
 wireless hosts
 access point (AP): base
station
 ad hoc mode: hosts only
6: Wireless and Mobile Networks
6-14
802.11: Channels, association
 802.11b: 2.4GHz-2.485GHz spectrum divided into
11 channels at different frequencies
 AP admin chooses frequency for AP
 interference possible: channel can be same as
that chosen by neighboring AP!
 host: must associate with an AP
 scans channels, listening for beacon frames
containing AP’s name (SSID) and MAC address
 selects AP to associate with
 may perform authentication [Chapter 8]
 will typically run DHCP to get IP address in AP’s
subnet
6: Wireless and Mobile Networks
6-15
802.11: passive/active scanning
BBS 1
AP 1
BBS 2
1
1
2
AP 2
BBS 1
BBS 2
AP 1
AP 2
1
2
3
2
3
4
H1
H1
Passive Scanning:
Active Scanning:
(1) beacon frames sent from APs
(2) association Request frame sent:
H1 to selected AP
(3) association Response frame sent:
H1 to selected AP
(1) Probe Request frame broadcast
from H1
(2) Probes response frame sent from
APs
(3) Association Request frame sent:
H1 to selected AP
(4) Association Response frame
sent: H1 to selected AP
6: Wireless and Mobile Networks
6-16
IEEE 802.11: multiple access
 avoid collisions: 2+ nodes transmitting at same time
 802.11: CSMA - sense before transmitting
 don’t collide with ongoing transmission by other node
 802.11: no collision detection!
 difficult to receive (sense collisions) when transmitting due
to weak received signals (fading)
 can’t sense all collisions in any case: hidden terminal, fading
 goal: avoid collisions: CSMA/C(ollision)A(voidance)
C
A
B
A
B
C
C’s signal
strength
A’s signal
strength
space
6: Wireless and Mobile Networks
6-17
IEEE 802.11 MAC Protocol: CSMA/CA
802.11 sender
1 if sense channel idle for DIFS then
sender
transmit entire frame (no CD)
2 if sense channel busy then
start random backoff time
timer counts down while channel idle
transmit when timer expires
if no ACK, increase random backoff
interval, repeat 2
receiver
DIFS
data
SIFS
ACK
802.11 receiver
- if frame received OK
return ACK after SIFS (ACK needed due
to hidden terminal problem)
6: Wireless and Mobile Networks
6-18
Avoiding collisions (more)
idea: allow sender to “reserve” channel rather than random
access of data frames: avoid collisions of long data frames
 sender first transmits small request-to-send (RTS) packets
to BS using CSMA
 RTSs may still collide with each other (but they’re short)
 BS broadcasts clear-to-send CTS in response to RTS
 CTS heard by all nodes
 sender transmits data frame
 other stations defer transmissions
avoid data frame collisions completely
using small reservation packets!
6: Wireless and Mobile Networks
6-19
Collision Avoidance: RTS-CTS exchange
A
B
AP
reservation collision
DATA (A)
defer
time
6: Wireless and Mobile Networks
6-20
802.11 frame: addressing
2
2
6
6
6
frame
address address address
duration
control
1
2
3
Address 1: MAC address
of wireless host or AP
to receive this frame
2
6
seq address
4
control
0 - 2312
4
payload
CRC
Address 4: used only
in ad hoc mode
Address 3: MAC address
of router interface to
which AP is attached
Address 2: MAC address
of wireless host or AP
transmitting this frame
6: Wireless and Mobile Networks
6-21
802.11 frame: addressing
R1 router
H1
Internet
AP
R1 MAC addr H1 MAC addr
dest. address
802.3 frame
(Ethernet)
AP MAC addr H1 MAC addr R1 MAC addr
address 1
address 2
source address
address 3
802.11 frame
6: Wireless and Mobile Networks
6-22
802.11 frame: more
frame seq #
(for RDT)
duration of reserved
transmission time (RTS/CTS)
2
2
6
6
6
frame
address address address
duration
control
1
2
3
2
Protocol
version
2
4
1
Type
Subtype
To
AP
6
2
1
seq address
4
control
1
From More
AP
frag
1
Retry
1
0 - 2312
4
payload
CRC
1
Power More
mgt
data
1
1
WEP
Rsvd
frame type
(RTS, CTS, ACK, data)
6: Wireless and Mobile Networks
6-23
802.11: mobility within same subnet
 H1 remains in same IP
subnet: IP address
can remain same
 switch: which AP is
associated with H1?
 self-learning
(Ch. 5):
switch will see frame
from H1 and
“remember” which
switch port can be
used to reach H1
router
hub or
switch
BBS 1
AP 1
AP 2
H1
BBS 2
6: Wireless and Mobile Networks
6-24
802.11: advanced capabilities
QAM256 (8 Mbps)
QAM16 (4 Mbps)
BPSK (1 Mbps)
operating point
10-1
10-2
10-3
BER
Rate Adaptation
 base station, mobile
dynamically change
transmission rate
(physical layer
modulation technique)
as mobile moves, SNR
varies
10-4
10-5
10-6
10-7
10
20
30
SNR(dB)
40
1. SNR decreases, BER
increase as node moves
away from base station
2. When BER becomes too
high, switch to lower
transmission rate but with
lower BER
6: Wireless and Mobile Networks
6-25
802.11: advanced capabilities
Power Management
 node-to-AP: “I am going to sleep until next
beacon frame”
 AP knows not to transmit frames to this
node
 node wakes up before next beacon frame
 beacon frame: contains list of mobiles with APto-mobile frames waiting to be sent
 node will stay awake if AP-to-mobile frames
to be sent; otherwise sleep again until next
beacon frame
6: Wireless and Mobile Networks
6-26
Personal Area Networks
IEEE 802.15 Task Group for WPAN
 802.15 WPAN focuses on the development of
consensus standards for Wireless Personal Area
Networks (WPAN) or short distance wireless networks

Task Group 1 (802.15.1): WPAN/Bluetooth
• Now led by Bluetooth SIG

Task Group 2 (802.15.2): Coexistence
Task Group 3 (802.15.3): High rate WPAN

Task Group 4 (802.15.4): Low rate WPAN

• Ultra-Wideband (UWB)
• ZigBee, WirelessHART, and MiWi
 WPANs address wireless networking of
portable and mobile computing devices such
as PCs, Personal Digital Assistants (PDAs),
peripherals, cell phones, pagers, and consumer
electronics
Example of home equipment
demanding network operations
Wireless Local Networks
Bluetooth Technology
Bluetooth
31
What’s With the Name?
 King Harald Bluetooth (A.D. 940 to 985)
 10th century Viking king in Denmark
 Credited for uniting the country and
established Christianity
 Viking states included Norway & Sweden,
which is the connection to Ericsson (creator
of bluetooth)
Bluetooth


A new global standard for data
and voice
Goodbye Cables !
Bluetooth
33
Ultimate Headset
Bluetooth
34
Cordless Computer
Bluetooth
35
Automatic Synchronization
In the Office
At Home
Bluetooth
36
Bluetooth
 In 1998 – Ericsson, IBM, Toshiba, Nokia and
Intel form Bluetooth Special Interest Group
(SIG).
 Universal short-range wireless capability
(2.4Ghz)
 Available globally for unlicensed users
 Supports open-ended list of applications

Data, audio, graphics, video
Version
Max data rate
1.2
0.7 Mbit/s
2.0 + EDR
2.1 Mbit/s
3.0 + HS
24 Mbit/s
6: Wireless and Mobile Networks
6-37
Radio Specification
 Classes of transmitters (on which Bluetooth
products are available):
Class
Maximum tx power
Range
mW
dBm
Class 1
100
20
~100 meter
Class 2
2.5
4
~10 meter
Class 3
1
0
~1 meter
6: Wireless and Mobile Networks
6-38
Bluetooth Standards Doc.
 Core specifications

Details of various layers of Bluetooth protocol
architecture
 Profile specifications
 Use
of Bluetooth technology to support various
applications
6: Wireless and Mobile Networks
6-39
Master - Slaves
 Master
Device in Piconet whose clock and hopping
sequence are used to synchronize all other
devices (slaves) in the Piconet.
 Carries out inquiry (peer discovery) and paging
procedure (connection setup, sync)

 Slaves
 Units within the piconet that are synchronized
to the master via its clock and hopping
sequence
Master - Slaves
 Point to Point Link
 Master - slave relationship
 Bluetooth devices can function as
masters or slaves
 Piconet
 It is the network formed by a Master
and one or more slaves (max 7)
 Each piconet is defined by a different
hopping channel to which users
synchronize to
 Each piconet has max capacity
 Hopping pattern is determined by the
master
m
s
m
s
s
s
Piconet Structure
Master
Active Slave
Parked Slave
Standby
Bluetooth
42
Connection State Machine
Inquiry
Page
Peer discovery
Connection setup
Standby
Connected
Transmit data
Park
Hold
Sniff
Bluetooth
43
Inquiry procedure
Inquiry Window (Tw_inq)
A
256 A-trains
Inquiry Scan
Window (Tw_inq_scan) (1)
Inquiry Packet
Inquiry Packet
(2)
Master
256 B-trains
Inquiry Response Packet
(4)
B
Inquiry Scan
Interval (Tinq_scan)
(3)
Random Back-off Interval
Slave
Time
“Page” procedure is very similar to “Inquiry” procedure
6: Wireless and Mobile Networks
6-44
Bluetooth Protocol Stack
Composed of protocols:
Allow Bluetooth devices to
locate each other and to
create, configure and manage
both physical and logical links
that allow higher layer
protocols and applications to
pass data through these
transport protocols
Applications
IP
SDP
Data
Audio
Transport Protocol
RFCOMM
L2CAP
Link Manager
Baseband
RF
6: Wireless and Mobile Networks
6-45
Transport Protocol
 Radio Frequency (RF)
 Sending and receiving modulated bit streams
 Baseband
 Defines the timing, framing
 Flow control on the link.
 Link Management Protocol (LMP)
 Managing the connection states.
 Enforcing fairness among slaves.
 Power management
 Logical Link Control &Adaptation Protocol (L2CAP)
 Handles multiplexing of higher level protocols
 Segmentation & reassembly of large packets
 Device discovery & QoS
Physical Link Types
 Synchronous Connection Oriented (SCO)
 Point to Point Full Duplex between Master & Slave
 Established once by master & kept alive till released
by Master
 Typically used for Voice (to guarantee continuity)
 Master reserves slots used for SCO link on the
channel to preserve time sensitive information
 Asynchronous Connection Link (ACL)
 For bursty data traffic (no slots are reserved)
 Point to Multipoint connection
 Symmetric & Asymmetric links possible
Middleware Protocols
Applications
Middleware Protocol
SDP
IP
RFCOMM
Data
Additional transport protocols to allow
existing and new applications to operate
over Bluetooth. Packet based telephony
control signaling protocol also present.
Also includes Service Discovery Protocol.
Audio
L2CAP
Link Manager
Baseband
RF
Bluetooth
48
Middleware Protocols
 Service Discovery Protocol (SDP)

Means for applications to discover device info,
services and its characteristics.
 TCP/IP
 Network
protocols for packet data
communication, routing
 RFCOMM

Cable replacement protocol, emulation of serial
ports over wireless network
Backup slides
Security

Security Measures







Limited/Restricted Access to authorized users.
Both Link Level Encryption & Authentication.
Personal Identification Numbers (PIN) for device access.
Long encryption keys are used (128 bit keys).
These keys are not transmitted over wireless. Other
parameters are transmitted over wireless which in
combination with certain information known to the device,
can generate the keys.
Further encryption can be done at the application layer.
Security values




Device Address-Public
Authentication Key(128 bits)-Private
Encryption Key(8-128 bits)-Private
Random Number
Bluetooth
51
Frequency Hop Spread-Spectrum
 Bluetooth channel is
represented by a pseudo
random hopping sequence
through the entire 79
RF frequencies
 Nominal hop rate of
1600 hops per second
 Channel Spacing is 1 MHz
6: Wireless and Mobile Networks
6-52
Time-Division Duplex Scheme
 Bluetooth devices use a Time-Division Duplex (TDD) scheme
 Channel is divided into consecutive slots (each 625 s)
 One packet can be transmitted per slot
 Subsequent slots are alternatively used for transmitting and
receiving



Strict alternation of slots between the master and the slaves
Master can send packets to a slave only in EVEN slots
Slave can send packets to the master only in the ODD slots
53
Bluetooth in Android
 Main classes:
 BluetoothAdapter: local Bluetooth device
 BluetoothDevice: representing each remote
device with which we want to communicate with
 BluetoothSocket: call
“createRfcommSocketToServiceRecord()” on a
remote Bluetooth Device object to create a
Bluetooth socket
 BluetoothServerSocket: creating a Bluetooth
server socket by calling
“listenUsingRfcommWithServiceRecord”
method
6: Wireless and Mobile Networks
6-54
Accessing local Bluetooth adapter
 Managing Bluetooth properties and state
BluetoothAdapter bt =
BluetoothAdapter.getDefaultAdapter();
 Read/set Bluetooth properties using the
adapter

• bt.getAddress(), bt.setName(“Blackfang”);
• Reading BT state: bt.getState()
– STATE_TURNING__ON
– STATE_ON
– STATE_TURNING_OFF
– STATE_OFF
6: Wireless and Mobile Networks
6-55
Connection State Machine

Inquiry Scan


Inquiry



A device that wants to be discovered will
periodically enter this mode and listen for inquiry
packets.
Device sends an Inquiry packet addressed to GIAC
or DIAC
Transmission is repeated on the inquiry hop
sequence of frequencies.
Inquiry Response

When an inquiry message is received in the inquiry
scan state, a response packet (FHS) containing the
responding device address must be sent after a
random number of slots.
Bluetooth
56
Connection State Machine

Page



The master uses the clock information, about the slave
to be paged, to determine where in the hop sequence,
the slave might be listening in the page scan mode.
The master sends a page message
Page Scan


(contd.)
The page scan substate can be entered by the slave
from the standby state or the connection state. It
listens to packets addressed to its DAC.
Page Response

On receiving the page message, the slave enters the
slave page response substate. It sends back a page
response consisting of its ID packet which contains its
DAC, at the frequency for the next slot from the one in
which page message was received.
Bluetooth
57
Power Control Modes

Sniff Mode



This is a low power mode in which the listening activity of
the slave is reduced.
In the sniff mode, the slave listens for transmissions
only at fixed intervals Tsniff, at the offset slot Dsniff for
Nsniff times. These parameters are given by the LMP in
the master when it issues the SNIFF command to the
slave.
Hold Mode



Slave temporarily (for Thold sec) does not support ACL
packets on the channel (possible SCO links will still be
supported).
By this capacity can be made free to do other things like
scanning, paging, inquiring, or attending another piconet.
The slave unit keeps its active member address
(AM_ADDR).
Bluetooth
58
Power Control Modes

(contd.)
Park Mode






This is a very low power mode with very little activity.
The slave however, stays synchronized to the channel.
The parked slaves regularly listen for beacon signals at
intervals decided by the beacon structure communicated
to the slave during the start of parking.
The parked slave has to be informed about a transmission
in a beacon channel which is supported by the master to
keep parked slaves in synchronization and send them any
other information.
Any message to be sent to a parked member are sent
over the broadcast channel.
It also helps the master to have more than seven slaves.
Bluetooth
59