]>
Commit | Line | Data |
---|---|---|
761a1e60 CT |
1 | .TH "IP\-ADDRESS" 8 "20 Dec 2011" "iproute2" "Linux" |
2 | .SH "NAME" | |
3 | ip-address \- protocol address management | |
4 | .SH "SYNOPSIS" | |
5 | .sp | |
6 | .ad l | |
7 | .in +8 | |
8 | .ti -8 | |
9 | .B ip | |
10 | .RI "[ " OPTIONS " ]" | |
11 | .B address | |
12 | .RI " { " COMMAND " | " | |
13 | .BR help " }" | |
14 | .sp | |
15 | ||
16 | .ti -8 | |
4e972d5e PŠ |
17 | .BR "ip address" " { " add " | " change " | " replace " } " |
18 | .IB IFADDR " dev " IFNAME | |
19 | .RI "[ " LIFETIME " ] [ " CONFFLAG-LIST " ]" | |
761a1e60 CT |
20 | |
21 | .ti -8 | |
4e972d5e PŠ |
22 | .BR "ip address del" |
23 | .IB IFADDR " dev " IFNAME " [ " mngtmpaddr " ]" | |
24 | ||
25 | .ti -8 | |
24604eb2 | 26 | .BR "ip address" " { " save " | " flush " } [ " dev |
4e972d5e | 27 | .IR IFNAME " ] [ " |
761a1e60 CT |
28 | .B scope |
29 | .IR SCOPE-ID " ] [ " | |
30 | .B to | |
31 | .IR PREFIX " ] [ " FLAG-LIST " ] [ " | |
32 | .B label | |
4e972d5e PŠ |
33 | .IR PATTERN " ] [ " up " ]" |
34 | ||
24604eb2 PS |
35 | .ti -8 |
36 | .BR "ip address" " [ " show " [ " dev | |
37 | .IR IFNAME " ] [ " | |
38 | .B scope | |
39 | .IR SCOPE-ID " ] [ " | |
40 | .B to | |
41 | .IR PREFIX " ] [ " FLAG-LIST " ] [ " | |
42 | .B label | |
43 | .IR PATTERN " ] [ " | |
44 | .B master | |
45 | .IR DEVICE " ] [ " | |
46 | .B type | |
47 | .IR TYPE " ] [ " | |
104444c2 DA |
48 | .B vrf |
49 | .IR NAME " ] [ " | |
24604eb2 PS |
50 | .BR up " ] ]" |
51 | ||
4e972d5e PŠ |
52 | .ti -8 |
53 | .BR "ip address" " { " showdump " | " restore " }" | |
761a1e60 CT |
54 | |
55 | .ti -8 | |
56 | .IR IFADDR " := " PREFIX " | " ADDR | |
57 | .B peer | |
58 | .IR PREFIX " [ " | |
59 | .B broadcast | |
60 | .IR ADDR " ] [ " | |
61 | .B anycast | |
62 | .IR ADDR " ] [ " | |
63 | .B label | |
4e972d5e | 64 | .IR LABEL " ] [ " |
761a1e60 CT |
65 | .B scope |
66 | .IR SCOPE-ID " ]" | |
67 | ||
68 | .ti -8 | |
69 | .IR SCOPE-ID " := " | |
70 | .RB "[ " host " | " link " | " global " | " | |
71 | .IR NUMBER " ]" | |
72 | ||
73 | .ti -8 | |
74 | .IR FLAG-LIST " := [ " FLAG-LIST " ] " FLAG | |
75 | ||
76 | .ti -8 | |
77 | .IR FLAG " := " | |
37fdeb58 PS |
78 | .RB "[ " permanent " | " dynamic " | " secondary " | " primary " |" |
79 | .RB [ - ] tentative " | [" - ] deprecated " | [" - ] dadfailed " |" | |
80 | .BR temporary " | " CONFFLAG-LIST " ]" | |
4e972d5e PŠ |
81 | |
82 | .ti -8 | |
83 | .IR CONFFLAG-LIST " := [ " CONFFLAG-LIST " ] " CONFFLAG | |
84 | ||
85 | .ti -8 | |
86 | .IR CONFFLAG " := " | |
f7afa999 | 87 | .RB "[ " home " | " mngtmpaddr " | " nodad " | " noprefixroute " ]" |
4e972d5e PŠ |
88 | |
89 | .ti -8 | |
90 | .IR LIFETIME " := [ " | |
91 | .BI valid_lft " LFT" | |
37fdeb58 | 92 | .RB "] [ " preferred_lft |
4e972d5e PŠ |
93 | .IR LFT " ]" |
94 | ||
95 | .ti -8 | |
96 | .IR LFT " := [ " | |
97 | .BR forever " |" | |
98 | .IR SECONDS " ]" | |
761a1e60 | 99 | |
24604eb2 PS |
100 | .ti -8 |
101 | .IR TYPE " := [ " | |
102 | .BR bridge " | " | |
577cfe0b | 103 | .BR bridge_slave " |" |
24604eb2 | 104 | .BR bond " | " |
577cfe0b | 105 | .BR bond_slave " |" |
24604eb2 PS |
106 | .BR can " | " |
107 | .BR dummy " | " | |
108 | .BR hsr " | " | |
109 | .BR ifb " | " | |
110 | .BR ipoib " |" | |
111 | .BR macvlan " | " | |
112 | .BR macvtap " | " | |
113 | .BR vcan " | " | |
114 | .BR veth " | " | |
115 | .BR vlan " | " | |
116 | .BR vxlan " |" | |
117 | .BR ip6tnl " |" | |
118 | .BR ipip " |" | |
119 | .BR sit " |" | |
120 | .BR gre " |" | |
121 | .BR gretap " |" | |
122 | .BR ip6gre " |" | |
123 | .BR ip6gretap " |" | |
124 | .BR vti " |" | |
577cfe0b | 125 | .BR vrf " |" |
24604eb2 PS |
126 | .BR nlmon " |" |
127 | .BR ipvlan " |" | |
128 | .BR lowpan " |" | |
129 | .BR geneve " ]" | |
130 | ||
761a1e60 CT |
131 | .SH "DESCRIPTION" |
132 | The | |
133 | .B address | |
4e972d5e PŠ |
134 | is a protocol (IPv4 or IPv6) address attached |
135 | to a network device. Each device must have at least one address | |
136 | to use the corresponding protocol. It is possible to have several | |
137 | different addresses attached to one device. These addresses are not | |
761a1e60 CT |
138 | discriminated, so that the term |
139 | .B alias | |
140 | is not quite appropriate for them and we do not use it in this document. | |
141 | .sp | |
142 | The | |
143 | .B ip address | |
144 | command displays addresses and their properties, adds new addresses | |
145 | and deletes old ones. | |
146 | ||
147 | .SS ip address add - add new protocol address. | |
148 | ||
149 | .TP | |
4e972d5e | 150 | .BI dev " IFNAME " |
761a1e60 CT |
151 | the name of the device to add the address to. |
152 | ||
153 | .TP | |
154 | .BI local " ADDRESS " (default) | |
155 | the address of the interface. The format of the address depends | |
156 | on the protocol. It is a dotted quad for IP and a sequence of | |
a89d5329 | 157 | hexadecimal halfwords separated by colons for IPv6. The |
761a1e60 CT |
158 | .I ADDRESS |
159 | may be followed by a slash and a decimal number which encodes | |
160 | the network prefix length. | |
161 | ||
162 | .TP | |
163 | .BI peer " ADDRESS" | |
164 | the address of the remote endpoint for pointopoint interfaces. | |
165 | Again, the | |
166 | .I ADDRESS | |
167 | may be followed by a slash and a decimal number, encoding the network | |
a89d5329 PŠ |
168 | prefix length. If a peer address is specified, the local address |
169 | cannot have a prefix length. The network prefix is associated | |
761a1e60 CT |
170 | with the peer rather than with the local address. |
171 | ||
172 | .TP | |
173 | .BI broadcast " ADDRESS" | |
174 | the broadcast address on the interface. | |
175 | .sp | |
176 | It is possible to use the special symbols | |
177 | .B '+' | |
178 | and | |
179 | .B '-' | |
a89d5329 | 180 | instead of the broadcast address. In this case, the broadcast address |
761a1e60 CT |
181 | is derived by setting/resetting the host bits of the interface prefix. |
182 | ||
183 | .TP | |
4e972d5e | 184 | .BI label " LABEL" |
761a1e60 CT |
185 | Each address may be tagged with a label string. |
186 | In order to preserve compatibility with Linux-2.0 net aliases, | |
187 | this string must coincide with the name of the device or must be prefixed | |
188 | with the device name followed by colon. | |
189 | ||
190 | .TP | |
191 | .BI scope " SCOPE_VALUE" | |
192 | the scope of the area where this address is valid. | |
193 | The available scopes are listed in file | |
194 | .BR "@SYSCONFDIR@/rt_scopes" . | |
195 | Predefined scope values are: | |
196 | ||
197 | .in +8 | |
198 | .B global | |
199 | - the address is globally valid. | |
200 | .sp | |
201 | .B site | |
4e972d5e | 202 | - (IPv6 only, deprecated) the address is site local, i.e. it is |
761a1e60 CT |
203 | valid inside this site. |
204 | .sp | |
205 | .B link | |
206 | - the address is link local, i.e. it is valid only on this device. | |
207 | .sp | |
208 | .B host | |
209 | - the address is valid only inside this host. | |
210 | .in -8 | |
211 | ||
4e972d5e PŠ |
212 | .TP |
213 | .BI valid_lft " LFT" | |
214 | the valid lifetime of this address; see section 5.5.4 of | |
215 | RFC 4862. When it expires, the address is removed by the kernel. | |
216 | Defaults to | |
217 | .BR "forever" . | |
218 | ||
219 | .TP | |
220 | .BI preferred_lft " LFT" | |
221 | the preferred lifetime of this address; see section 5.5.4 | |
222 | of RFC 4862. When it expires, the address is no longer used for new | |
223 | outgoing connections. Defaults to | |
224 | .BR "forever" . | |
225 | ||
226 | .TP | |
227 | .B home | |
228 | (IPv6 only) designates this address the "home address" as defined in | |
229 | RFC 6275. | |
230 | ||
f7afa999 PS |
231 | .TP |
232 | .B mngtmpaddr | |
233 | (IPv6 only) make the kernel manage temporary addresses created from this one as | |
234 | template on behalf of Privacy Extensions (RFC3041). For this to become active, | |
235 | the \fBuse_tempaddr\fP sysctl setting has to be set to a value greater than | |
236 | zero. The given address needs to have a prefix length of 64. This flag allows | |
237 | to use privacy extensions in a manually configured network, just like if | |
238 | stateless auto-configuration was active. | |
239 | ||
4e972d5e PŠ |
240 | .TP |
241 | .B nodad | |
242 | (IPv6 only) do not perform Duplicate Address Detection (RFC 4862) when | |
243 | adding this address. | |
244 | ||
f7afa999 PS |
245 | .TP |
246 | .B noprefixroute | |
247 | Do not automatically create a route for the network prefix of the added | |
248 | address, and don't search for one to delete when removing the address. Changing | |
249 | an address to add this flag will remove the automatically added prefix route, | |
250 | changing it to remove this flag will create the prefix route automatically. | |
251 | ||
761a1e60 CT |
252 | .SS ip address delete - delete protocol address |
253 | .B Arguments: | |
254 | coincide with the arguments of | |
255 | .B ip addr add. | |
a89d5329 | 256 | The device name is a required argument. The rest are optional. |
761a1e60 CT |
257 | If no arguments are given, the first address is deleted. |
258 | ||
259 | .SS ip address show - look at protocol addresses | |
260 | ||
261 | .TP | |
4e972d5e | 262 | .BI dev " IFNAME " (default) |
761a1e60 CT |
263 | name of device. |
264 | ||
265 | .TP | |
266 | .BI scope " SCOPE_VAL" | |
267 | only list addresses with this scope. | |
268 | ||
269 | .TP | |
270 | .BI to " PREFIX" | |
271 | only list addresses matching this prefix. | |
272 | ||
273 | .TP | |
274 | .BI label " PATTERN" | |
275 | only list addresses with labels matching the | |
276 | .IR "PATTERN" . | |
277 | .I PATTERN | |
278 | is a usual shell style pattern. | |
279 | ||
24604eb2 PS |
280 | .TP |
281 | .BI master " DEVICE" | |
282 | only list interfaces enslaved to this master device. | |
283 | ||
104444c2 DA |
284 | .TP |
285 | .BI vrf " NAME " | |
286 | only list interfaces enslaved to this vrf. | |
287 | ||
24604eb2 PS |
288 | .TP |
289 | .BI type " TYPE" | |
290 | only list interfaces of the given type. | |
291 | ||
3462c116 PS |
292 | Note that the type name is not checked against the list of supported types - |
293 | instead it is sent as-is to the kernel. Later it is used to filter the returned | |
294 | interface list by comparing it with the relevant attribute in case the kernel | |
295 | didn't filter already. Therefore any string is accepted, but may lead to empty | |
296 | output. | |
297 | ||
44051234 PŠ |
298 | .TP |
299 | .B up | |
300 | only list running interfaces. | |
301 | ||
761a1e60 CT |
302 | .TP |
303 | .BR dynamic " and " permanent | |
304 | (IPv6 only) only list addresses installed due to stateless | |
305 | address configuration or only list permanent (not dynamic) | |
306 | addresses. | |
307 | ||
308 | .TP | |
309 | .B tentative | |
310 | (IPv6 only) only list addresses which have not yet passed duplicate | |
311 | address detection. | |
312 | ||
18c8bbe3 HK |
313 | .TP |
314 | .B -tentative | |
315 | (IPv6 only) only list addresses which are not in the process of | |
316 | duplicate address detection currently. | |
317 | ||
761a1e60 CT |
318 | .TP |
319 | .B deprecated | |
320 | (IPv6 only) only list deprecated addresses. | |
321 | ||
18c8bbe3 HK |
322 | .TP |
323 | .B -deprecated | |
324 | (IPv6 only) only list addresses not being deprecated. | |
325 | ||
761a1e60 CT |
326 | .TP |
327 | .B dadfailed | |
328 | (IPv6 only) only list addresses which have failed duplicate | |
329 | address detection. | |
330 | ||
18c8bbe3 HK |
331 | .TP |
332 | .B -dadfailed | |
333 | (IPv6 only) only list addresses which have not failed duplicate | |
334 | address detection. | |
335 | ||
761a1e60 CT |
336 | .TP |
337 | .B temporary | |
338 | (IPv6 only) only list temporary addresses. | |
339 | ||
340 | .TP | |
341 | .BR primary " and " secondary | |
342 | only list primary (or secondary) addresses. | |
343 | ||
344 | .SS ip address flush - flush protocol addresses | |
345 | This command flushes the protocol addresses selected by some criteria. | |
346 | ||
347 | .PP | |
348 | This command has the same arguments as | |
24604eb2 PS |
349 | .BR show " except that " type " and " master " selectors are not supported." |
350 | Another difference is that it does not run when no arguments are given. | |
761a1e60 CT |
351 | |
352 | .PP | |
353 | .B Warning: | |
4e972d5e | 354 | This command and other |
761a1e60 | 355 | .B flush |
4e972d5e | 356 | commands are unforgiving. They will cruelly purge all the addresses. |
761a1e60 CT |
357 | |
358 | .PP | |
359 | With the | |
360 | .B -statistics | |
361 | option, the command becomes verbose. It prints out the number of deleted | |
4e972d5e PŠ |
362 | addresses and the number of rounds made to flush the address list. |
363 | If this option is given twice, | |
761a1e60 CT |
364 | .B ip address flush |
365 | also dumps all the deleted addresses in the format described in the | |
366 | previous subsection. | |
367 | ||
368 | .SH "EXAMPLES" | |
369 | .PP | |
4e972d5e PŠ |
370 | ip address show |
371 | .RS 4 | |
372 | Shows IPv4 and IPv6 addresses assigned to all network interfaces. The 'show' | |
373 | subcommand can be omitted. | |
374 | .RE | |
375 | .PP | |
376 | ip address show up | |
377 | .RS 4 | |
378 | Same as above except that only addresses assigned to active network interfaces | |
379 | are shown. | |
380 | .RE | |
381 | .PP | |
761a1e60 CT |
382 | ip address show dev eth0 |
383 | .RS 4 | |
4e972d5e PŠ |
384 | Shows IPv4 and IPv6 addresses assigned to network interface eth0. |
385 | .RE | |
386 | .PP | |
387 | ip address add 2001:0db8:85a3::0370:7334/64 dev eth1 | |
388 | .RS 4 | |
389 | Adds an IPv6 address to network interface eth1. | |
761a1e60 CT |
390 | .RE |
391 | .PP | |
4e972d5e | 392 | ip address delete 2001:0db8:85a3::0370:7334/64 dev eth1 |
761a1e60 | 393 | .RS 4 |
4e972d5e | 394 | Delete the IPv6 address added above. |
761a1e60 CT |
395 | .RE |
396 | .PP | |
4e972d5e | 397 | ip address flush dev eth4 scope global |
761a1e60 | 398 | .RS 4 |
4e972d5e PŠ |
399 | Removes all global IPv4 and IPv6 addresses from device eth4. Without 'scope |
400 | global' it would remove all addresses including IPv6 link-local ones. | |
761a1e60 CT |
401 | .RE |
402 | ||
403 | .SH SEE ALSO | |
404 | .br | |
405 | .BR ip (8) | |
406 | ||
407 | .SH AUTHOR | |
408 | Original Manpage by Michail Litvak <mci@owl.openwall.com> |