15 The Medium Access Sublayer: 802.11 (Wi-Fi) -I
Prof. Bhushan Trivedi
Introduction
The Wireless LAN MAC layer is much more complicated than the Ethernet as there are many other things involved. The idea is to make sure a default broadcast and resource constrained channel to be utilized as optimized fashion as possible. We have seen that Ethernet is the de-facto standard for wired MAC layer and is evolving continuously to achieve better and better speeds. Being wired, it had its own advantages, it can use the frequency it wants, two wires running in parallel can use the same frequencies, it can choose the wire it wants for a given distance and amount of traffic to carry. The MAC layer has gone from broadcast domain to point to point and avoided many problems that a broadcast domain would encounter otherwise. The first version of Ethernet was based on broadcast domain and later versions did not. It was a paradigm shift which enabled the Ethernet to increase the distance it can travel, the maximum distance two farthest nodes can have etc. We have also looked at the constraints on minimum and maximum size of frame etc. We have also seen how auto-negotiation and dual speed cards enable the Ethernet to grow. Now we will focus our attention on the wireless networks and we will begin with the most common type of network, the Wi-Fi network. In this module, we will try to learn how the Wi-Fi works as compared to the Ethernet and how it provides different services to users. The Wi-Fi network is very inferior to Ethernet in terms of bandwidth and the distance covered but provides the biggest advantage, the mobility and that is why in vogue. We will continue this discussion in the next module as well. In this module, we will begin with the challenges faced by wireless communication vis-a-vis the wired connection, and two modes that the 802.11 network operates on, the DCF and the PCF. The third mode, the hybrid mode, will be discussed in the next module. We begin with the challenges that the wireless network faces at the MAC layer.
Challenges at Wireless MAC layer
The wired MAC layer has a few definite advantage. First, the wires can use the same frequency some other wires are using, as the guided media, they will not face the problem of interference. They will travel much longer distance, especially when FO cables are used. Another big advantage of wired MAC layer is that they enjoy a huge amount of bandwidth exclusively available to the users connected to both endpoints. Wireless MAC layer’s biggest advantage is that it serves the users who are on the go. However, there are many challenges that one must overcome to provide a good wireless MAC layer. Before we embark on the popular designs of wireless MAC layers used in practice, let us try to gauge the complications wireless MAC layer needs to overcome.
1. Wireless signals travel in all directions together and thus fades faster than wired signal, which is guided. The frequencies which are chosen for wireless communication using 802.11, is especially so. In the case of 802.11a, which uses frequencies in the range of 5GHz. It offers 54 Mb if the device is quite close by. As the distance increases, it reduces to 48 Mb. At about 100 meters it reduces to 11Mb. The reduction of bandwidth over the distance due to reduction is power is known as a free path loss. This loss is proportional to the square of the distance. If you double the distance, the power reduces to 1/4th of the original. This is one of the most critical and common problems of wireless communication.
2. One more problem that plagues the wireless communication is the interference from other devices using the same range of frequencies. Unlike wired connection, the wireless communication happens in open and thus compete with anything in the vicinity. Interference is highest in the free band used by the 802.11b and 802.11g.
3. The microwave EM spectrum has one more problem which we looked at while learning about the EM spectrum, the multipath fading. The multipath fading reduces the signal strength or even clarity of reception.
4. More the power, the signal travels longer. However, there are restrictions imposed by government regulation agencies on devices using wireless transmission. When the range is free to use, there is a cap on the power the sender can use to transmit. This restriction is for the other users who are transmitting in the same range. If one user starts using a high powered device, others cannot function in the same range due to interference1. The power limit varies from country to country and from device to device.
5. When the sender and receiver are aligned with each other, usually the transmission is better, especially at the higher range of frequencies. The LoS or line of sight requirement has both consequences, a good part is that if both sender and receiver are aligned, as the signal is focused, it can travel much longer distance compared to a signal without LoS. The bad part is if sender and receiver lose alignment, the communication terminates.
6. The placement of physical obstacles decides whether the receiver will be able to receive the signals or not. Smartphone users often experience no coverage or a varying degree of coverage due to their placement. Interestingly, sometimes the obstacles help the receiver to receive bounced off signals. Figure 17.1 depicts the idea. The receiver is able to receive signal bounced off from the large obstacle. If the large obstacle is not around, it would not be in a position to receive the signal due to the small obstacle. If you ever have ever tried to tune old fashioned Doordarshan antenna, you probably have experienced this phenomenon.
7. The transmission quality also is influenced by the range chosen. The Wi-Fi range (2.4 GHz to 2.48 GHz) is not suitable for long range transmission. On the contrary, the range used by television signals travel much longer distance. Other ISM ranges (not available in India), of 4.33 MHz and 902 MHz can drive the signal to much longer distance. It is also possible to use whitespace range which can choose the range not used by other devices dynamically.
1 This is analogous to a common place where somebody is using a loudspeaker. Others cannot talk if loudspeaker uses a very high volume and they are nearby.
8. The modulation scheme used is also important. We have already seen that if it is possible to use higher modulation, we can have a better transmission with higher data rate. The schemes like OFDM and OFDMA etc. constraint squeeze more bandwidth out of same range as they have better immunity to noise and interference.
The 802.11 MAC layer
We will now discuss the MAC layer of the 802.11 (Wi-Fi). We have already seen that it comes in a few varieties and have three types of modes. In the DCF or ad hoc mode, two devices communicate directly without using any intermediary. This is a compulsory mode in 802.11, that means, any vendor who builds a device based on 802.11 standards, must provide this mode. The other popular mode, PCF mode, is activated when the device works under the influence of a central arbitrator, known as Access Point or AP. Later on, when Wi-Fi extensions were provided, another mode, called hybrid mode was also introduced. We will learn about all of them in the in this and the next module.
The DCF mode
DCF (Distributed Coordinated Function) mode allows two communicating 802.11 devices to communicate with each other directly. There are two versions of the DCF mode; there are two ways these devices can initiate and complete communication. The first version is based on CSMA/CA protocol or Carrier Sense Multiple Access/ Collision Avoidance. This phrase is all the same as CSMA/CD and first two terms CS and MA carries the same meaning. CA or collision avoidance is achieved by the mechanism based on RTS and CTS we have already studied. The sender sends RTS and gets CTS before sending the actual frame. All stations surrounding both sender and receiver learns about this transmission due to this process and remain quiet during this period. Thus, this additional process makes sure that there is no undue transmission during this frame being transmitted and the potential collision is averted.
In another mode, which we call direct mode, the sender can send whenever he wishes to. He does not do any formalities before sending and just send after waiting for DIFS once anybody’s transmission is over. After sending, he waits for the response and if it does not get the ack back in time, it will retransmit assuming it is lost or garbled, using binary exponential backoff algorithm like Ethernet first version. The difference between the Ethernet and this mode of Wi-Fi transmission is worth noting. Ethernet cards can listen while transmission and thus can immediately stop when what they listen is different than what they are sending. Thus if a large frame is to be sent and while sending the first few bits the sender realizes the collision, it defers to send further and saves the network bandwidth. Unlike that, the Wi-Fi sender normally uses a half-duplex radio for transmission and cannot listen while transmitting. Once they start sending, there is no stopping in between. The station halts only when the frame is over. The station does not continuously listen to the channel it is transmitting to and check for collision. That means there is no collision detection like Ethernet. That also means they can only learn about collision if the ack does not come back at the later stage. For longer frames, a method based on CSMA/CA (the RTS-CTS based method) is better to be used as the collision in between wastes lot of precious network bandwidth.
In the case of collision, the very algorithm that the Ethernet uses, the binary exponential back off, is used to determine the random period to wait for next transmission. That means, both parties which collide, waits for one or two time slots at random and increase the number of slots exponentially if the collision keeps on occurring. The chances of frame colliding with each other and garbled are much higher than Ethernet. The reasons we have discussed during the discussion of the electromagnetic spectrum is more relevant here. The wireless range is both, not good for long distance communication, and is also highly crowded so there is a lot of interference from other devices working in the same range. There are two additional measures taken normally to see the frame through in a better way.
1. Unlike Ethernet, each frame is acknowledged. Please note that Ethernet checks for garbled frames but do not ack or retransmit. The 802.11 protocol is modeled in a very simple fashion, every frame must be acked and only when the ack of the previous frame is received, the next frame is sent. This model is popularly known as the stop-and-wait protocol. Reference 1 contains a detailed description of this model and algorithm. We have also learned about this in module 15. Later on, Wi-Fi extensions changed this behavior and when TXOP (Transmission Opportunity) employed, it allowed senders to send for a typical time slot continuously and send as many frames it can during that period back and back.
2. Whenever long frames are encountered, they are segregated into smaller fragments to make sure at least some of them are transmitted across without error. When the probability of error is higher, choosing a smaller fragment decreases the chance of error in a single fragment. For example, if we have error probability 1 in 1000 bytes, sending frames of 1000 bytes will almost always result in an error. However, if we sent 100-byte fragments, 9 out of 10 fragments are likely to go through. The higher error rate is significantly more due to the range was chosen, 2.4 GHz to 2.48 GHz which is used by many other devices, including omnipresent Bluetooth devices.
The RTS/CTS communication
Let us try to see how communication, based on RTS and CTS, is managed. We will discuss the complete communication process, including what sender sends, after how much delay, and what receiver does in response, after how much delay from receiver’s side. We have seen two common problems of the wireless physical layer, the exposed and hidden station problems and we have also seen that the process based on RTS and CTS was recommended to thwart collision. This method is also known as collision avoidance in Wi-Fi parlance.
1. The sender senses the channel before transmission like Ethernet. if the channel is busy, it will wait till the sender completes his transmission.
2. It waits for a period called DIFS (DCF interframe spacing, explained later) and then transmits the RTS (Request to send)
3. If the channel is busy, it waits for the channel to become idle, wait for DIFS and transmits the RTS then.
4. Once the transmission of RTS gets over, the sender waits for the receiver to send the CTS (clear to send) back.
5. On the other side, as soon as the receiver gets the RTS, it will wait for a time period known as SIFS (Short Interframe Spacing), generate the CTS and sends it. This SIFS value is much less than DIFS.
6. If the CTS does not arrive in time, the sender times out & starts all over again from step-1.
7. If the CTS arrives, the sender proceeds further, wait for SIFS and sends the frame. The sender continuously sends the frame without checking for collisions in between.
8. The receiver, once in receipt of the valid frame, after waiting for SIFS, sends the ack back.
9. After receiving the ack, the sender may send next frame, following all the process it has done before, from step 1. There is no method to send frames back and back. As mentioned before, after an introduction of the Wi-Fi extensions, the TXOP was allowed which helps the sender send multiple frames back and back, but it is called a hybrid mode and not DCF mode which we are discussing right now.
10. As mentioned earlier, the neighbors of the sender when they hear RTS, and neighbors of the receiver, when they hear CTS, learn about the frame being transmitted and remain silent during the transmission. However, once the frame transmission is over and an ack is received by the sender, they may start competing for transmission in the next cycle, and that is why we have the constrain mentioned in step 9. The silent mode, where the neighbors enter while the transmission is on is also known as Network Allocation Vector mode. It has been mentioned earlier but let us remind ourselves that RTS informs the neighbors of the senders while CTS Dial-In the neighbors of the receivers. When a potential sender can hear RTS and cannot hear CTS it understands itself to be a victim of exposed station problem and can actually send a frame during the process of this frame transmission. A node, which can only listen to the CTS but not RTS, must understand that even when the channel looks idle, the receiver is busy and should not send the data to a receiver, but to any other node.
Communication without RTS/CTS
We have already seen that normally the RTS/CTS mode is not used due to additional overhead it demands. Both RTS and CTS are short frames of 30 bytes long. However, looking at the scarce network bandwidth it makes it more important. The network bandwidth is actually less that what it seems at the first sight due to two problems, first is, the complete bandwidth is available only when you are in the vicinity of the sender and not otherwise and second, whatever is available is not available exclusively, it is being shared. That means, even this small overhead may be very much for a Wi-Fi network.
Let us see how communication Dial-In without using RTS/CTS method.
1. The sender senses the channel like the earlier case before sending.
2. If the channel is idle, it waits for DIFS and then transmits the frame.
3. It won’t check for collisions while transmitting like the earlier case.
4. The receiver, upon receipt of the frame, just wait for SIFS and sends the ack back.
5. If the sender does not get the ack back in time, it times out and retransmits the frame starting from step-1.
6. If the sender gets the ack, it concludes that the transmission is successful. The sender may send the next frame, if so desired, again starting from step-1.
Figure 17.3 depicts the entire communication process. We have seen that the long frame transmission is done by fragmenting the frame. Let us take try to understand that process.
Fragmentation in DCF mode
Ethernet, even when used in the broadcasting domain, can send long frames to its advantage. The Ethernet nodes can listen to everybody in the network and there is no issue of range. Once somebody starts sending and everybody else in the network realize that somebody is sending, the sender can go on for a while, without worrying about the collision as it is not going to happen.
The possibility of collision, in broadcast Ethernet, the first version, was limited to first few milliseconds where the first sender’s transmission is not reached to the second and he starts sending before. Unlike Ethernet, the long frames produced by Wi-Fi senders have more chances of running into errors on the noisy path during the wireless transmission. The wired channels do not drop packets due to interference or channel problems normally but wireless channels do so. Thus, the remedy is to send small fragments instead.
To reduce the possibility of garbled frames, the DCF mode sends fragments one after the other and sends each fragment only after receiving the ack. The first fragment, as you might notice, is sent after DIFS, while all others sent after SIFS time which is much shorter. Figure 17.4 depicts the process.
You may be wondering why these different intervals; we will soon learn why such a scheme is devised. Now we have seen the DCF mode, let us look at the PCF (point coordinated function) or Infrastructure mode next.
The PCF mode
The higher probability of collision prompted the designers of 802.11 to have a scheme with better arbitration policy. A central arbitrator eliminates the chances of collision. The access point polls each station one after another. Those who want to transmit responds back positively. The AP allocates a specific frequency band to those who want to transmit and also provides other information about the network including the channel to be used. For example, the 802.11b provides 11 to 13 channels (depending on the country you are working in). Out of that, 3 to 4 channels are non-overlapping and allocated to the specific user by the AP. The AP allocates one of those channels based on its own assessment of the quality of the channel etc. and instruct the node to use that channels for the communication. When a number of users are more, it will also allocate the time slot for the sender to send. The access point also has a specific channel to broadcast its own information and polling to all other stations in the vicinity. The frame which is broadcasted to provide information to the members who are in the vicinity is known as a beacon frame. The beacon frames are broadcasted every few minutes.
The node, when enters the wireless network or when switched on, try to look for access points in the surrounding. In the default mode (also known as unprotected mode), the node can join the network just by providing the network’s Service Set Identifier (SSID). The beacon frame, apart from other information, also contains the SSID. If the AP works in the default mode, that SSID is displayed on the network panel of the wireless device. The user is presented with a choice of all networks in the surrounding. The user will have to choose one SSID that it wants to connect to and the job is done. This process can also be automated by providing user’s choice to be accepted automatically. In that case, the user intervention is just not required.
It is also possible that the AP uses a protected mode, in that case, the user cannot just connect to the network by providing the SSID, he will also have to provide the key to authenticate himself. Only those users who authenticate themselves can connect to that network. In the protected mode, the machine (and not user) can also be authenticated using its MAC or IP address or a combination of both. When the user is to be authenticated (and not the machine), usually a combination of some method of remote authentication (based on RADIUS or remote access dial-up service protocol) as well as a special server used for authentication (Called Authentication Server or AS) is used. There is more than one way to authenticate but we will not discuss that process of authentication further in this course. However, for user’s convenience, even this process can be automated and the user can be authenticated based on stored value of the key. There is one more point to note. The AP can additionally have configured in a way that the SSID is not seen by the users. If a user knows the SSID of that network (called hidden network), he can join. However, even this network with encrypted data sends SSID in open when queried from nodes. That means, even with encryption, the process is not secured as it seems at the first glance.
Access points manage the network using some service primitives. Let us learn about those service primitives.
Service primitives of PCF mode
Every access point announces its beacon frame periodically. The mobile device, when enters a new network or when switched on or when Wi-Fi is enabled, start scanning all 11 (in the US) or 12 (in most of the other countries) channels used for transmission, one after another2. The AP sends these beacon frames over some specific channel. If there are multiple AP around, the device might be able to get such beacon frames from multiple channels. Reading those beacon frames, the device can populate the list of all possible networks the user can choose to join.
The user provides its choice to connect to the specific network (or have provided a default preference for one such network). The mobile device executes the first primitive called Associate to connect to the network chosen. In fact, the completes not only choose the network but also the Access Point. A single network may be connected by choosing various access points which are part of it. The association process allows the device sending the request for connecting to the network. The next primitive, called authentication, provides the endorsement.
The authentication process in the original design was minimal and of little use. Most devices and AP now a day provides extensible authentication process including the Access Point relaying the incoming request to the Authentication Server somewhere in the network using a RADIUS (Remote Access Dial In Service) protocol (or a later version, popularly known as DIAMETER protocol, DIAMETER Is not an acronym, it just indicate an extension to RADIUS).
The authentication process can be briefly defined like this. The AP sends a challenge to the mobile device. The mobile device responds back with an encrypted challenge by its own password which the AP forwards to AS. The AS also contains the same password so can decrypt and compare the challenge to authenticate the device. This process extends the original 802.11 protocol and popularly known as the 802.11i security mechanism. Technical name to this process given by IEEE is WPA2 or Wireless Protected Access version 2.
The authentication confirms the user to be genuine. However, the transmission also demands privacy and requires to be encrypted when the user does not want the data to be read by any third party. Access Points, during this phase, also exchanges the preferred method for encryption (most popular are AES or Advanced Encryption Standard and RC4). This primitive is known as privacy primitive. Normally, both authentication and privacy are managed using the 802.11i.
All these things are being done for data transmission, eventually. This allows the mechanism to send the data from the device to the AP and from AP to the receiver. There is no direct device-to-device communication possible in this mode3.
2 Other two channels are used for control
3 Later on, when the Wi-Fi extensions provided, it introduced the hybrid mode which allowed AP controlling the communication but at times allowing the device to device direct communication as well
When the sender and the receiver belong to two different wireless networks connected by Ethernet, one needs to route the frames via that Ethernet network. They might also be connected using a wireless network. There is primitive called distribution manages that routing part. In a way, a wireless frame cannot pass through the Ethernet network as is and the frame must be converted from the wireless frame (we will soon see how it looks like) to the Ethernet frame and vice versa at the other end. This primitive is known as integration primitive. For connecting two networks, one must have distribution primitive executed, when Ethernet connects them, integration is additionally required.
It is possible for a mobile device to move out of current AP’s area and join some other AP’s area. The mobility is supported by making sure that the new AP takes the responsibility of the device instantly. This process is managed by the relocation primitive. The mobile device and the AP execute the relocation primitive when the node switches over.
When the node leaves the AP without joining any other AP or switch itself off or Wi-Fi operation is terminated, the primitive disassociation is to be executed. It removes the device from the network as a member. Even when the device departs willingly (executing the disassociation primitive by logging off), or unwillingly (either drained of power or switched off of or shutting wireless service), the disassociation primitive must be executed. The disassociation primitive erases all entries of the user from AP’s memory and disallow the same node to connect to the network after some time without reconnecting and running an associate primitive once again. Sometimes, especially when going down for maintenance, AP can also execute the disassociation primitive to disconnect from all users.
Figure 17.5 Service primitives of the PCF mode
The figure 17.5 summarizes our discussion. Each primitive’s exact work is shown in the second column. One cannot execute a primitive arbitrarily and needs a prerequisite which is listed in the third column. Which primitive can be executed after the said primitive is also listed in the final column. You can see that there are multiple alternatives here based on what exactly the user wants to do.
Summary
The wireless transmission is plagued by interference, shared bandwidth, path loss, multipath fading, power and frequency restrictions by government agencies, obstacles etc. The 802.11 MAC layer can work in DCF or PCF mode out of which DCF is compulsory for any vendor to provide. DCF mode works in two different fashion, one which allows two communicating parties directly connecting to each other and another allows all communicating parties to work under AP. However similar it looks like with Ethernet, there are differences. Ethernet works on collision detection which a wireless device cannot. The wireless devices cannot have multiple frames outstanding at any given point of time, unlike Ethernet. The PCF mode allows AP to control the channel allocation and communication process. The process demands multiple service primitives be executed both by the AP as well as the mobile device.
you can view video on The Medium Access Sublayer: 802.11 (Wi-Fi) -I |
References
- Computer Networks by Bhushan Trivedi, Oxford University Press
- Data Communication and Networking, Bhushan Trivedi, Oxford University Press