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)
I want to understand why two devices can not talk to each other directly when they are in wireless range of each other?
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?
If above is true..ARP protocol is not needed at all in infrastructure mode, as knowing MAC is not necessary? Is this understanding correct?
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?
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.
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