Using your original diagram:
When Computer A tries to communicate with Computer C, the following steps resolve Router 1's software-assigned address to its hardware-assigned media access control address:
Based on the contents of the routing table on Computer A, IP determines that the forwarding IP address to be used to reach Computer C is through Router 1, the IP address of its default gateway. Host A then checks its own local ARP cache for a matching hardware address for Router 1.
If Computer A finds no mapping in the cache, it broadcasts an ARP request frame to all hosts on the local network with the question "What is the hardware address for Router 1?" Both hardware and software addresses for the source, Host A, are included in the ARP request.
Each host on the local network receives the ARP request and checks for a match to its own IP address. If a host does not find a match, it discards the ARP request.
Router 1 determines that the IP address in the ARP request matches its own IP address and adds a hardware/software address mapping for Host A to its local ARP cache.
Router 1 then sends an ARP reply message containing its hardware address directly back to Host A.
When Host A receives the ARP reply message from the router, it updates its ARP cache with a hardware/software address mapping for Router 1.
Once the media access control address for Router interface 1 has been determined, Host A can send IP traffic to Router 1 by addressing it to the Router interface 1 media access control address. The router then forwards the traffic to Host C through the same ARP process as discussed in this section.
This was updated from a Microsoft Technet article to match your example. Another reference with a good example is Juniper networks description.
In a nutshell Host A when communicating with external IP addresses/hosts will look to its default gateway for external IP resolution and assume traffic to Host C will be forwarded by this gateway.
When in doubt, go to the source, RFC 826, An Ethernet Address Resolution Protocol
There are two type of ARP messages: REQUEST and REPLY.
The RFC specifies the ethernet header. An ARP request involves determining the ethernet address of the destination, so it uses the broadcast address since it doesn't know the unicast address. An ARP reply will know the ethernet address, so it will be a unicast.
Ethernet transmission layer (not necessarily accessible to the user):
48.bit: Ethernet address of destination
48.bit: Ethernet address of sender
16.bit: Protocol type = ether_type$ADDRESS_RESOLUTION
It then causes this packet to be broadcast to all stations on the
Ethernet cable originally determined by the routing mechanism.
The way the ARP cache works is OS-dependent, and there is nothing
requiring a host to maintain an ARP cache.
The use of gratuitous ARP is not officially documented, but some
hosts and OSes use it to do things like resolve address conflicts;
Wireshark has a pretty good explanation (with examples): Gratuitous ARP
Gratuitous ARP could mean both gratuitous ARP request or gratuitous
ARP reply. Gratuitous in this case means a request/reply that is not
normally needed according to the ARP specification (RFC 826) but could
be used in some cases. A gratuitous ARP request is an
AddressResolutionProtocol request packet where the source and
destination IP are both set to the IP of the machine issuing the
packet and the destination MAC is the broadcast address
ff:ff:ff:ff:ff:ff. Ordinarily, no reply packet will occur. A
gratuitous ARP reply is a reply to which no request has been made.
Best Answer
You can identify Gratuitous ARPs by looking at the ARP Sender Protocol Address and ARP Target Protocol Address, so as you mentioned when they are the same it's a gratuitous ARP. See RFC 2002, Section 4.6 for a reference (the emphasis -
!!!!>
and<!!!!
is mine)...