CSCD 433 Network Programming Fall 2012

34
1 CSCD 433 Network Programming Fall 2012 Lecture 7 Ethernet and Wireless 802.11

description

CSCD 433 Network Programming Fall 2012. Lecture 7 Ethernet and Wireless 802.11. 1. Topics. 802 Standard MAC and LLC Sublayers Review of MAC in Ethernet MAC in 802.11 Wireless. 2. IEEE Standards. In 1985, Computer Society of IEEE started a project, called Project 802, - PowerPoint PPT Presentation

Transcript of CSCD 433 Network Programming Fall 2012

Page 1: CSCD 433 Network Programming Fall 2012

1

CSCD 433Network ProgrammingFall 2012

Lecture 7Ethernet and Wireless 80211

Topics

bull 802 Standard bull MAC and LLC Sublayersbull Review of MAC in Ethernetbull MAC in 80211 Wireless

2

IEEE Standards

bull In 1985 Computer Society of IEEE started In 1985 Computer Society of IEEE started

a project called Project 802a project called Project 802

bull Set standards to enable Set standards to enable

intercommunication among equipment intercommunication among equipment

from a variety of manufacturersfrom a variety of manufacturers

bull Project 802Project 802

ndash Specifies functions of physical layer and Specifies functions of physical layer and

the data link layer of major LAN the data link layer of major LAN

protocolsprotocols

IEEE 802 Series of LAN Standards

802 standards free to download from httpstandardsieeeorggetieee802

WiMAX

IEEE 802 Standard

bull Complete specification of 802 standard

5

6

IEEE 80211 Protocol Architecture

Physical Layer

7

80211 Physical Layerbull Issued in four stagesbull 1997 First part

bull IEEE 80211 bull Includes MAC layer and three physical layer

specificationsbull Two in 24-GHz band and one infraredbull All operating at 1 and 2 Mbps

bull 1999 Two additional partsbull IEEE 80211a

bull 5-GHz band data rate up to 54 Mbpsbull IEEE 80211b

bull 24-GHz band data rate at 55 and 11 Mbpsbull 2002 Most recent

bull IEEE 80211g extends IEEE 80211b to higher data rates up to 54 Mbps

bull At presentbull IEEE 80211n data rate up to hundreds of Mbps

Review of Classical or Standard Ethernet

Review of Ethernet

bull Recall that Ethernet was a shared technologybull Everyone had access to the wires bull Users had to contend with collisions and the

MAC layer protocol dealt with these collisionsbull Review the characteristics of Ethernet to better

understand 80211 wireless LANs

Ethernet Recap

bull Classic Ethernet bull One long cable 500 meter max segmentbull Snaked around building as single long cablebull All computers attached

bull Thick Ethernetbull Began as thick yellow cable marked every

25 meters to show computer attachments

bull Thin Ethernetbull Thinner bent more easily connections with

BNC connectorsbull Cheaper to install 185 meter max segment

Ethernet Recap

bull Ethernet could contain multiple segments and multiple repeaters

bull Used CSMACD for shared media bull What does CSMACD stand for

Carrier Sense Multiple AccessCollision Detection

bull Review this

12

CSMACD Protocol

All hosts transmit amp receive on one channelPackets are of variable size

When a host has a packet to transmit1 Carrier Sense Check that the line is quiet before transmitting2 Collision Detection Detect collision as soon as Possible Collision is detected stop transmitting wait a random time then return to step 1

binary exponential backoff

13

Ethernet CSMACD algorithm

Algorithm1 NIC receives datagram from network

layer creates frame

2 If NIC senses channel idle starts frame transmission

If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

Ethernet CSMACD algorithm

4 If NIC detects another transmission while transmitting aborts and sends jam signal5 After aborting NIC enters exponential backoff after mth collision NIC chooses a K small integer at random from 012hellip2m-1 NIC then waits K512 bit time

bull Returns to Step 2

14

15

Wireless Communication Systems amp Networking

- What complicates wireless networking vs wired networking

16

Wireless Link Characteristics (1)Differences from wired link hellip

bull Decreased signal strength Radio signal attenuates as it propagates through matter (path loss)

bull Interference from other sources Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) devices (motors) interfere as well

bull Multipath propagation Radio signal reflects off objects ground arriving ad destination at slightly different times

hellip make communication across link much more ldquodifficultrdquo

17

80211 Medium Access Controlbull MAC layer has three functions

bull Reliable data delivery

bull Different from Ethernet wireless LANs suffer from considerable unreliability

bull Access control

bull Distributed access

bull Centralized access

bull Security

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 2: CSCD 433 Network Programming Fall 2012

Topics

bull 802 Standard bull MAC and LLC Sublayersbull Review of MAC in Ethernetbull MAC in 80211 Wireless

2

IEEE Standards

bull In 1985 Computer Society of IEEE started In 1985 Computer Society of IEEE started

a project called Project 802a project called Project 802

bull Set standards to enable Set standards to enable

intercommunication among equipment intercommunication among equipment

from a variety of manufacturersfrom a variety of manufacturers

bull Project 802Project 802

ndash Specifies functions of physical layer and Specifies functions of physical layer and

the data link layer of major LAN the data link layer of major LAN

protocolsprotocols

IEEE 802 Series of LAN Standards

802 standards free to download from httpstandardsieeeorggetieee802

WiMAX

IEEE 802 Standard

bull Complete specification of 802 standard

5

6

IEEE 80211 Protocol Architecture

Physical Layer

7

80211 Physical Layerbull Issued in four stagesbull 1997 First part

bull IEEE 80211 bull Includes MAC layer and three physical layer

specificationsbull Two in 24-GHz band and one infraredbull All operating at 1 and 2 Mbps

bull 1999 Two additional partsbull IEEE 80211a

bull 5-GHz band data rate up to 54 Mbpsbull IEEE 80211b

bull 24-GHz band data rate at 55 and 11 Mbpsbull 2002 Most recent

bull IEEE 80211g extends IEEE 80211b to higher data rates up to 54 Mbps

bull At presentbull IEEE 80211n data rate up to hundreds of Mbps

Review of Classical or Standard Ethernet

Review of Ethernet

bull Recall that Ethernet was a shared technologybull Everyone had access to the wires bull Users had to contend with collisions and the

MAC layer protocol dealt with these collisionsbull Review the characteristics of Ethernet to better

understand 80211 wireless LANs

Ethernet Recap

bull Classic Ethernet bull One long cable 500 meter max segmentbull Snaked around building as single long cablebull All computers attached

bull Thick Ethernetbull Began as thick yellow cable marked every

25 meters to show computer attachments

bull Thin Ethernetbull Thinner bent more easily connections with

BNC connectorsbull Cheaper to install 185 meter max segment

Ethernet Recap

bull Ethernet could contain multiple segments and multiple repeaters

bull Used CSMACD for shared media bull What does CSMACD stand for

Carrier Sense Multiple AccessCollision Detection

bull Review this

12

CSMACD Protocol

All hosts transmit amp receive on one channelPackets are of variable size

When a host has a packet to transmit1 Carrier Sense Check that the line is quiet before transmitting2 Collision Detection Detect collision as soon as Possible Collision is detected stop transmitting wait a random time then return to step 1

binary exponential backoff

13

Ethernet CSMACD algorithm

Algorithm1 NIC receives datagram from network

layer creates frame

2 If NIC senses channel idle starts frame transmission

If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

Ethernet CSMACD algorithm

4 If NIC detects another transmission while transmitting aborts and sends jam signal5 After aborting NIC enters exponential backoff after mth collision NIC chooses a K small integer at random from 012hellip2m-1 NIC then waits K512 bit time

bull Returns to Step 2

14

15

Wireless Communication Systems amp Networking

- What complicates wireless networking vs wired networking

16

Wireless Link Characteristics (1)Differences from wired link hellip

bull Decreased signal strength Radio signal attenuates as it propagates through matter (path loss)

bull Interference from other sources Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) devices (motors) interfere as well

bull Multipath propagation Radio signal reflects off objects ground arriving ad destination at slightly different times

hellip make communication across link much more ldquodifficultrdquo

17

80211 Medium Access Controlbull MAC layer has three functions

bull Reliable data delivery

bull Different from Ethernet wireless LANs suffer from considerable unreliability

bull Access control

bull Distributed access

bull Centralized access

bull Security

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 3: CSCD 433 Network Programming Fall 2012

IEEE Standards

bull In 1985 Computer Society of IEEE started In 1985 Computer Society of IEEE started

a project called Project 802a project called Project 802

bull Set standards to enable Set standards to enable

intercommunication among equipment intercommunication among equipment

from a variety of manufacturersfrom a variety of manufacturers

bull Project 802Project 802

ndash Specifies functions of physical layer and Specifies functions of physical layer and

the data link layer of major LAN the data link layer of major LAN

protocolsprotocols

IEEE 802 Series of LAN Standards

802 standards free to download from httpstandardsieeeorggetieee802

WiMAX

IEEE 802 Standard

bull Complete specification of 802 standard

5

6

IEEE 80211 Protocol Architecture

Physical Layer

7

80211 Physical Layerbull Issued in four stagesbull 1997 First part

bull IEEE 80211 bull Includes MAC layer and three physical layer

specificationsbull Two in 24-GHz band and one infraredbull All operating at 1 and 2 Mbps

bull 1999 Two additional partsbull IEEE 80211a

bull 5-GHz band data rate up to 54 Mbpsbull IEEE 80211b

bull 24-GHz band data rate at 55 and 11 Mbpsbull 2002 Most recent

bull IEEE 80211g extends IEEE 80211b to higher data rates up to 54 Mbps

bull At presentbull IEEE 80211n data rate up to hundreds of Mbps

Review of Classical or Standard Ethernet

Review of Ethernet

bull Recall that Ethernet was a shared technologybull Everyone had access to the wires bull Users had to contend with collisions and the

MAC layer protocol dealt with these collisionsbull Review the characteristics of Ethernet to better

understand 80211 wireless LANs

Ethernet Recap

bull Classic Ethernet bull One long cable 500 meter max segmentbull Snaked around building as single long cablebull All computers attached

bull Thick Ethernetbull Began as thick yellow cable marked every

25 meters to show computer attachments

bull Thin Ethernetbull Thinner bent more easily connections with

BNC connectorsbull Cheaper to install 185 meter max segment

Ethernet Recap

bull Ethernet could contain multiple segments and multiple repeaters

bull Used CSMACD for shared media bull What does CSMACD stand for

Carrier Sense Multiple AccessCollision Detection

bull Review this

12

CSMACD Protocol

All hosts transmit amp receive on one channelPackets are of variable size

When a host has a packet to transmit1 Carrier Sense Check that the line is quiet before transmitting2 Collision Detection Detect collision as soon as Possible Collision is detected stop transmitting wait a random time then return to step 1

binary exponential backoff

13

Ethernet CSMACD algorithm

Algorithm1 NIC receives datagram from network

layer creates frame

2 If NIC senses channel idle starts frame transmission

If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

Ethernet CSMACD algorithm

4 If NIC detects another transmission while transmitting aborts and sends jam signal5 After aborting NIC enters exponential backoff after mth collision NIC chooses a K small integer at random from 012hellip2m-1 NIC then waits K512 bit time

bull Returns to Step 2

14

15

Wireless Communication Systems amp Networking

- What complicates wireless networking vs wired networking

16

Wireless Link Characteristics (1)Differences from wired link hellip

bull Decreased signal strength Radio signal attenuates as it propagates through matter (path loss)

bull Interference from other sources Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) devices (motors) interfere as well

bull Multipath propagation Radio signal reflects off objects ground arriving ad destination at slightly different times

hellip make communication across link much more ldquodifficultrdquo

17

80211 Medium Access Controlbull MAC layer has three functions

bull Reliable data delivery

bull Different from Ethernet wireless LANs suffer from considerable unreliability

bull Access control

bull Distributed access

bull Centralized access

bull Security

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 4: CSCD 433 Network Programming Fall 2012

IEEE 802 Series of LAN Standards

802 standards free to download from httpstandardsieeeorggetieee802

WiMAX

IEEE 802 Standard

bull Complete specification of 802 standard

5

6

IEEE 80211 Protocol Architecture

Physical Layer

7

80211 Physical Layerbull Issued in four stagesbull 1997 First part

bull IEEE 80211 bull Includes MAC layer and three physical layer

specificationsbull Two in 24-GHz band and one infraredbull All operating at 1 and 2 Mbps

bull 1999 Two additional partsbull IEEE 80211a

bull 5-GHz band data rate up to 54 Mbpsbull IEEE 80211b

bull 24-GHz band data rate at 55 and 11 Mbpsbull 2002 Most recent

bull IEEE 80211g extends IEEE 80211b to higher data rates up to 54 Mbps

bull At presentbull IEEE 80211n data rate up to hundreds of Mbps

Review of Classical or Standard Ethernet

Review of Ethernet

bull Recall that Ethernet was a shared technologybull Everyone had access to the wires bull Users had to contend with collisions and the

MAC layer protocol dealt with these collisionsbull Review the characteristics of Ethernet to better

understand 80211 wireless LANs

Ethernet Recap

bull Classic Ethernet bull One long cable 500 meter max segmentbull Snaked around building as single long cablebull All computers attached

bull Thick Ethernetbull Began as thick yellow cable marked every

25 meters to show computer attachments

bull Thin Ethernetbull Thinner bent more easily connections with

BNC connectorsbull Cheaper to install 185 meter max segment

Ethernet Recap

bull Ethernet could contain multiple segments and multiple repeaters

bull Used CSMACD for shared media bull What does CSMACD stand for

Carrier Sense Multiple AccessCollision Detection

bull Review this

12

CSMACD Protocol

All hosts transmit amp receive on one channelPackets are of variable size

When a host has a packet to transmit1 Carrier Sense Check that the line is quiet before transmitting2 Collision Detection Detect collision as soon as Possible Collision is detected stop transmitting wait a random time then return to step 1

binary exponential backoff

13

Ethernet CSMACD algorithm

Algorithm1 NIC receives datagram from network

layer creates frame

2 If NIC senses channel idle starts frame transmission

If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

Ethernet CSMACD algorithm

4 If NIC detects another transmission while transmitting aborts and sends jam signal5 After aborting NIC enters exponential backoff after mth collision NIC chooses a K small integer at random from 012hellip2m-1 NIC then waits K512 bit time

bull Returns to Step 2

14

15

Wireless Communication Systems amp Networking

- What complicates wireless networking vs wired networking

16

Wireless Link Characteristics (1)Differences from wired link hellip

bull Decreased signal strength Radio signal attenuates as it propagates through matter (path loss)

bull Interference from other sources Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) devices (motors) interfere as well

bull Multipath propagation Radio signal reflects off objects ground arriving ad destination at slightly different times

hellip make communication across link much more ldquodifficultrdquo

17

80211 Medium Access Controlbull MAC layer has three functions

bull Reliable data delivery

bull Different from Ethernet wireless LANs suffer from considerable unreliability

bull Access control

bull Distributed access

bull Centralized access

bull Security

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 5: CSCD 433 Network Programming Fall 2012

IEEE 802 Standard

bull Complete specification of 802 standard

5

6

IEEE 80211 Protocol Architecture

Physical Layer

7

80211 Physical Layerbull Issued in four stagesbull 1997 First part

bull IEEE 80211 bull Includes MAC layer and three physical layer

specificationsbull Two in 24-GHz band and one infraredbull All operating at 1 and 2 Mbps

bull 1999 Two additional partsbull IEEE 80211a

bull 5-GHz band data rate up to 54 Mbpsbull IEEE 80211b

bull 24-GHz band data rate at 55 and 11 Mbpsbull 2002 Most recent

bull IEEE 80211g extends IEEE 80211b to higher data rates up to 54 Mbps

bull At presentbull IEEE 80211n data rate up to hundreds of Mbps

Review of Classical or Standard Ethernet

Review of Ethernet

bull Recall that Ethernet was a shared technologybull Everyone had access to the wires bull Users had to contend with collisions and the

MAC layer protocol dealt with these collisionsbull Review the characteristics of Ethernet to better

understand 80211 wireless LANs

Ethernet Recap

bull Classic Ethernet bull One long cable 500 meter max segmentbull Snaked around building as single long cablebull All computers attached

bull Thick Ethernetbull Began as thick yellow cable marked every

25 meters to show computer attachments

bull Thin Ethernetbull Thinner bent more easily connections with

BNC connectorsbull Cheaper to install 185 meter max segment

Ethernet Recap

bull Ethernet could contain multiple segments and multiple repeaters

bull Used CSMACD for shared media bull What does CSMACD stand for

Carrier Sense Multiple AccessCollision Detection

bull Review this

12

CSMACD Protocol

All hosts transmit amp receive on one channelPackets are of variable size

When a host has a packet to transmit1 Carrier Sense Check that the line is quiet before transmitting2 Collision Detection Detect collision as soon as Possible Collision is detected stop transmitting wait a random time then return to step 1

binary exponential backoff

13

Ethernet CSMACD algorithm

Algorithm1 NIC receives datagram from network

layer creates frame

2 If NIC senses channel idle starts frame transmission

If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

Ethernet CSMACD algorithm

4 If NIC detects another transmission while transmitting aborts and sends jam signal5 After aborting NIC enters exponential backoff after mth collision NIC chooses a K small integer at random from 012hellip2m-1 NIC then waits K512 bit time

bull Returns to Step 2

14

15

Wireless Communication Systems amp Networking

- What complicates wireless networking vs wired networking

16

Wireless Link Characteristics (1)Differences from wired link hellip

bull Decreased signal strength Radio signal attenuates as it propagates through matter (path loss)

bull Interference from other sources Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) devices (motors) interfere as well

bull Multipath propagation Radio signal reflects off objects ground arriving ad destination at slightly different times

hellip make communication across link much more ldquodifficultrdquo

17

80211 Medium Access Controlbull MAC layer has three functions

bull Reliable data delivery

bull Different from Ethernet wireless LANs suffer from considerable unreliability

bull Access control

bull Distributed access

bull Centralized access

bull Security

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 6: CSCD 433 Network Programming Fall 2012

6

IEEE 80211 Protocol Architecture

Physical Layer

7

80211 Physical Layerbull Issued in four stagesbull 1997 First part

bull IEEE 80211 bull Includes MAC layer and three physical layer

specificationsbull Two in 24-GHz band and one infraredbull All operating at 1 and 2 Mbps

bull 1999 Two additional partsbull IEEE 80211a

bull 5-GHz band data rate up to 54 Mbpsbull IEEE 80211b

bull 24-GHz band data rate at 55 and 11 Mbpsbull 2002 Most recent

bull IEEE 80211g extends IEEE 80211b to higher data rates up to 54 Mbps

bull At presentbull IEEE 80211n data rate up to hundreds of Mbps

Review of Classical or Standard Ethernet

Review of Ethernet

bull Recall that Ethernet was a shared technologybull Everyone had access to the wires bull Users had to contend with collisions and the

MAC layer protocol dealt with these collisionsbull Review the characteristics of Ethernet to better

understand 80211 wireless LANs

Ethernet Recap

bull Classic Ethernet bull One long cable 500 meter max segmentbull Snaked around building as single long cablebull All computers attached

bull Thick Ethernetbull Began as thick yellow cable marked every

25 meters to show computer attachments

bull Thin Ethernetbull Thinner bent more easily connections with

BNC connectorsbull Cheaper to install 185 meter max segment

Ethernet Recap

bull Ethernet could contain multiple segments and multiple repeaters

bull Used CSMACD for shared media bull What does CSMACD stand for

Carrier Sense Multiple AccessCollision Detection

bull Review this

12

CSMACD Protocol

All hosts transmit amp receive on one channelPackets are of variable size

When a host has a packet to transmit1 Carrier Sense Check that the line is quiet before transmitting2 Collision Detection Detect collision as soon as Possible Collision is detected stop transmitting wait a random time then return to step 1

binary exponential backoff

13

Ethernet CSMACD algorithm

Algorithm1 NIC receives datagram from network

layer creates frame

2 If NIC senses channel idle starts frame transmission

If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

Ethernet CSMACD algorithm

4 If NIC detects another transmission while transmitting aborts and sends jam signal5 After aborting NIC enters exponential backoff after mth collision NIC chooses a K small integer at random from 012hellip2m-1 NIC then waits K512 bit time

bull Returns to Step 2

14

15

Wireless Communication Systems amp Networking

- What complicates wireless networking vs wired networking

16

Wireless Link Characteristics (1)Differences from wired link hellip

bull Decreased signal strength Radio signal attenuates as it propagates through matter (path loss)

bull Interference from other sources Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) devices (motors) interfere as well

bull Multipath propagation Radio signal reflects off objects ground arriving ad destination at slightly different times

hellip make communication across link much more ldquodifficultrdquo

17

80211 Medium Access Controlbull MAC layer has three functions

bull Reliable data delivery

bull Different from Ethernet wireless LANs suffer from considerable unreliability

bull Access control

bull Distributed access

bull Centralized access

bull Security

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 7: CSCD 433 Network Programming Fall 2012

7

80211 Physical Layerbull Issued in four stagesbull 1997 First part

bull IEEE 80211 bull Includes MAC layer and three physical layer

specificationsbull Two in 24-GHz band and one infraredbull All operating at 1 and 2 Mbps

bull 1999 Two additional partsbull IEEE 80211a

bull 5-GHz band data rate up to 54 Mbpsbull IEEE 80211b

bull 24-GHz band data rate at 55 and 11 Mbpsbull 2002 Most recent

bull IEEE 80211g extends IEEE 80211b to higher data rates up to 54 Mbps

bull At presentbull IEEE 80211n data rate up to hundreds of Mbps

Review of Classical or Standard Ethernet

Review of Ethernet

bull Recall that Ethernet was a shared technologybull Everyone had access to the wires bull Users had to contend with collisions and the

MAC layer protocol dealt with these collisionsbull Review the characteristics of Ethernet to better

understand 80211 wireless LANs

Ethernet Recap

bull Classic Ethernet bull One long cable 500 meter max segmentbull Snaked around building as single long cablebull All computers attached

bull Thick Ethernetbull Began as thick yellow cable marked every

25 meters to show computer attachments

bull Thin Ethernetbull Thinner bent more easily connections with

BNC connectorsbull Cheaper to install 185 meter max segment

Ethernet Recap

bull Ethernet could contain multiple segments and multiple repeaters

bull Used CSMACD for shared media bull What does CSMACD stand for

Carrier Sense Multiple AccessCollision Detection

bull Review this

12

CSMACD Protocol

All hosts transmit amp receive on one channelPackets are of variable size

When a host has a packet to transmit1 Carrier Sense Check that the line is quiet before transmitting2 Collision Detection Detect collision as soon as Possible Collision is detected stop transmitting wait a random time then return to step 1

binary exponential backoff

13

Ethernet CSMACD algorithm

Algorithm1 NIC receives datagram from network

layer creates frame

2 If NIC senses channel idle starts frame transmission

If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

Ethernet CSMACD algorithm

4 If NIC detects another transmission while transmitting aborts and sends jam signal5 After aborting NIC enters exponential backoff after mth collision NIC chooses a K small integer at random from 012hellip2m-1 NIC then waits K512 bit time

bull Returns to Step 2

14

15

Wireless Communication Systems amp Networking

- What complicates wireless networking vs wired networking

16

Wireless Link Characteristics (1)Differences from wired link hellip

bull Decreased signal strength Radio signal attenuates as it propagates through matter (path loss)

bull Interference from other sources Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) devices (motors) interfere as well

bull Multipath propagation Radio signal reflects off objects ground arriving ad destination at slightly different times

hellip make communication across link much more ldquodifficultrdquo

17

80211 Medium Access Controlbull MAC layer has three functions

bull Reliable data delivery

bull Different from Ethernet wireless LANs suffer from considerable unreliability

bull Access control

bull Distributed access

bull Centralized access

bull Security

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 8: CSCD 433 Network Programming Fall 2012

Review of Classical or Standard Ethernet

Review of Ethernet

bull Recall that Ethernet was a shared technologybull Everyone had access to the wires bull Users had to contend with collisions and the

MAC layer protocol dealt with these collisionsbull Review the characteristics of Ethernet to better

understand 80211 wireless LANs

Ethernet Recap

bull Classic Ethernet bull One long cable 500 meter max segmentbull Snaked around building as single long cablebull All computers attached

bull Thick Ethernetbull Began as thick yellow cable marked every

25 meters to show computer attachments

bull Thin Ethernetbull Thinner bent more easily connections with

BNC connectorsbull Cheaper to install 185 meter max segment

Ethernet Recap

bull Ethernet could contain multiple segments and multiple repeaters

bull Used CSMACD for shared media bull What does CSMACD stand for

Carrier Sense Multiple AccessCollision Detection

bull Review this

12

CSMACD Protocol

All hosts transmit amp receive on one channelPackets are of variable size

When a host has a packet to transmit1 Carrier Sense Check that the line is quiet before transmitting2 Collision Detection Detect collision as soon as Possible Collision is detected stop transmitting wait a random time then return to step 1

binary exponential backoff

13

Ethernet CSMACD algorithm

Algorithm1 NIC receives datagram from network

layer creates frame

2 If NIC senses channel idle starts frame transmission

If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

Ethernet CSMACD algorithm

4 If NIC detects another transmission while transmitting aborts and sends jam signal5 After aborting NIC enters exponential backoff after mth collision NIC chooses a K small integer at random from 012hellip2m-1 NIC then waits K512 bit time

bull Returns to Step 2

14

15

Wireless Communication Systems amp Networking

- What complicates wireless networking vs wired networking

16

Wireless Link Characteristics (1)Differences from wired link hellip

bull Decreased signal strength Radio signal attenuates as it propagates through matter (path loss)

bull Interference from other sources Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) devices (motors) interfere as well

bull Multipath propagation Radio signal reflects off objects ground arriving ad destination at slightly different times

hellip make communication across link much more ldquodifficultrdquo

17

80211 Medium Access Controlbull MAC layer has three functions

bull Reliable data delivery

bull Different from Ethernet wireless LANs suffer from considerable unreliability

bull Access control

bull Distributed access

bull Centralized access

bull Security

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 9: CSCD 433 Network Programming Fall 2012

Review of Ethernet

bull Recall that Ethernet was a shared technologybull Everyone had access to the wires bull Users had to contend with collisions and the

MAC layer protocol dealt with these collisionsbull Review the characteristics of Ethernet to better

understand 80211 wireless LANs

Ethernet Recap

bull Classic Ethernet bull One long cable 500 meter max segmentbull Snaked around building as single long cablebull All computers attached

bull Thick Ethernetbull Began as thick yellow cable marked every

25 meters to show computer attachments

bull Thin Ethernetbull Thinner bent more easily connections with

BNC connectorsbull Cheaper to install 185 meter max segment

Ethernet Recap

bull Ethernet could contain multiple segments and multiple repeaters

bull Used CSMACD for shared media bull What does CSMACD stand for

Carrier Sense Multiple AccessCollision Detection

bull Review this

12

CSMACD Protocol

All hosts transmit amp receive on one channelPackets are of variable size

When a host has a packet to transmit1 Carrier Sense Check that the line is quiet before transmitting2 Collision Detection Detect collision as soon as Possible Collision is detected stop transmitting wait a random time then return to step 1

binary exponential backoff

13

Ethernet CSMACD algorithm

Algorithm1 NIC receives datagram from network

layer creates frame

2 If NIC senses channel idle starts frame transmission

If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

Ethernet CSMACD algorithm

4 If NIC detects another transmission while transmitting aborts and sends jam signal5 After aborting NIC enters exponential backoff after mth collision NIC chooses a K small integer at random from 012hellip2m-1 NIC then waits K512 bit time

bull Returns to Step 2

14

15

Wireless Communication Systems amp Networking

- What complicates wireless networking vs wired networking

16

Wireless Link Characteristics (1)Differences from wired link hellip

bull Decreased signal strength Radio signal attenuates as it propagates through matter (path loss)

bull Interference from other sources Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) devices (motors) interfere as well

bull Multipath propagation Radio signal reflects off objects ground arriving ad destination at slightly different times

hellip make communication across link much more ldquodifficultrdquo

17

80211 Medium Access Controlbull MAC layer has three functions

bull Reliable data delivery

bull Different from Ethernet wireless LANs suffer from considerable unreliability

bull Access control

bull Distributed access

bull Centralized access

bull Security

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 10: CSCD 433 Network Programming Fall 2012

Ethernet Recap

bull Classic Ethernet bull One long cable 500 meter max segmentbull Snaked around building as single long cablebull All computers attached

bull Thick Ethernetbull Began as thick yellow cable marked every

25 meters to show computer attachments

bull Thin Ethernetbull Thinner bent more easily connections with

BNC connectorsbull Cheaper to install 185 meter max segment

Ethernet Recap

bull Ethernet could contain multiple segments and multiple repeaters

bull Used CSMACD for shared media bull What does CSMACD stand for

Carrier Sense Multiple AccessCollision Detection

bull Review this

12

CSMACD Protocol

All hosts transmit amp receive on one channelPackets are of variable size

When a host has a packet to transmit1 Carrier Sense Check that the line is quiet before transmitting2 Collision Detection Detect collision as soon as Possible Collision is detected stop transmitting wait a random time then return to step 1

binary exponential backoff

13

Ethernet CSMACD algorithm

Algorithm1 NIC receives datagram from network

layer creates frame

2 If NIC senses channel idle starts frame transmission

If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

Ethernet CSMACD algorithm

4 If NIC detects another transmission while transmitting aborts and sends jam signal5 After aborting NIC enters exponential backoff after mth collision NIC chooses a K small integer at random from 012hellip2m-1 NIC then waits K512 bit time

bull Returns to Step 2

14

15

Wireless Communication Systems amp Networking

- What complicates wireless networking vs wired networking

16

Wireless Link Characteristics (1)Differences from wired link hellip

bull Decreased signal strength Radio signal attenuates as it propagates through matter (path loss)

bull Interference from other sources Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) devices (motors) interfere as well

bull Multipath propagation Radio signal reflects off objects ground arriving ad destination at slightly different times

hellip make communication across link much more ldquodifficultrdquo

17

80211 Medium Access Controlbull MAC layer has three functions

bull Reliable data delivery

bull Different from Ethernet wireless LANs suffer from considerable unreliability

bull Access control

bull Distributed access

bull Centralized access

bull Security

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 11: CSCD 433 Network Programming Fall 2012

Ethernet Recap

bull Ethernet could contain multiple segments and multiple repeaters

bull Used CSMACD for shared media bull What does CSMACD stand for

Carrier Sense Multiple AccessCollision Detection

bull Review this

12

CSMACD Protocol

All hosts transmit amp receive on one channelPackets are of variable size

When a host has a packet to transmit1 Carrier Sense Check that the line is quiet before transmitting2 Collision Detection Detect collision as soon as Possible Collision is detected stop transmitting wait a random time then return to step 1

binary exponential backoff

13

Ethernet CSMACD algorithm

Algorithm1 NIC receives datagram from network

layer creates frame

2 If NIC senses channel idle starts frame transmission

If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

Ethernet CSMACD algorithm

4 If NIC detects another transmission while transmitting aborts and sends jam signal5 After aborting NIC enters exponential backoff after mth collision NIC chooses a K small integer at random from 012hellip2m-1 NIC then waits K512 bit time

bull Returns to Step 2

14

15

Wireless Communication Systems amp Networking

- What complicates wireless networking vs wired networking

16

Wireless Link Characteristics (1)Differences from wired link hellip

bull Decreased signal strength Radio signal attenuates as it propagates through matter (path loss)

bull Interference from other sources Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) devices (motors) interfere as well

bull Multipath propagation Radio signal reflects off objects ground arriving ad destination at slightly different times

hellip make communication across link much more ldquodifficultrdquo

17

80211 Medium Access Controlbull MAC layer has three functions

bull Reliable data delivery

bull Different from Ethernet wireless LANs suffer from considerable unreliability

bull Access control

bull Distributed access

bull Centralized access

bull Security

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 12: CSCD 433 Network Programming Fall 2012

12

CSMACD Protocol

All hosts transmit amp receive on one channelPackets are of variable size

When a host has a packet to transmit1 Carrier Sense Check that the line is quiet before transmitting2 Collision Detection Detect collision as soon as Possible Collision is detected stop transmitting wait a random time then return to step 1

binary exponential backoff

13

Ethernet CSMACD algorithm

Algorithm1 NIC receives datagram from network

layer creates frame

2 If NIC senses channel idle starts frame transmission

If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

Ethernet CSMACD algorithm

4 If NIC detects another transmission while transmitting aborts and sends jam signal5 After aborting NIC enters exponential backoff after mth collision NIC chooses a K small integer at random from 012hellip2m-1 NIC then waits K512 bit time

bull Returns to Step 2

14

15

Wireless Communication Systems amp Networking

- What complicates wireless networking vs wired networking

16

Wireless Link Characteristics (1)Differences from wired link hellip

bull Decreased signal strength Radio signal attenuates as it propagates through matter (path loss)

bull Interference from other sources Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) devices (motors) interfere as well

bull Multipath propagation Radio signal reflects off objects ground arriving ad destination at slightly different times

hellip make communication across link much more ldquodifficultrdquo

17

80211 Medium Access Controlbull MAC layer has three functions

bull Reliable data delivery

bull Different from Ethernet wireless LANs suffer from considerable unreliability

bull Access control

bull Distributed access

bull Centralized access

bull Security

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 13: CSCD 433 Network Programming Fall 2012

13

Ethernet CSMACD algorithm

Algorithm1 NIC receives datagram from network

layer creates frame

2 If NIC senses channel idle starts frame transmission

If NIC senses channel busy waits until channel idle then transmits

3 If NIC transmits entire frame without detecting another transmission NIC is done with frame

Ethernet CSMACD algorithm

4 If NIC detects another transmission while transmitting aborts and sends jam signal5 After aborting NIC enters exponential backoff after mth collision NIC chooses a K small integer at random from 012hellip2m-1 NIC then waits K512 bit time

bull Returns to Step 2

14

15

Wireless Communication Systems amp Networking

- What complicates wireless networking vs wired networking

16

Wireless Link Characteristics (1)Differences from wired link hellip

bull Decreased signal strength Radio signal attenuates as it propagates through matter (path loss)

bull Interference from other sources Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) devices (motors) interfere as well

bull Multipath propagation Radio signal reflects off objects ground arriving ad destination at slightly different times

hellip make communication across link much more ldquodifficultrdquo

17

80211 Medium Access Controlbull MAC layer has three functions

bull Reliable data delivery

bull Different from Ethernet wireless LANs suffer from considerable unreliability

bull Access control

bull Distributed access

bull Centralized access

bull Security

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 14: CSCD 433 Network Programming Fall 2012

Ethernet CSMACD algorithm

4 If NIC detects another transmission while transmitting aborts and sends jam signal5 After aborting NIC enters exponential backoff after mth collision NIC chooses a K small integer at random from 012hellip2m-1 NIC then waits K512 bit time

bull Returns to Step 2

14

15

Wireless Communication Systems amp Networking

- What complicates wireless networking vs wired networking

16

Wireless Link Characteristics (1)Differences from wired link hellip

bull Decreased signal strength Radio signal attenuates as it propagates through matter (path loss)

bull Interference from other sources Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) devices (motors) interfere as well

bull Multipath propagation Radio signal reflects off objects ground arriving ad destination at slightly different times

hellip make communication across link much more ldquodifficultrdquo

17

80211 Medium Access Controlbull MAC layer has three functions

bull Reliable data delivery

bull Different from Ethernet wireless LANs suffer from considerable unreliability

bull Access control

bull Distributed access

bull Centralized access

bull Security

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 15: CSCD 433 Network Programming Fall 2012

15

Wireless Communication Systems amp Networking

- What complicates wireless networking vs wired networking

16

Wireless Link Characteristics (1)Differences from wired link hellip

bull Decreased signal strength Radio signal attenuates as it propagates through matter (path loss)

bull Interference from other sources Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) devices (motors) interfere as well

bull Multipath propagation Radio signal reflects off objects ground arriving ad destination at slightly different times

hellip make communication across link much more ldquodifficultrdquo

17

80211 Medium Access Controlbull MAC layer has three functions

bull Reliable data delivery

bull Different from Ethernet wireless LANs suffer from considerable unreliability

bull Access control

bull Distributed access

bull Centralized access

bull Security

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 16: CSCD 433 Network Programming Fall 2012

16

Wireless Link Characteristics (1)Differences from wired link hellip

bull Decreased signal strength Radio signal attenuates as it propagates through matter (path loss)

bull Interference from other sources Standardized wireless network frequencies (eg 24 GHz) shared by other devices (eg phone) devices (motors) interfere as well

bull Multipath propagation Radio signal reflects off objects ground arriving ad destination at slightly different times

hellip make communication across link much more ldquodifficultrdquo

17

80211 Medium Access Controlbull MAC layer has three functions

bull Reliable data delivery

bull Different from Ethernet wireless LANs suffer from considerable unreliability

bull Access control

bull Distributed access

bull Centralized access

bull Security

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 17: CSCD 433 Network Programming Fall 2012

17

80211 Medium Access Controlbull MAC layer has three functions

bull Reliable data delivery

bull Different from Ethernet wireless LANs suffer from considerable unreliability

bull Access control

bull Distributed access

bull Centralized access

bull Security

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 18: CSCD 433 Network Programming Fall 2012

18

Medium Access Controlbull Two sublayersbull Lower sublayer is Distributed Coordination Function (DCF)

bull Uses a contention algorithm to provide access to all traffic

bull Higher sublayer is Point Coordination Function (PCF)

bull Uses a centralized algorithmbull Contention freebull Implemented on top of DCF

bull Remark PCF has not been popularly implemented in todayrsquos 80211 products

bull DCF is widely used

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 19: CSCD 433 Network Programming Fall 2012

19

Distributed Coordination Function CSMACAbull DCF sublayer uses CSMACA protocol What does that stand forbull Where CA refers to as Collision Avoidance

1 A station with a frame to transmit senses the medium If the medium is idle it waits to see if the medium remains idle for a time equals to a delay called Interframe Space (IFS) If so the station may transmit immediately

2 If the medium is busy the station defers transmission and continues to monitor the medium until the current transmission is over

3 Once the transmission is over the station delays another IFS If the medium remains idle for this period then the station backs off a random amount of time and again senses the medium If the medium is still idle the station may transmit During the backoff time if the medium becomes busy the backoff timer is halted and resumes when the medium becomes idle

4 If the transmission is unsuccessful which is determined by the absence of an ACK then it is assumed that a collision has occurred

bull To ensure that backoff maintains stability binary exponential backoff is used

bull Why not collision detection1 Collision detection is not practical on wireless networks2 The dynamic range of wireless signals is very large3 The transmitting station cannot distinguish incoming weak signals

from noise andor effects of own transmission

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 20: CSCD 433 Network Programming Fall 2012

20

IEEE 80211 MAC Protocol CSMACA

80211 sender1 if sense channel idle for DIFS then

transmit entire frame 2 if sense channel busy then

a) start random backoff timeb) timer counts down while channel

idlec) transmit when timer expiresd) if no ACK increase random backoff

interval repeat 2

80211 receiver- if frame received OK

return ACK after SIFS (ACK needed due to hidden terminal problem)

sender receiver

DIFS

data

SIFS

ACK

Distributed Inter-frame Spacing (DIFS) Short Inter-frame Spacing (SIFS)

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 21: CSCD 433 Network Programming Fall 2012

Rick Graziani grazianicabrilloedu 21

NAV Timer

bull All stations have a NAV (Network Allocation Vector) timerbull Virtual carrier-sensing functionbull Protects the sequence of frames from interruptionbull Martha sends a frame to Georgebull Since wireless medium is a ldquobroadcast-basedrdquo (not broadcast frame) shared

medium all stations including Vivian receive the framebull Vivian updates her NAV timer with the duration valuebull Vivian will not attempt to transmit until her NAV is decremented to 0bull Stations will only update their NAV when the duration field value received is

greater than their current NAV

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 22: CSCD 433 Network Programming Fall 2012

Rick Graziani grazianicabrilloedu 22

Duration Field

bull DurationID field ndash The number of microseconds (millionth of a second) that the medium is expected to remain busy for transmission currently in progressndash Transmitting device sets the Duration time in microsecondsndash Includes time to

bull Transmit this frame to the AP (or to the client if an AP)bull The returning ACK bull The time in-between frames IFS (Interframe Spacing)

bull All stations monitor this fieldbull All stations update their NAV (Network Allocation Vector) timer

General 80211 Frame (more on this later)

An example will be coming

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 23: CSCD 433 Network Programming Fall 2012

Rick Graziani grazianicabrilloedu 23

Wanting to transmit (13)

bull Station wanting to transmit

bull Carrier Sensing

ndash Physical Physically senses medium is idle

ndash Virtual NAV timer is 0

bull Waits DIFS (DCF Interframe Space)

ndash Minimum amount of medium idle time until contention-based services begin

ndash Once DCF is over stations can contend for access

bull Contention window begins

ndash Uses random backoff algorithm to determine when it can attempt to access the medium (next)

Random backoff slots

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 24: CSCD 433 Network Programming Fall 2012

Rick Graziani grazianicabrilloedu 24

Wanting to transmit (23)

bull (Detail of random backoff algorthim has been left out but this will be sufficient)

bull The random backoff algorithm randomly selects a value from 0 to 255 (maximum value varies by vendor and stored in the NIC)

bull The random value is the number of 80211 slot times the station must wait after the DIFS during the contention window before it may transmit

bull Stations pick a random slot and wait for that slot before attempting to access the medium

bull With several stations attempting to transmit the station that picks the lowest slot lowest random number wins

Contention Window Begins

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 25: CSCD 433 Network Programming Fall 2012

Rick Graziani grazianicabrilloedu 25

Wanting to transmit (33)

bull Station transmits setting the Duration ID to the time needed to transmit data ACK and IFSs

bull Other stations with higher slots will see the new transmission and wait to transmit

bull If frame arrives at AP (assuming the transmitter is a station) then an ACK will be returned (stations have updated their NAVs from original frame)

bull If there is not an ACK received the sending station assumes there has been a collision (stations have not updated their NAVs because of collision)ndash If two stations have the same lowest slot time and both transmit then

a collision occursbull Stations will update its retry counter (double) to determine a new randomly

selected slot time and process starts all over again

General 80211 Frame (more on this later)

Others update NAV

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 26: CSCD 433 Network Programming Fall 2012

26

Hidden Terminal Problem in WLANs

bull Both H1 and H2 transmit at same time

bull Signals collide at AP H1 cant detect H2

Collison is the darker blue

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 27: CSCD 433 Network Programming Fall 2012

27

Avoiding collisions RTSCTSIdea allow sender to ldquoreserverdquo channel rather than

random access of data frames avoid collisions of long data frames

bull sender first transmits small request-to-send (RTS) packets to BS using CSMA

bull RTSs may still collide with each other (but theyrsquore short)

bull BS broadcasts clear-to-send (CTS) in response to RTS

bull RTS heard by all nodes

bull sender transmits data frame

bull other stations defer transmissions

avoid data frame collisions completely using small reservation packets

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 28: CSCD 433 Network Programming Fall 2012

28

Collision Avoidance RTS-CTS exchange

APA B

time

RTS(A)RTS(B)

RTS(A)

CTS(A) CTS(A)

DATA (A)

ACK(A) ACK(A)

reservation collision

defer

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 29: CSCD 433 Network Programming Fall 2012

RTSCTS in practice

bull 80211 standardized both CSMACA and RTSCTS

bull In practice most operators disable RTSCTSndash Very high overhead

bull RTSCTS packets sent at ldquobase raterdquo (often 1Mbit)

ndashAvoid collisions regardless of transmission rate

ndash Most deployments use base stations not ad hoc

ndash Neighboring cells are often configured to use non-overlapping channels so hidden terminals on downlink are rare

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 30: CSCD 433 Network Programming Fall 2012

30

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

80211 frame addressing

Address 2 MAC addressof wireless host or AP transmitting this frame

Address 1 MAC addressof wireless host or AP to receive this frame

Address 3 MAC addressof router interface to which AP is attached

Address 4 used only in ad hoc mode

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 31: CSCD 433 Network Programming Fall 2012

31

Internetrouter

AP

H1 R1

AP MAC addr H1 MAC addr R1 MAC addr

address 1 address 2 address 3

80211 frame

R1 MAC addr AP MAC addr

dest address source address

8023 frame

80211 frame addressing

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 32: CSCD 433 Network Programming Fall 2012

32

framecontrol

durationaddress

1address

2address

4address

3payload CRC

2 2 6 6 6 2 6 0 - 2312 4

seqcontrol

TypeFromAP

SubtypeToAP

More frag

WEPMoredata

Powermgt

Retry RsvdProtocolversion

2 2 4 1 1 1 1 1 11 1

80211 frame moreduration of reserved transmission time

frame seq (for reliable ARQ)

frame type(RTS CTS ACK data)

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 33: CSCD 433 Network Programming Fall 2012

Summary

bull 80211 wireless more challenging because of disruptions to signal vs wired

bull However mobility far outweighs the downside of interference and security

bull No going back to wired when we can plug in during flights and have access to Facebook

34

Lab is Wireshark wireless

Page 34: CSCD 433 Network Programming Fall 2012

34

Lab is Wireshark wireless