1.\" $NetBSD: arp.4,v 1.15 2022/05/04 07:32:50 andvar Exp $ 2.\" 3.\" Copyright (c) 1985, 1986, 1988, 1994 4.\" The Regents of the University of California. All rights reserved. 5.\" 6.\" Redistribution and use in source and binary forms, with or without 7.\" modification, are permitted provided that the following conditions 8.\" are met: 9.\" 1. Redistributions of source code must retain the above copyright 10.\" notice, this list of conditions and the following disclaimer. 11.\" 2. Redistributions in binary form must reproduce the above copyright 12.\" notice, this list of conditions and the following disclaimer in the 13.\" documentation and/or other materials provided with the distribution. 14.\" 3. Neither the name of the University nor the names of its contributors 15.\" may be used to endorse or promote products derived from this software 16.\" without specific prior written permission. 17.\" 18.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 19.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 22.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 24.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 25.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 26.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 27.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 28.\" SUCH DAMAGE. 29.\" 30.\" from: @(#)arp4.4 6.5 (Berkeley) 4/18/94 31.\" 32.Dd October 12, 2016 33.Dt ARP 4 34.Os 35.Sh NAME 36.Nm arp 37.Nd Address Resolution Protocol 38.Sh SYNOPSIS 39.In netinet/if_ether.h 40.Sh DESCRIPTION 41The Address Resolution Protocol (ARP) is a protocol used to dynamically 42map between Internet host addresses and Ethernet addresses. 43It is used by all the Ethernet interface drivers. 44It is not specific to Internet protocols or to Ethernet, 45but this implementation currently supports only that combination. 46.Pp 47ARP caches Internet-Ethernet address mappings. 48When an interface requests a mapping for an address not in the cache, 49ARP queues the message which requires the mapping and broadcasts 50a message on the associated network requesting the address mapping. 51If a response is provided, the new mapping is cached and any pending 52message is transmitted. 53ARP will queue at most one packet while waiting for a response to a 54mapping request; 55only the most recently ``transmitted'' packet is kept. 56If the target host does not respond after several requests, 57the host is considered to be down for a short period (normally 20 seconds), 58allowing an error to be returned to transmission attempts during this 59interval. 60The error is 61.Er EHOSTDOWN 62for a non-responding destination host, and 63.Er EHOSTUNREACH 64for a non-responding router. 65.Pp 66Each ARP cache entry is stored in a network interface which a response 67of ARP comes in. 68ARP cache entries time out periodically (normally 20 minutes after validated; 69entries are not validated when not in use). 70.Pp 71ARP entries may be added, deleted or changed with the 72.Xr arp 8 73utility. 74Manually-added entries may be temporary or permanent, 75and may be 76.Dq published , 77in which case the system will respond to ARP requests for that host 78as if it were the target of the request. 79.Pp 80In the past, 81ARP was used to negotiate the use of a trailer encapsulation. 82This is no longer supported. 83.Sh DIAGNOSTICS 84.Bl -diag 85ARP implements Address Conflict Detection. 86When an address is first added to the host, it is marked tentative and 87ARP probes the network to discover if another host has the address. 88If another host replies with the same address, then the local address is 89marked duplicate and the host will not use it. 90Otherwise the tentative 91mark is removed and the host can start using the address. 92.Pp 93ARP will defend the host's active address when a conflicting message is 94received. 95However, if another conflicting message for the address is found within 96a 10 second period, then the address is marked duplicate and the host will 97stop using it. 98.Pp 99For some systems such as a router or a server, 100it is desirable never to give up an assigned address. 101This can be achieved by setting the 102.Xr sysctl 7 103variable 104.Dv net.inet.ip_dad_count 105to 0. 106.Pp 107In all of the above cases, ARP will log diagnostic messages which include 108the hardware address of the conflicting host. 109.El 110.Sh SEE ALSO 111.Xr inet 4 , 112.Xr route 4 , 113.Xr arp 8 , 114.Xr ifconfig 8 , 115.Xr route 8 116.sp 117.Rs 118.%A Plummer, D. 119.%B "An Ethernet Address Resolution Protocol" 120.%T RFC 826 121.Re 122.Rs 123.%A Leffler, S.J. 124.%A Karels, M.J. 125.%B "Trailer Encapsulations" 126.%T RFC 893 127.Re 128.Rs 129.%A Cheshire, S. 130.%B "IPv4 Address Conflict Detection" 131.%T RFC 5227 132.Re 133.Sh HISTORY 134Since 135.Nx 8.0 , 136the ARP cache was not stored in the routing table. 137.Pp 138Address Conflict Detection was added in 139.Nx 8.0 . 140