Does Wi-Fi traffic from one client to another travel via the access point?
Consider a Wi-Fi network with one access point and two clients, operating in marginal conditions due to range, etc. Client 1 is communicating with Client 2. Obviously the Access Point (AP) must be in range of both (assuming no fancy mesh modes, etc.) for the network to be deemed available, but does the data actually travel through it?
That is, does the AP receive the packets from one client and rebroadcast them for the other client to pick up, or does Client 2's radio receive the signals directly as they're transmitted from Client 1 and the AP just provides some sort of arbitration and metadata to help them find each other?
I'm particularly interested in how the answer to this would affect the case where the two clients are near to each other and have good radio propagation, but the access point is some distance away.
Solution 1:
Yes, the communication is traveling through the access point. In this case the AP is functioning exactly like a switch does in a wired network.
It is possible to have two devices communicate directly, without an AP. This is known as Ad Hoc networking.
Solution 2:
Obviously the Access Point (AP) must be in range of both (assuming no fancy mesh modes, etc.) for the network to be deemed available, but does the data actually travel through it?
Yes, data actually flows through the AP. Why? The 802.11 frames standards defined 802.11 frame headers:
802.11 works on mostly the MAC layer of the data-link and physical layer, So as you see there are four addresses (instead of two in case of Ethernet) in the frame header and depending on where the frame is to be forwarded the address placement in dot11 header is decided.
The possible addresses are:
- Destination Address -> To which frame is intended to reach finally (DA)
- Source Address -> The original sender of frame (SA)
- Current Destination Address -> The current receiver of the frame (CDA)
- Current source Address -> The current source of the frame (CSA)
Now it depends on where the frame needs to be forwarded, i.e. from which Distribution system (DS) to which distribution system (here let’s suppose wireless is DS 0 and wired is DS 1) the placement of these addresses is decided in the frame header.
CASE 1: When a frame needs to be forwarded from DS 0 to DS 0 from one wireless client (STA) to another client (this would mostly happen on an ad-hoc network).
The following would be the addresses:
- CDA and DA are going to be the same
- CSA and SA are going to be the same
The following would be address placement:
- Address 1 -> CDA or DA
- Address 2 -> CSA or SA
- Address 3 -> BSSID(MAC) or ff:ff:ff:ff:ff:ff in case of probe requests
- Address 4 -> Not Applicable
CASE 2: When a frame needs to be forwarded from a wireless client to an AP i.e. from DS 0 to DS 1.
The following would be the addresses:
- CDA and BSSID are going to be the same (since the packet is being forwarded on an SSID)
- DA is going to be the ultimate wireless client where frame needs to be forwarded(in its LAN).
- CSA and SA are going to be the same
The following would be address placement:
- Address 1 -> CDA or BSSID
- Address 2 -> CSA or SA
- Address 3 -> DA
- Address 4 -> Not Applicable
CASE 3: When a frame needs to be forwarded from an AP to a wireless client i.e. from DS 1 to DS 0.
The following would be the addresses:
- CDA and DA are going to be the same.
- CSA and BSSID are going to be the same.
- SA is going to be the original source address
The following would be address placement:
- Address 1 -> CDA or DA
- Address 2 -> CSA or BSSID
- Address 3 -> SA
- Address 4 -> Not Applicable
CASE 4: When a frame needs to be forwarded from one AP to another AP sharing same LAN (and two wireless clients communicating on it) i.e. from DS 1 to DS 1.
The following would be the addresses:
- CSA is going to be MAC of first AP
- CDA is going to be MAC of second AP
- SA is going to be the MAC of source wireless client
- DA is going to be the MAC of destination wireless client
The following would be address placement:
- Address 1 -> CDA
- Address 2 -> CSA
- Address 3 -> DA
- Address 4 -> SA
Conclusion: If you are in an AP-based environment (infrastructure) you have to switch DS and hence the destination MAC from BSSID to end client MAC addresses (explained above in detail) that is how dot11 is written.
Analogy with wired: Take the wireless medium as an invisible wire between a switch and an end host. The switch in this case is an AP and the end host is the wireless client. You still need a source MAC and a destination MAC in wireless, But now in a multiple AP environment you do not know who is your AP (switch) as there is no cable (invisible) to which you are connected (via) hence came in two more addresses (CSA and CDA explained above).
I hope this helps!