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.
It can just put the packet on the interface through which it can reach
the other router.
There are problems with your premise. Remember that frames on a link are delivered via a layer-2 protocol, and that protocol may have an address that must be resolved in order to encapsulate the packets into frames. If the frames use MAC addresses, then you need ARP to resolve the next-hop layer-3 address into a layer-2 address.
Also, if the link is a multiaccess link, how does the router direct the packets to the one-of-many hosts on the multiaccess link? The packets only have the source and destination layer-3 addresses, not any of the intermediate hop addresses. Yes, the router knows that the packets must go out specific interfaces, but it must have some way to direct the frames to the specific device (router) on a multiaccess interface.
Yes, there are layer-2 protocols that may use other, or no, addressing on the frames. If there is no addressing, e.g. PPP, then the router knows how to create the frame, and there is only one other device on the link, but there are many other layer-2 protocols (frame relay, ATM, etc.) that use other addressing, and a router will use a method other than ARP to resolve the layer-2 address of the next hop.
When ARP is used by a host in a LAN, then it is broadcast because the
host does not know where is the destination host, but a router knows
which interface it must use to get to the next router.
A router also knows which interface a host is connected on. Remember that at layer-2, another router is just a host on a network. The router knows nothing more about another router than it does a host.
Also, only an ARP request is broadcast. ARP also specifies that a host create an ARP table, and ARP may simply find the layer-2 address in the ARP table without using broadcast.
Best Answer
Gratuitous ARP is a sort of "advance notification", it updates the ARP cache of other systems before they ask for it (no ARP request) or to update outdated information.
When talking about gratuitous ARP, the packets are actually special ARP request packets, not ARP reply packets as one would perhaps expect. Some reasons for this are explained in RFC 5227.
The gratuitous ARP packet has the following characteristics:
ff:ff:ff:ff:ff:ff
)Gratuitous ARP is used for some reasons:
As for the second part of your question, HSRP, VRRP etc. use gratuitous ARP to update the MAC address tables on L2 devices (switches). Also there is the option to use the burned-in MAC address for HSRP instead of the "virtual"one. In that case the gratuitous ARP would also update the ARP tables on L3 devices/hosts.