proc.5: Remove duplicated /proc/[pid]/gid_map entry
[man-pages.git] / man7 / arp.7
blobd31866f50cfb65dbf34328fe7aa2a1558a086ca2
1 .\" This man page is Copyright (C) 1999 Matthew Wilcox <willy@bofh.ai>.
2 .\" %%%LICENSE_START(VERBATIM_ONE_PARA)
3 .\" Permission is granted to distribute possibly modified copies
4 .\" of this page provided the header is included verbatim,
5 .\" and in case of nontrivial modification author and date
6 .\" of the modification is added to the header.
7 .\" %%%LICENSE_END
8 .\"
9 .\" Modified June 1999 Andi Kleen
10 .\" $Id: arp.7,v 1.10 2000/04/27 19:31:38 ak Exp $
11 .\"
12 .TH ARP 7 2020-08-13 "Linux" "Linux Programmer's Manual"
13 .SH NAME
14 arp \- Linux ARP kernel module.
15 .SH DESCRIPTION
16 This kernel protocol module implements the Address Resolution
17 Protocol defined in RFC\ 826.
18 It is used to convert between Layer2 hardware addresses
19 and IPv4 protocol addresses on directly connected networks.
20 The user normally doesn't interact directly with this module except to
21 configure it;
22 instead it provides a service for other protocols in the kernel.
23 .PP
24 A user process can receive ARP packets by using
25 .BR packet (7)
26 sockets.
27 There is also a mechanism for managing the ARP cache
28 in user-space by using
29 .BR netlink (7)
30 sockets.
31 The ARP table can also be controlled via
32 .BR ioctl (2)
33 on any
34 .B AF_INET
35 socket.
36 .PP
37 The ARP module maintains a cache of mappings between hardware addresses
38 and protocol addresses.
39 The cache has a limited size so old and less
40 frequently used entries are garbage-collected.
41 Entries which are marked
42 as permanent are never deleted by the garbage-collector.
43 The cache can
44 be directly manipulated by the use of ioctls and its behavior can be
45 tuned by the
46 .I /proc
47 interfaces described below.
48 .PP
49 When there is no positive feedback for an existing mapping after some
50 time (see the
51 .I /proc
52 interfaces below), a neighbor cache entry is considered stale.
53 Positive feedback can be gotten from a higher layer; for example from
54 a successful TCP ACK.
55 Other protocols can signal forward progress
56 using the
57 .B MSG_CONFIRM
58 flag to
59 .BR sendmsg (2).
60 When there is no forward progress, ARP tries to reprobe.
61 It first tries to ask a local arp daemon
62 .B app_solicit
63 times for an updated MAC address.
64 If that fails and an old MAC address is known, a unicast probe is sent
65 .B ucast_solicit
66 times.
67 If that fails too, it will broadcast a new ARP
68 request to the network.
69 Requests are sent only when there is data queued
70 for sending.
71 .PP
72 Linux will automatically add a nonpermanent proxy arp entry when it
73 receives a request for an address it forwards to and proxy arp is
74 enabled on the receiving interface.
75 When there is a reject route for the target, no proxy arp entry is added.
76 .SS Ioctls
77 Three ioctls are available on all
78 .B AF_INET
79 sockets.
80 They take a pointer to a
81 .I struct arpreq
82 as their argument.
83 .PP
84 .in +4n
85 .EX
86 struct arpreq {
87     struct sockaddr arp_pa;      /* protocol address */
88     struct sockaddr arp_ha;      /* hardware address */
89     int             arp_flags;   /* flags */
90     struct sockaddr arp_netmask; /* netmask of protocol address */
91     char            arp_dev[16];
93 .EE
94 .in
95 .PP
96 .BR SIOCSARP ", " SIOCDARP " and " SIOCGARP
97 respectively set, delete, and get an ARP mapping.
98 Setting and deleting ARP maps are privileged operations and may
99 be performed only by a process with the
100 .B CAP_NET_ADMIN
101 capability or an effective UID of 0.
103 .I arp_pa
104 must be an
105 .B AF_INET
106 address and
107 .I arp_ha
108 must have the same type as the device which is specified in
109 .IR arp_dev .
110 .I arp_dev
111 is a zero-terminated string which names a device.
114 tab(:) allbox;
115 c s
116 l l.
117 \fIarp_flags\fR
118 flag:meaning
119 ATF_COM:Lookup complete
120 ATF_PERM:Permanent entry
121 ATF_PUBL:Publish entry
122 ATF_USETRAILERS:Trailers requested
123 ATF_NETMASK:Use a netmask
124 ATF_DONTPUB:Don't answer
128 If the
129 .B ATF_NETMASK
130 flag is set, then
131 .I arp_netmask
132 should be valid.
133 Linux 2.2 does not support proxy network ARP entries, so this
134 should be set to 0xffffffff, or 0 to remove an existing proxy arp entry.
135 .B ATF_USETRAILERS
136 is obsolete and should not be used.
137 .SS /proc interfaces
138 ARP supports a range of
139 .I /proc
140 interfaces to configure parameters on a global or per-interface basis.
141 The interfaces can be accessed by reading or writing the
142 .I /proc/sys/net/ipv4/neigh/*/*
143 files.
144 Each interface in the system has its own directory in
145 .IR /proc/sys/net/ipv4/neigh/ .
146 The setting in the "default" directory is used for all newly created
147 devices.
148 Unless otherwise specified, time-related interfaces are specified
149 in seconds.
151 .IR anycast_delay " (since Linux 2.2)"
152 .\" Precisely: 2.1.79
153 The maximum number of jiffies to delay before replying to a
154 IPv6 neighbor solicitation message.
155 Anycast support is not yet implemented.
156 Defaults to 1 second.
158 .IR app_solicit " (since Linux 2.2)"
159 .\" Precisely: 2.1.79
160 The maximum number of probes to send to the user space ARP daemon via
161 netlink before dropping back to multicast probes (see
162 .IR mcast_solicit ).
163 Defaults to 0.
165 .IR base_reachable_time " (since Linux 2.2)"
166 .\" Precisely: 2.1.79
167 Once a neighbor has been found, the entry is considered to be valid
168 for at least a random value between
169 .IR base_reachable_time "/2 and 3*" base_reachable_time /2.
170 An entry's validity will be extended if it receives positive feedback
171 from higher level protocols.
172 Defaults to 30 seconds.
173 This file is now obsolete in favor of
174 .IR base_reachable_time_ms .
176 .IR base_reachable_time_ms " (since Linux 2.6.12)"
177 As for
178 .IR base_reachable_time ,
179 but measures time in milliseconds.
180 Defaults to 30000 milliseconds.
182 .IR delay_first_probe_time " (since Linux 2.2)"
183 .\" Precisely: 2.1.79
184 Delay before first probe after it has been decided that a neighbor
185 is stale.
186 Defaults to 5 seconds.
188 .IR gc_interval " (since Linux 2.2)"
189 .\" Precisely: 2.1.79
190 How frequently the garbage collector for neighbor entries
191 should attempt to run.
192 Defaults to 30 seconds.
194 .IR gc_stale_time " (since Linux 2.2)"
195 .\" Precisely: 2.1.79
196 Determines how often to check for stale neighbor entries.
197 When a neighbor entry is considered stale, it is resolved again before
198 sending data to it.
199 Defaults to 60 seconds.
201 .IR gc_thresh1 " (since Linux 2.2)"
202 .\" Precisely: 2.1.79
203 The minimum number of entries to keep in the ARP cache.
204 The garbage collector will not run if there are fewer than
205 this number of entries in the cache.
206 Defaults to 128.
208 .IR gc_thresh2 " (since Linux 2.2)"
209 .\" Precisely: 2.1.79
210 The soft maximum number of entries to keep in the ARP cache.
211 The garbage collector will allow the number of entries to exceed
212 this for 5 seconds before collection will be performed.
213 Defaults to 512.
215 .IR gc_thresh3 " (since Linux 2.2)"
216 .\" Precisely: 2.1.79
217 The hard maximum number of entries to keep in the ARP cache.
218 The garbage collector will always run if there are more than
219 this number of entries in the cache.
220 Defaults to 1024.
222 .IR locktime " (since Linux 2.2)"
223 .\" Precisely: 2.1.79
224 The minimum number of jiffies to keep an ARP entry in the cache.
225 This prevents ARP cache thrashing if there is more than one potential
226 mapping (generally due to network misconfiguration).
227 Defaults to 1 second.
229 .IR mcast_solicit " (since Linux 2.2)"
230 .\" Precisely: 2.1.79
231 The maximum number of attempts to resolve an address by
232 multicast/broadcast before marking the entry as unreachable.
233 Defaults to 3.
235 .IR proxy_delay " (since Linux 2.2)"
236 .\" Precisely: 2.1.79
237 When an ARP request for a known proxy-ARP address is received, delay up to
238 .I proxy_delay
239 jiffies before replying.
240 This is used to prevent network flooding in some cases.
241 Defaults to 0.8 seconds.
243 .IR proxy_qlen " (since Linux 2.2)"
244 .\" Precisely: 2.1.79
245 The maximum number of packets which may be queued to proxy-ARP addresses.
246 Defaults to 64.
248 .IR retrans_time " (since Linux 2.2)"
249 .\" Precisely: 2.1.79
250 The number of jiffies to delay before retransmitting a request.
251 Defaults to 1 second.
252 This file is now obsolete in favor of
253 .IR retrans_time_ms .
255 .IR retrans_time_ms " (since Linux 2.6.12)"
256 The number of milliseconds to delay before retransmitting a request.
257 Defaults to 1000 milliseconds.
259 .IR ucast_solicit " (since Linux 2.2)"
260 .\" Precisely: 2.1.79
261 The maximum number of attempts to send unicast probes before asking
262 the ARP daemon (see
263 .IR app_solicit ).
264 Defaults to 3.
266 .IR unres_qlen " (since Linux 2.2)"
267 .\" Precisely: 2.1.79
268 The maximum number of packets which may be queued for each unresolved
269 address by other network layers.
270 Defaults to 3.
271 .SH VERSIONS
273 .I struct arpreq
274 changed in Linux 2.0 to include the
275 .I arp_dev
276 member and the ioctl numbers changed at the same time.
277 Support for the old ioctls was dropped in Linux 2.2.
279 Support for proxy arp entries for networks (netmask not equal 0xffffffff)
280 was dropped in Linux 2.2.
281 It is replaced by automatic proxy arp setup by
282 the kernel for all reachable hosts on other interfaces (when
283 forwarding and proxy arp is enabled for the interface).
286 .I neigh/*
287 interfaces did not exist before Linux 2.2.
288 .SH BUGS
289 Some timer settings are specified in jiffies, which is architecture-
290 and kernel version-dependent; see
291 .BR time (7).
293 There is no way to signal positive feedback from user space.
294 This means connection-oriented protocols implemented in user space
295 will generate excessive ARP traffic, because ndisc will regularly
296 reprobe the MAC address.
297 The same problem applies for some kernel protocols (e.g., NFS over UDP).
299 This man page mashes together functionality that is IPv4-specific
300 with functionality that is shared between IPv4 and IPv6.
301 .SH SEE ALSO
302 .BR capabilities (7),
303 .BR ip (7),
304 .BR arpd (8)
306 RFC\ 826 for a description of ARP.
307 RFC\ 2461 for a description of IPv6 neighbor discovery and the base
308 algorithms used.
309 Linux 2.2+ IPv4 ARP uses the IPv6 algorithms when applicable.