0

I have heard about ARP protocol for learning MAC address of other devices in a LAN for communicating with each other. However, I am bit confused about how it works in a typical infrastructure mode, where there are multiple devices.

I believe, all devices will have a local private IP but they can never talk to each other directly, but only via Wireless access point(AP)

Questions

  1. I want to understand why two devices can not talk to each other directly when they are in wireless range of each other?

  2. Is knowing MAC of each other necessary for talking? I think it will be not needed at all as direct addressing seems not possible and all traffic routes through Wi-fi AP. So knowing just the IP address of the other device is sufficient. Is it correct?

  3. If above is true..ARP protocol is not needed at all in infrastructure mode, as knowing MAC is not necessary? Is this understanding correct?


Edit:

Thanks for detailed response. What i meant by question#3 is.. if Host A wants to communicate with host B in the same wifi network, Host A may not need to know MAC of Host B. If Host A has the IP of Host B and it knows MAC of the WAP. So, it can send the packet with destination IP of Host B and MAC of WAP. And since WAP knows Host B's MAC, it may replace the destination MAC from its own to that of Host B's and eventually send the packet to Host B. Is this arrangement not possible? Does Host A and Host B necessarily need to know each other's MAC in a wifi LAN network, to talk to each other?

If Host A Host B never talk to each other and always go via WAP(as you clarified) , then i felt..why would they even need to know each other's MAC? Knowing just the IP and MAC of WAP would be enough...is it true? Sorry for a novice question.

Edit: First of all, my apology for posting question in form of answer! Yes, i understand now that WAP needs to do ARP/NDP to find out the data link /MAC address of the connected devices in order to deliver the packet(s). However i would like to explain with an example to clarify my point.

Suppose host A and host B are connected to same Wifi AP. Now when host A wants to send packet/data to host B, the data will go via WAP..so, host A may not really need to know the MAC of host B. Host A can encapsulate the IP of Host B in data link packet with MAC of WAP and send the packet to WAP. WAP knows MAC of host B by ARP or NDP, so WAP is able to deliver the packet correctly to host B. In this case, host A may not need to do ARP/NDP to find MAC of host B?

Or

Host A is needed to encapsulate the IP of host B as payload to the datalink packet with MAC of host B only? If this case, yes, i can understand that host A needs to do ARP/NDP to find MAC of host B first, before sending any packet(s)

I hope i could explain my doubt properly. Sorry if i caused confusion.

Edit

Thanks for your kind explanation. It helped me to understand it well now. I can understand that it is really not needed for WAP to learn about L3 layer protocol inside same wifi network communication, perhaps L3 layer data can remain hidden in payload data completely all the time. Just the MAC's will keep changing when WAP delivers the new wifi frame to host B, without even looking into the payload..

But, i wonder how routing is handled by the WAP. In such case, the real destination MAC would be unknown..as that device would be in different network. Host A knows only the destination IP. As per wifi frame format, it may fill in transmitter , receiver MAC's. But WAP would need to remove the L2 header and check the L3 data like IP address of the destination? Then may be look up routing table etc to decide next IP, next hop etc. In such cases, would the WAP not have certain level of IP protocol awareness like IPv4 , IPv6? Is the understanding correct or some still i am missing something? Only in case of same network ( home wifi network), WAP is oblivious of Network layer protocol, but in case of routing, it needs to be L3 layer aware...right? If this is true, can a IPv4 aware WAP work for IPv6 out of the box or need some software/ hardware updates to be able to support IPv6? Thank You

3
  • Removed the off-topic home networking.
    – Ron Maupin
    Aug 28, 2021 at 11:41
  • Does this answer your question? OSI Model and Networking Protocols Relationship L3 (IP) relies on L2 (Wi-Fi) for local delivery. In infrastructure mode, all traffic flows through the WAP.
    – Zac67
    Aug 28, 2021 at 12:30
  • Did any answer help you? if so, you should accept the answer so that the question does not keep popping up forever, looking for an answer. Alternatively, you could post and accept your own answer.
    – Ron Maupin
    Dec 23, 2021 at 21:08

3 Answers 3

2
  1. I want to understand why two devices can not talk to each other directly when they are in wireless range of each other?

All devices only communicate with the WAP in Infrastructure Mode. That actually increases the range of the Wi-Fi network, and it makes for a more stable network, especially if the Wi-Fi devices are mobile.

  1. Is knowing MAC of each other necessary for talking? I think it will be not needed at all as direct addressing seems not possible and all traffic routes through Wi-fi AP. So knowing just the IP address of the other device is sufficient. Is it correct?

Devices on the same layer-2 network communicate with each other using the layer-2 addressing. For Wi-Fi and the other IEEE protocols that is MAC addressing. Wi-Fi frames are more complicated than ethernet frames that only have the source and destination MAC addresses, so the frames are first handled by the WAP in Infrastructure Mode. Wi-Fi, like other data-link protocols, knows nothing about the payload of its frames, so it knows nothing about the network layer addressing, and it can carry any number of network-layer protocols (IPv4, IPX, IPv6, AppleTalk, etc.). There are many questions with answers here about the need for both data-link and network addressing.

  1. If above is true..ARP protocol is not needed at all in infrastructure mode, as knowing MAC is not necessary? Is this understanding correct?

Your above ideas are not true. IPv4 needs ARP, and IPv6 needs NDP, to discover the data-link address for the destination IP address. The IP packets must be encapsulated in the data-link frames, using the data-link addressing, so that the data-link protocol can deliver them to the LAN destination.


For your edit:

What i meant by question#3 is.. if Host A wants to communicate with host B in the same wifi network, Host A may not need to know MAC of Host B.

Yes, a host needs to know the data-link address (in this case a MAC) address of the destination host. The data-link protocol requires the destination data-link address in the frame.

If Host A has the IP of Host B and it knows MAC of the WAP. So, it can send the packet with destination IP of Host B and MAC of WAP. And since WAP knows Host B's MAC, it may replace the destination MAC from its own to that of Host B's and eventually send the packet to Host B. Is this arrangement not possible?

That is not possible as Wi-Fi has no idea about the network protocol used. For example, If your WAPs use IPv4, what happens when your company starts adding IPv6. It would need to replace the WAPs with IPv6 WAPs, then any IPv4 hosts would be locked out. Data-link protocols and the data-link infrastructure knows nothing of the network layer (payload of the data-link protocol).

In any case, the WAP would need to use ARP or NDP to get the data-link address for the IP address, so ARP or NDP would still be needed and used.


For your next edit:

Suppose host A and host B are connected to same Wifi AP. Now when host A wants to send packet/data to host B, the data will go via WAP..so, host A may not really need to know the MAC of host B.

Yes, Host A must know the MAC address of Host B because it is required to be in the Wi-Fi frame. Unlike ethernet that only requires the source and destination MAC addresses (this is told to you above), the Wi-Fi frame is more complex, and it still requires the destination MAC address. You seem to want to rewrite the Wi-Fi protocol, and you would burden the WAP with knowing about the network protocol, so you would need to build that knowledge into the WAP. If you had WAPs for IPv4, then you want to add IPv6, you would need to get new WAPs that know IPv6. You want the layer-2 devices to know about layer-3, and that is not how the independent protocols work. Layer-2 devices like WAPs and layer-2 switches do not know about layer-3 protocols. IP (both IPv4 and IPv6) is standardized and maintained by the IETF, but many data-link protocols, including ethernet, Wi-Fi, etc. are standardized and maintained independently by the IEEE.

Notice the difference in the frame headers. The Wi-Fi protocol still requires the destination host MAC address (there are four MAC addresses in a Wi-Fi header vs. only two in the ethernet header), and it knows nothing about either IP version, so it does not include IP, or any other network protocol, addressing. That means it can carry any network protocol as its payload. Burdening a data-link protocol with knowing the network protocol violates the principles of abstraction and encapsulation of the network layers.

Ethernet frame:

enter image description here

Wi-Fi Frame header:

enter image description here


Edit for you next edit:

i wonder how routing is handled by the WAP.

A WAP is a bridge, like an ethernet switch is a bridge. Bridges forward layer-2 frames on the same layer-2 network. They do not route layer-3 packets between networks. Routers route layer-3 packets between networks. A host will use the layer-2 address of a router for a frame encapsulating a packet destined for a different network.

Host A knows only the destination IP. As per wifi frame format, it may fill in transmitter , receiver MAC's. But WAP would need to remove the L2 header and check the L3 data like IP address of the destination?

No, Host A would encapsulate a layer-3 packet destined to a different network with the layer-2 frame destined to its configured gateway (router, a host on the network that knows how to reach other networks).

Then may be look up routing table etc to decide next IP, next hop etc. In such cases, would the WAP not have certain level of IP protocol awareness like IPv4 , IPv6?

No, layer-2 devices know nothing about layer-3. Routers are layer-3 devices that have interfaces in multiple layer-3 networks and have routing tables that tell them how to forward packets to other networks.

Is the understanding correct or some still i am missing something?

Your understanding is flawed.

Only in case of same network ( home wifi network), WAP is oblivious of Network layer protocol, but in case of routing, it needs to be L3 layer aware...right?

Again, home networking and consumer-grade devices are explicitly off-topic here. You are referring to a home router that is a Frankenstein box with multiple devices in the same box. You need to distinguish the various devices.

If this is true, can a IPv4 aware WAP work for IPv6 out of the box or need some software/ hardware updates to be able to support IPv6?

The WAP is a layer-2 device that bridges frames on the same network, but the router routes packets between networks.

0

Is knowing MAC needed for talking to another device in same wifi network?

Short answer: yes.

WAPs and wired switches are network bridges, working at the data link layer (L2). Bridges forward frames based on their destination MAC address while at the same time learning node locations by each frame's source MAC address.

IP addresses belong to the network layer (L3) above the data link layer. That addressing bears no relevance for a bridge.

IP nodes cannot send IP traffic directly across an L2 network. They need to encapsulate their IP packets into L2 frames (mostly Ethernet/802.3 of Wi-Fi/802.11), addressed according to the L2 network's need (mostly using MAC addresses). IP nodes learn the required L2 addresses by using ARP (for IPv4) or NDP (for IPv6).

0

I think the questioner is trying to ask if it is possible to directly aim the packets to the destination MAC/IP address by directly sending a customized frame/packet to physical layer.

With IP, the answer is, not a good idea. In the vicinity of a device, there could be another private network with same IP address assigned to the one of the latter's host.

With MAC, the answer is, yes. But as the devices are built to receive packets and process them according to TCP/IP or OSI layer models (and for good reasons), a customized packet sent as such, will be rejected because it lacks the same network IP address or as per question even the network layer itself.

Even if the hosts are on the same network, then there is a question of proximity of the endpoints. For a generic case, it is better to route the packets to and fro via the AP.

Furthermore, considering the concepts of Contention Free and Contention Window, of collision etc, it is better to let the AP handle it, for fairness and QoS, etc.

I am answering this from a point-of-view that you are trying to do a Wi-Fi direct exactly as per the name, directly between endpoints, with no AP in between. And also assuming that MAC spoofing etc is not being tried by other mal hosts.

As to answer whether removing network layer and other layers (which is totally possible in your scenario) is worth, Ron Maupin 's excellent answer indirectly provides some insight on why it's not a good idea considering factors like routing, sessions, security, etc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.