802.11 MAC Sublayer • MAC layer tasks: –Control medium access –Roaming, authentication, power conservation • Traffic services –DCF (Distributed Coordination Function) (mandatory): Asynchronous Data Service • • • • Only service available in ad-hoc network mode does not use any kind of central control exchange of data packets based on “best-effort” support of broadcast and multicast –PCF (Point Coordination Function) (optional): TimeBounded Service • uses the base station to control all activity in its cell 1 802.11 MAC Sublayer • PCF and DCF can coexist within one cell by carefully defining the interframe time interval. The four intervals are depicted: – SIFS (Short InterFrame Spacing) is used to allow the parties in a single dialog the chance to go first including letting the receiver send a CTS and an ACK and the sender to transmit the next fragment. – PIFS (PCF InterFrame Spacing) is used to allow the base station to send a beacon frame or poll frame. – DIFS (DCF InterFrame Spacing) is used to allow any station to grab the channel and to send a new frame. – EIFS (Extended InterFrame Spacing) is used only by a station that has just received a bad or unknown frame to report the bad frame. • The result MAC scheme used in 802.11 is carrier sensing multiple access with collision avoidance (CSMA/CA) that is based on MACAW. – Use NAV (Network Allocation Vector) to indicate the channel is busy. 2 The 802.11 MAC Sublayer Protocol Interframe spacing in 802.11. 3 802.11 MAC Sublayer • Access methods – DFWMAC-DCF (distributed foundation wireless medium access control- Distributed Coordination Function) CSMA/CA (mandatory) • collision avoidance via randomized „back-off“ mechanism • minimum distance between consecutive packets • ACK packet for acknowledgements (not for broadcasts) – DFWMAC-DCF w/ RTS/CTS (optional) • avoids hidden terminal problem – DFWMAC- PCF (Point Coordination Function) (optional) • access point polls terminals according to a list • Completely controlled by the base station. No collisions occur. • A beacon frame which contains system parameters is periodically (10 to 100 times per second) broadcasted to invite new stations to sign up for polling service. 4 802.11 - CSMA/CA access method DIFS DIFS medium busy contention window (randomized back-off mechanism) next frame direct access if medium is free DIFS t slot time • Station ready to send starts sensing the medium (Carrier Sense based on CCA, Clear Channel Assessment) • If the medium is free for the duration of an Inter-Frame Space (IFS), the station can start sending (IFS depends on service type) • If the medium is busy, the station has to wait for a free IFS, then the station must additionally wait a random back-off time (collision avoidance, multiple of slot-time) • If another station occupies the medium during the back-off time of the station, the back-off timer stops (fairness) 5 802.11 - Competing Stations DIFS DIFS DIFS boe bor station1 DIFS boe bor boe busy boe busy boe bor boe busy boe bor boe busy station2 busy station3 station4 boe bor station5 t busy medium not idle (frame, ack etc.) boe elapsed backoff time packet arrival at MAC bor residual backoff time 6 802.11 - CSMA/CA access method • Sending unicast packets – station has to wait for DIFS before sending data – receivers acknowledge at once (after waiting for SIFS) if the packet was received correctly (CRC) – automatic retransmission of data packets in case of transmission errors DIFS sender data SIFS receiver ACK DIFS other stations waiting time 7 data t contention 802.11 – DFWMAC • Sending unicast packets – station can send RTS with reservation parameter (transmission duration) after waiting for DIFS (reservation determines amount of time the data packet needs the medium) – acknowledgement via CTS after SIFS by receiver (if ready to receive) – sender can now send data at once, acknowledgement via ACK – other stations set its net allocation vector (NAV) in accordance with the duration field. DIFS sender RTS data SIFS receiver SIFS CTS SIFS DIFS NAV (RTS) other stations ACK NAV (CTS) defer access 8 data t contention Fragmentation The deal with the problem of noisy channels, 802.11 allows frames to be fragmented. DIFS sender RTS frag1 SIFS receiver CTS SIFS frag2 SIFS ACK1 SIFS SIFS ACK2 NAV (RTS) NAV (CTS) other stations NAV (frag1) DIFS NAV (ACK1) contention 9 data t DFWMAC-PCF A super frame comprises a contention-free period and a contention period. • D for downstream • U for upstream • CF for an end maker t0 t1 medium busy PIFS point coordinator SIFS D1 SIFS SIFS D2 SIFS U1 wireless stations stations‘ NAV SuperFrame U2 NAV 10 DFWMAC-PCF t2 point coordinator D3 SIFS D4 t4 CFend SIFS U4 wireless stations stations‘ NAV PIFS t3 NAV contention free period 11 contention period t • Types 802.11 MAC Frame format – control frames, management frames, data frames • Sequence numbers – important against duplicated frames due to lost ACKs • Addresses – receiver, transmitter (physical), BSS identifier, sender (logical) • Miscellaneous – sending time, checksum, frame control, data bytes 2 Frame Control bits 2 2 6 Duration/ Address ID 1 2 Protocol Type version 4 Subtype 1 To DS 6 Address 2 1 6 Address 3 1 1 2 6 Sequence Address Control 4 1 1 1 0-2312 Data 1 From More Power More Retry WEP Order DS Frag 12 Mgmt Data 4 CRC MAC address format scenario ad-hoc network infrastructure network, from AP infrastructure network, to AP infrastructure network, within DS to DS from DS 0 0 0 1 DS: Distribution System AP: Access Point DA: Destination Address SA: Source Address address 1 address 2 address 3 address 4 DA DA SA BSSID BSSID SA - 1 0 BSSID SA DA - 1 1 RA TA DA SA BSSID: Basic Service Set Identifier RA: Receiver Address TA: Transmitter Address Ad-hoc network: packet exchanged between two wireless nodes without a distribution system Infrastructure network, from AP: a packet sent to the receiver via the access point Infrastructure network, to AP: a station sends a packet to another station via the access point Infrastructure network, within DS: packets transmitted between two access points over the distribution system. 13 Special Frames: ACK, RTS, CTS bytes • Acknowledgement Frame2 ACK 2 Control bytes RTS 2 Frame Control 6 Receiver Duration Address 2 6 Receiver Duration Address 4 CRC 6 4 Transmitter CRC Address • Request To Send bytes CTS 2 Frame Control • Clear To Send 14 2 6 Receiver Duration Address 4 CRC 802.11 MAC management • Synchronization – try to find a LAN, try to stay within a LAN – Synchronize internal clocks and generate beacon signals • Power management – periodic sleep, frame buffering, traffic measurements – sleep-mode without missing a message • Roaming for Association/Reassociation – integration into a LAN – roaming, i.e. change networks by changing access points – scanning, i.e. active search for a network • MIB - Management Information Base – All parameters representing the current state of a wireless station and an access point are stored in a MIB. – A MIB can be accessed via SNMP. 15 Synchronization using a Beacon (infrastructure) Timing synchronization function (TSF) is needed for: • Power management • Coordination of the PCF and for synchronization of the hopping sequence A beacon contains a timestamp and other management information. The access point tries to schedule transmissions according to the excepted beacon interval (target beacon transmission time). beacon interval access point medium B B busy busy B busy B busy t value of the timestamp B beacon frame 16 Synchronization using a Beacon (adhoc) The standard random backoff algorithm is also applied to the beacon frames in the ad-hoc networks. beacon interval station1 B1 B1 B2 station2 medium busy busy B2 busy busy t value of the timestamp B beacon frame 17 random delay