blob: 43385813a1340eacd73bba5e38cdb3db03354078 [file] [log] [blame]
Christoph J. Thompson761a1e62012-03-01 17:45:45 +01001.TH "IP\-ADDRESS" 8 "20 Dec 2011" "iproute2" "Linux"
2.SH "NAME"
3ip-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
Pavel Šimerda4e972d52015-08-12 22:04:08 +020017.BR "ip address" " { " add " | " change " | " replace " } "
18.IB IFADDR " dev " IFNAME
19.RI "[ " LIFETIME " ] [ " CONFFLAG-LIST " ]"
Christoph J. Thompson761a1e62012-03-01 17:45:45 +010020
21.ti -8
Pavel Šimerda4e972d52015-08-12 22:04:08 +020022.BR "ip address del"
23.IB IFADDR " dev " IFNAME " [ " mngtmpaddr " ]"
24
25.ti -8
Phil Sutter24604eb2016-06-09 19:20:36 +020026.BR "ip address" " { " save " | " flush " } [ " dev
Pavel Šimerda4e972d52015-08-12 22:04:08 +020027.IR IFNAME " ] [ "
Christoph J. Thompson761a1e62012-03-01 17:45:45 +010028.B scope
29.IR SCOPE-ID " ] [ "
30.B to
31.IR PREFIX " ] [ " FLAG-LIST " ] [ "
32.B label
Pavel Šimerda4e972d52015-08-12 22:04:08 +020033.IR PATTERN " ] [ " up " ]"
34
35.ti -8
Phil Sutter24604eb2016-06-09 19:20:36 +020036.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 " ] [ "
David Ahern104444c2016-06-29 11:26:58 -070048.B vrf
49.IR NAME " ] [ "
Phil Sutter24604eb2016-06-09 19:20:36 +020050.BR up " ] ]"
51
52.ti -8
Pavel Šimerda4e972d52015-08-12 22:04:08 +020053.BR "ip address" " { " showdump " | " restore " }"
Christoph J. Thompson761a1e62012-03-01 17:45:45 +010054
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
Pavel Šimerda4e972d52015-08-12 22:04:08 +020064.IR LABEL " ] [ "
Christoph J. Thompson761a1e62012-03-01 17:45:45 +010065.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 " := "
Phil Sutter37fdeb52016-03-02 19:19:56 +010078.RB "[ " permanent " | " dynamic " | " secondary " | " primary " |"
79.RB [ - ] tentative " | [" - ] deprecated " | [" - ] dadfailed " |"
Phil Sutter6acf0862016-07-12 09:56:16 +020080.BR temporary " |"
81.IR CONFFLAG-LIST " ]"
Pavel Šimerda4e972d52015-08-12 22:04:08 +020082
83.ti -8
84.IR CONFFLAG-LIST " := [ " CONFFLAG-LIST " ] " CONFFLAG
85
86.ti -8
87.IR CONFFLAG " := "
Phil Sutter6acf0862016-07-12 09:56:16 +020088.RB "[ " home " | " mngtmpaddr " | " nodad " | " noprefixroute " | " autojoin " ]"
Pavel Šimerda4e972d52015-08-12 22:04:08 +020089
90.ti -8
91.IR LIFETIME " := [ "
92.BI valid_lft " LFT"
Phil Sutter37fdeb52016-03-02 19:19:56 +010093.RB "] [ " preferred_lft
Pavel Šimerda4e972d52015-08-12 22:04:08 +020094.IR LFT " ]"
95
96.ti -8
97.IR LFT " := [ "
98.BR forever " |"
99.IR SECONDS " ]"
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100100
Phil Sutter24604eb2016-06-09 19:20:36 +0200101.ti -8
102.IR TYPE " := [ "
103.BR bridge " | "
Phil Sutter577cfe02016-06-28 15:07:17 +0200104.BR bridge_slave " |"
Phil Sutter24604eb2016-06-09 19:20:36 +0200105.BR bond " | "
Phil Sutter577cfe02016-06-28 15:07:17 +0200106.BR bond_slave " |"
Phil Sutter24604eb2016-06-09 19:20:36 +0200107.BR can " | "
108.BR dummy " | "
109.BR hsr " | "
110.BR ifb " | "
111.BR ipoib " |"
112.BR macvlan " | "
113.BR macvtap " | "
114.BR vcan " | "
115.BR veth " | "
116.BR vlan " | "
117.BR vxlan " |"
118.BR ip6tnl " |"
119.BR ipip " |"
120.BR sit " |"
121.BR gre " |"
122.BR gretap " |"
123.BR ip6gre " |"
124.BR ip6gretap " |"
125.BR vti " |"
Phil Sutter577cfe02016-06-28 15:07:17 +0200126.BR vrf " |"
Phil Sutter24604eb2016-06-09 19:20:36 +0200127.BR nlmon " |"
128.BR ipvlan " |"
129.BR lowpan " |"
Davide Carattifd4df5b2016-07-26 11:03:19 +0200130.BR geneve " |"
131.BR macsec " ]"
Phil Sutter24604eb2016-06-09 19:20:36 +0200132
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100133.SH "DESCRIPTION"
134The
135.B address
Pavel Šimerda4e972d52015-08-12 22:04:08 +0200136is a protocol (IPv4 or IPv6) address attached
137to a network device. Each device must have at least one address
138to use the corresponding protocol. It is possible to have several
139different addresses attached to one device. These addresses are not
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100140discriminated, so that the term
141.B alias
142is not quite appropriate for them and we do not use it in this document.
143.sp
144The
145.B ip address
146command displays addresses and their properties, adds new addresses
147and deletes old ones.
148
149.SS ip address add - add new protocol address.
150
151.TP
Pavel Šimerda4e972d52015-08-12 22:04:08 +0200152.BI dev " IFNAME "
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100153the name of the device to add the address to.
154
155.TP
156.BI local " ADDRESS " (default)
157the address of the interface. The format of the address depends
158on the protocol. It is a dotted quad for IP and a sequence of
Pavel Šimerdaa89d5322015-04-07 08:41:36 -0700159hexadecimal halfwords separated by colons for IPv6. The
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100160.I ADDRESS
161may be followed by a slash and a decimal number which encodes
162the network prefix length.
163
164.TP
165.BI peer " ADDRESS"
166the address of the remote endpoint for pointopoint interfaces.
167Again, the
168.I ADDRESS
169may be followed by a slash and a decimal number, encoding the network
Pavel Šimerdaa89d5322015-04-07 08:41:36 -0700170prefix length. If a peer address is specified, the local address
171cannot have a prefix length. The network prefix is associated
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100172with the peer rather than with the local address.
173
174.TP
175.BI broadcast " ADDRESS"
176the broadcast address on the interface.
177.sp
178It is possible to use the special symbols
179.B '+'
180and
181.B '-'
Pavel Šimerdaa89d5322015-04-07 08:41:36 -0700182instead of the broadcast address. In this case, the broadcast address
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100183is derived by setting/resetting the host bits of the interface prefix.
184
185.TP
Pavel Šimerda4e972d52015-08-12 22:04:08 +0200186.BI label " LABEL"
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100187Each address may be tagged with a label string.
188In order to preserve compatibility with Linux-2.0 net aliases,
189this string must coincide with the name of the device or must be prefixed
190with the device name followed by colon.
191
192.TP
193.BI scope " SCOPE_VALUE"
194the scope of the area where this address is valid.
195The available scopes are listed in file
196.BR "@SYSCONFDIR@/rt_scopes" .
197Predefined scope values are:
198
199.in +8
200.B global
201- the address is globally valid.
202.sp
203.B site
Pavel Šimerda4e972d52015-08-12 22:04:08 +0200204- (IPv6 only, deprecated) the address is site local, i.e. it is
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100205valid inside this site.
206.sp
207.B link
208- the address is link local, i.e. it is valid only on this device.
209.sp
210.B host
211- the address is valid only inside this host.
212.in -8
213
Pavel Šimerda4e972d52015-08-12 22:04:08 +0200214.TP
215.BI valid_lft " LFT"
216the valid lifetime of this address; see section 5.5.4 of
217RFC 4862. When it expires, the address is removed by the kernel.
218Defaults to
219.BR "forever" .
220
221.TP
222.BI preferred_lft " LFT"
223the preferred lifetime of this address; see section 5.5.4
224of RFC 4862. When it expires, the address is no longer used for new
225outgoing connections. Defaults to
226.BR "forever" .
227
228.TP
229.B home
230(IPv6 only) designates this address the "home address" as defined in
231RFC 6275.
232
233.TP
Phil Sutterf7afa992015-09-18 20:17:03 +0200234.B mngtmpaddr
235(IPv6 only) make the kernel manage temporary addresses created from this one as
236template on behalf of Privacy Extensions (RFC3041). For this to become active,
237the \fBuse_tempaddr\fP sysctl setting has to be set to a value greater than
238zero. The given address needs to have a prefix length of 64. This flag allows
239to use privacy extensions in a manually configured network, just like if
240stateless auto-configuration was active.
241
242.TP
Pavel Šimerda4e972d52015-08-12 22:04:08 +0200243.B nodad
244(IPv6 only) do not perform Duplicate Address Detection (RFC 4862) when
245adding this address.
246
Phil Sutterf7afa992015-09-18 20:17:03 +0200247.TP
248.B noprefixroute
249Do not automatically create a route for the network prefix of the added
250address, and don't search for one to delete when removing the address. Changing
251an address to add this flag will remove the automatically added prefix route,
252changing it to remove this flag will create the prefix route automatically.
253
Phil Sutter6acf0862016-07-12 09:56:16 +0200254.TP
255.B autojoin
256Joining multicast groups on Ethernet level via
257.B "ip maddr"
258command does not work if connected to an Ethernet switch that does IGMP
259snooping since the switch would not replicate multicast packets on ports that
260did not have IGMP reports for the multicast addresses.
261
262Linux VXLAN interfaces created via
263.B "ip link add vxlan"
264have the
265.B group
266option that enables them to do the required join.
267
268Using the
269.B autojoin
270flag when adding a multicast address enables similar functionality for
271Openvswitch VXLAN interfaces as well as other tunneling mechanisms that need to
272receive multicast traffic.
273
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100274.SS ip address delete - delete protocol address
275.B Arguments:
276coincide with the arguments of
277.B ip addr add.
Pavel Šimerdaa89d5322015-04-07 08:41:36 -0700278The device name is a required argument. The rest are optional.
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100279If no arguments are given, the first address is deleted.
280
281.SS ip address show - look at protocol addresses
282
283.TP
Pavel Šimerda4e972d52015-08-12 22:04:08 +0200284.BI dev " IFNAME " (default)
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100285name of device.
286
287.TP
288.BI scope " SCOPE_VAL"
289only list addresses with this scope.
290
291.TP
292.BI to " PREFIX"
293only list addresses matching this prefix.
294
295.TP
296.BI label " PATTERN"
297only list addresses with labels matching the
298.IR "PATTERN" .
299.I PATTERN
300is a usual shell style pattern.
301
302.TP
Phil Sutter24604eb2016-06-09 19:20:36 +0200303.BI master " DEVICE"
304only list interfaces enslaved to this master device.
305
306.TP
David Ahern104444c2016-06-29 11:26:58 -0700307.BI vrf " NAME "
308only list interfaces enslaved to this vrf.
309
310.TP
Phil Sutter24604eb2016-06-09 19:20:36 +0200311.BI type " TYPE"
312only list interfaces of the given type.
313
Phil Sutter3462c112016-06-24 12:14:23 +0200314Note that the type name is not checked against the list of supported types -
315instead it is sent as-is to the kernel. Later it is used to filter the returned
316interface list by comparing it with the relevant attribute in case the kernel
317didn't filter already. Therefore any string is accepted, but may lead to empty
318output.
319
Phil Sutter24604eb2016-06-09 19:20:36 +0200320.TP
Petr Šabata44051232013-03-14 15:10:44 +0100321.B up
322only list running interfaces.
323
324.TP
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100325.BR dynamic " and " permanent
326(IPv6 only) only list addresses installed due to stateless
327address configuration or only list permanent (not dynamic)
328addresses.
329
330.TP
331.B tentative
332(IPv6 only) only list addresses which have not yet passed duplicate
333address detection.
334
335.TP
Heiner Kallweit18c8bbe2014-12-24 23:11:50 +0100336.B -tentative
337(IPv6 only) only list addresses which are not in the process of
338duplicate address detection currently.
339
340.TP
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100341.B deprecated
342(IPv6 only) only list deprecated addresses.
343
344.TP
Heiner Kallweit18c8bbe2014-12-24 23:11:50 +0100345.B -deprecated
346(IPv6 only) only list addresses not being deprecated.
347
348.TP
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100349.B dadfailed
350(IPv6 only) only list addresses which have failed duplicate
351address detection.
352
353.TP
Heiner Kallweit18c8bbe2014-12-24 23:11:50 +0100354.B -dadfailed
355(IPv6 only) only list addresses which have not failed duplicate
356address detection.
357
358.TP
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100359.B temporary
360(IPv6 only) only list temporary addresses.
361
362.TP
363.BR primary " and " secondary
364only list primary (or secondary) addresses.
365
366.SS ip address flush - flush protocol addresses
367This command flushes the protocol addresses selected by some criteria.
368
369.PP
370This command has the same arguments as
Phil Sutter24604eb2016-06-09 19:20:36 +0200371.BR show " except that " type " and " master " selectors are not supported."
372Another difference is that it does not run when no arguments are given.
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100373
374.PP
375.B Warning:
Pavel Šimerda4e972d52015-08-12 22:04:08 +0200376This command and other
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100377.B flush
Pavel Šimerda4e972d52015-08-12 22:04:08 +0200378commands are unforgiving. They will cruelly purge all the addresses.
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100379
380.PP
381With the
382.B -statistics
383option, the command becomes verbose. It prints out the number of deleted
Pavel Šimerda4e972d52015-08-12 22:04:08 +0200384addresses and the number of rounds made to flush the address list.
385If this option is given twice,
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100386.B ip address flush
387also dumps all the deleted addresses in the format described in the
388previous subsection.
389
390.SH "EXAMPLES"
391.PP
Pavel Šimerda4e972d52015-08-12 22:04:08 +0200392ip address show
393.RS 4
394Shows IPv4 and IPv6 addresses assigned to all network interfaces. The 'show'
395subcommand can be omitted.
396.RE
397.PP
398ip address show up
399.RS 4
400Same as above except that only addresses assigned to active network interfaces
401are shown.
402.RE
403.PP
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100404ip address show dev eth0
405.RS 4
Pavel Šimerda4e972d52015-08-12 22:04:08 +0200406Shows IPv4 and IPv6 addresses assigned to network interface eth0.
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100407.RE
408.PP
Pavel Šimerda4e972d52015-08-12 22:04:08 +0200409ip address add 2001:0db8:85a3::0370:7334/64 dev eth1
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100410.RS 4
Pavel Šimerda4e972d52015-08-12 22:04:08 +0200411Adds an IPv6 address to network interface eth1.
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100412.RE
413.PP
Pavel Šimerda4e972d52015-08-12 22:04:08 +0200414ip address delete 2001:0db8:85a3::0370:7334/64 dev eth1
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100415.RS 4
Pavel Šimerda4e972d52015-08-12 22:04:08 +0200416Delete the IPv6 address added above.
417.RE
418.PP
419ip address flush dev eth4 scope global
420.RS 4
421Removes all global IPv4 and IPv6 addresses from device eth4. Without 'scope
422global' it would remove all addresses including IPv6 link-local ones.
Christoph J. Thompson761a1e62012-03-01 17:45:45 +0100423.RE
424
425.SH SEE ALSO
426.br
427.BR ip (8)
428
429.SH AUTHOR
430Original Manpage by Michail Litvak <mci@owl.openwall.com>