When a device tries to associate an IP address with a MAC address for a given device, it sends ARP requests to all devices connected to the same network. If I understand correctly, the searching device reaches other devices using their MAC addresses. My question is this: how does the searching device find the MAC addresses of the other devices in the first place? Through the default gateway?
4 Answers
When a device tries to associate an IP address with a MAC address for a given device, it sends ARP requests to all devices connected to the same network.
For IPv4 that's correct. IPv6 uses the Neighbor Discovery Protocol (NDP).
how does the searching device find the MAC addresses of the other devices in the first place?
It doesn't. ARP uses the link-layer broadcast address (FF-FF-FF-FF-FF-FF
) to send the request to all devices in a segment.
While broadcasts interrupt every node participating in a segment, NDP uses multicasting to limit the disruption to those nodes that actually use IPv6. (Multicasts are somewhat similar to broadcasts but in a multicast-aware network, multicast forwarding is limited to those nodes that have actually subscribed to the type of multicast. Also, multicasts can be locally ignored when unsubscribed.)
Through the default gateway?
The default gateway isn't and cannot be used for address resolution.
When a device tries to associate an IP address with a MAC address for a given device, it sends ARP requests to all devices connected to the same network.
It is really a device trying to discover the MAC address for a given IPv4 address (IPv6 uses NDP).
My question is this: how does the searching device find the MAC addresses of the other devices in the first place?
The device trying to get a MAC address for a given IPv4 address uses ARP to do that. If the MAC address already exists in its ARP table, then it is done. If it does not already have the MAC address, it sends out an ARP request to the broadcast MAC address, and every other host in the broadcast domain will receive it, but only the host with that IPv4 address will respond to the ARP request.
Through the default gateway?
This has nothing to do with the configured gateway, which is just another host on the broadcast domain, and a host uses ARP to get the MAC address of a gateway, just like it does for any other host in the broadcast domain.
ARP packets include the sender's MAC address and IP address (labeled sender's protocol address in the image, below).
If destination host is within LAN network :- When packet goes to LAYER2 OSI arpa give payload to arp if finding ip is within a LAN network ARP is generated with sender Mac :- 0.0.0.0 which means not known and then this arpa goes to LAYER2 ARPA, ARPA made a Ethernet II frame in which frame is encapsulated with senader Mac FFFF.FFFF.FFFF which means broadcasting and then handed over L1 of OSI.
if destination host is other network :- Arp always generated to first default gateway.
-
2Sorry, your answer isn't intelligible. Also, ARPA is the DoD agency that created the ARPANET, the precursor of the Internet.– Zac67 ♦Jul 10, 2021 at 5:32