Hello,
My question is, Can ARP work across subnets? Like can we use ARP to discover the MAC Addresses of hosts that are not a part of our LAN?
I found on a forum that we cannot use ARP across subnets but somehow my logic contradicted and I wasn't convinced. What am I thinking? (Please correct my logic)
I think that,
Let's say our network is 192.168.1.0/24. Device A is let's say 192.168.1.5. Device A wants to communicate with a server that is on another network and let's say it is on a network that is 192.168.2.0/24 and has an IP address which is 192.168.2.3. Now in order to establish communication between Device A & Server, Device A should know the IP Address and MAC Address of the server, right? Now for IP Address DNS is there but what about MAC Address, how will Device A know the MAC Address of that server? Now considering ARP works across networks (this assumption is maybe wrong, but yeah you're here to correct my logic right so yeah let me go about my version of explanation), ARP request being a broadcast one in nature (who is 192.168.2.3, if it's you, give your MAC Address), the switch will forward It to all available ports except the ingress port. Now in all available ports, the router is also there. Now router will get that ARP request and it will see and it'll check its routing table and say okay, this IP doesn't belong to another network and shall route its way until the ARP Request reaches 192.168.2.3. Now the ARP response is unicast and the same procedure back.
Now, this is convincing to me but I know I'm wrong because ARP requests only work in the subnets. So please correct my thinking. And also in general when communicating with someone across the network, how is the MAC Address taken care of?
Please try to reply in the simplest possible manner so for me the understanding of the answer is relatively effortless.
Thanks in advance.
-
Doubt in ARP Protocol (Network+)
-
Hey @Atharva-Bet great question
Device A will try an ARP resolution on network 192.168.1.0/24, when ARP does not resolve the MAC address for the destination IP address (the server in your example on network 192.168.2.0/24), Device A will inspect it's own local routing table to discover the gateway (router) to send the packet to. When the router receives the packet, it will process the MAC address in the packet, but upon inspection of the destination IP, the router stops processing as this is the server's IP address. The router then looks at it's routing table for the network interface card connected to network 192.168.2.0/24 and (the local network that the server is on) send an ARP request. The router will receive the ARP reply from the server with the matching destination IP address and deliver the packet to the server. Notice that Device A did not have to know the destination MAC address, but the gateway address (IP of the router) and the router sent out an ARP request on the server's local network. So the ARP broadcast did not cross networks.
Best Regards,
Wes BryanKnowledge is a road to be traveled upon, not a destination to be reached~~
-
Thank you so much @wes-bryan Sir for helping me out! My doubt is cleared