ARP also is used to provide duplicate IP address detection through the transmission of ARP Requests known as gratuitous ARPs . A gratuitous ARP is an ARP Request for a node's own IP address. In the gratuitous ARP, the SPA and the TPA are set to the same IP address.
If a node sends an ARP Request for its own IP address and no ARP Reply
The ArpRetryCount registry setting controls the number of gratuitous ARPs that are sent.
Location: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters Data type: REG_DWORD Valid range: 0–3 Default value: 3 Present by default: No
ArpRetryCount sets the number of times that a gratuitous ARP is sent when initializing IP for a specific IP address. If no ARP Reply is received after sending ArpRetryCount gratuitous ARPs, IP assumes the IP address is unique on the network segment.
The gratuitous ARP attempts to detect the use of a duplicate IP address by a node on the same network segment. Because routers do not propagate ARP frames, a gratuitous ARP does not detect an IP address conflict between two nodes that are located on different network segments.
In an IP address conflict, the node that is already successfully configured with the IP address is known as the defending node . The node that is sending the gratuitous ARP is known as the offending node . Based on the ARP Reply, the offending node can determine the defending node's MAC address.
If the offending node is a computer running a member of the Windows Server 2003 family or Windows XP that is manually configured with a conflicting IP address, the receipt of the ARP Reply to the gratuitous ARP
If the offending node is a computer running a member of the Windows Server 2003 family or Windows XP using DHCP, gratuitous ARPs are sent for the IP address received in the DHCPOFFER message. If an ARP Reply is received in response to the gratuitous ARPs, the DHCP client sends a DHCPDECLINE message to the DHCP server. If the DHCP server is running a member of the Windows Server 2003 family, the IP address sent in the DHCPOFFER is flagged as a bad IP address and is not allocated to any other DHCP
The defending node detects an address conflict whenever the SPA of the incoming ARP Request is the same as an IP address configured on the defending node. For gratuitous ARPs from an offending node, both the SPA and TPA are set to the conflicting address. However, gratuitous ARPs are not the only ARP Requests that can have the SPA set to a conflicting address.
For example, if a node using a conflicting address is started without being connected to its network segment, no replies to the gratuitous ARPs are received and the node initializes TCP/IP using the conflicting address. If the node is then placed on the same network segment as the defending node, no additional gratuitous ARPs are sent. However, each time either node using the conflicting address sends an ARP Request, the SPA is set to the conflicting address. In this case, an error message is displayed and an event is logged in the system event log. Both nodes continue to use the conflicting IP address, but each displays an error message and logs an event every time the other node sends an ARP Request.
The gratuitous ARP and address conflict detection for the Windows Server 2003 family is an exchange of three frames. The first two frames are the ARP Request–ARP Reply exchange for the conflicting address:
The offending node attempting to detect another node on the same network segment using the same IP address sends the gratuitous ARP Request.
The defending node sends the ARP Reply to the offending node.
When the gratuitous ARP is sent, the SPA is set to a conflicting IP address and the SHA is set to the offending node's MAC address. Nodes on the network segment that have an ARP cache entry for [conflicting IP address, defending node's MAC address] have their ARP cache entries updated to [conflicting IP address, offending node's MAC address]. The gratuitous ARP sent by the offending node updates all the ARP cache entries for the nodes communicating with the defending node; this causes future IP datagrams to be sent to the offending node's MAC address. A worst-case scenario is when the defending node is the default gateway for the network segment. Sending the gratuitous ARP Request causes all nodes on that network segment with an entry in their ARP cache for the default gateway IP address to forward all traffic off the subnet to the offending node's MAC address.
When the ARP Reply is sent, it is sent to the defending node's MAC address. The unicast ARP Reply does not correct the improper ARP cache entries. Therefore, to reset the ARP cache entries that were improperly updated by the offending node's sending of the gratuitous ARP Request, the defending node sends another broadcast ARP Request. The defending node's ARP Request is a gratuitous ARP, as if the defending node were doing its own conflict detection. The defending node's ARP Request contains the SHA set to the defending node's MAC address. Network segment nodes that have had their ARP cache entries improperly set to [conflicting IP address, offending node's MAC address] arereset to the proper mapping of [conflicting IP address, defending node's MAC address].
The Network Monitor trace in Capture 03-02 (in the \Captures folder on the companion CD-ROM) shows the gratuitous ARP and address conflict exchange. Frame 1 is theoffending node's gratuitous ARP. Frame 2 is the defending node's ARP Reply. Frame 3 is the defending node's gratuitous ARP. At the end of Frame 3, all network segment nodes that have the IP address 169.254.0.1 in their ARP caches have been reset to the proper MAC address of 0x00-60-97-02-6D-3D.