1IP-ADDRESS(8)                        Linux                       IP-ADDRESS(8)
2
3
4

NAME

6       ip-address - protocol address management
7

SYNOPSIS

9       ip [ OPTIONS ] address  { COMMAND | help }
10
11
12       ip address { add | change | replace } IFADDR dev IFNAME [ LIFETIME ] [
13               CONFFLAG-LIST ]
14
15       ip address del IFADDR dev IFNAME [ mngtmpaddr ]
16
17       ip address { save | flush } [ dev IFNAME ] [ scope SCOPE-ID ] [ metric
18               METRIC ] [ to PREFIX ] [ FLAG-LIST ] [ label PATTERN ] [ up ]
19
20       ip address [ show [ dev IFNAME ] [ scope SCOPE-ID ] [ to PREFIX ] [
21               FLAG-LIST ] [ label PATTERN ] [ master DEVICE ] [ type TYPE ] [
22               vrf NAME ] [ up ] [ nomaster ] proto ADDRPROTO ] ]
23
24       ip address { showdump | restore }
25
26       IFADDR := PREFIX | ADDR peer PREFIX [ broadcast ADDR ] [ anycast ADDR ]
27               [ label LABEL ] [ scope SCOPE-ID ] [ proto ADDRPROTO ]
28
29       SCOPE-ID := [ host | link | global | NUMBER ]
30
31       ADDRPROTO := [ NAME | NUMBER ]
32
33       FLAG-LIST := [ FLAG-LIST ] FLAG
34
35       FLAG := [ [-]permanent | [-]dynamic | [-]secondary | [-]primary |
36               [-]tentative | [-]deprecated | [-]dadfailed | [-]temporary |
37               CONFFLAG-LIST ]
38
39       CONFFLAG-LIST := [ CONFFLAG-LIST ] CONFFLAG
40
41       CONFFLAG := [ home | mngtmpaddr | nodad | optimistic | noprefixroute |
42               autojoin ]
43
44       LIFETIME := [ valid_lft LFT ] [ preferred_lft LFT ]
45
46       LFT := [ forever | SECONDS ]
47
48       TYPE := [ bridge | bridge_slave | bond | bond_slave | can | dummy | hsr
49               | ifb | ipoib | macvlan | macvtap | vcan | veth | vlan | vxlan
50               | ip6tnl | ipip | sit | gre | gretap | erspan | ip6gre |
51               ip6gretap | ip6erspan | vti | vrf | nlmon | ipvlan | lowpan |
52               geneve | macsec ]
53
54

DESCRIPTION

56       The address is a protocol (IPv4 or IPv6) address attached to a network
57       device. Each device must have at least one address to use the corre‐
58       sponding protocol. It is possible to have several different addresses
59       attached to one device. These addresses are not discriminated, so that
60       the term alias is not quite appropriate for them and we do not use it
61       in this document.
62
63       The ip address command displays addresses and their properties, adds
64       new addresses and deletes old ones.
65
66
67   ip address add - add new protocol address.
68       dev IFNAME
69              the name of the device to add the address to.
70
71
72       local ADDRESS (default)
73              the address of the interface. The format of the address depends
74              on the protocol. It is a dotted quad for IP and a sequence of
75              hexadecimal halfwords separated by colons for IPv6. The ADDRESS
76              may be followed by a slash and a decimal number which encodes
77              the network prefix length.
78
79
80       peer ADDRESS
81              the address of the remote endpoint for pointopoint interfaces.
82              Again, the ADDRESS may be followed by a slash and a decimal num‐
83              ber, encoding the network prefix length. If a peer address is
84              specified, the local address cannot have a prefix length. The
85              network prefix is associated with the peer rather than with the
86              local address.
87
88
89       broadcast ADDRESS
90              the broadcast address on the interface.
91
92              It is possible to use the special symbols '+' and '-' instead of
93              the broadcast address. In this case, the broadcast address is
94              derived by setting/resetting the host bits of the interface pre‐
95              fix.
96
97
98       label LABEL
99              Each address may be tagged with a label string.  The maximum al‐
100              lowed total length of label is 15 characters.
101
102
103       scope SCOPE_VALUE
104              the scope of the area where this address is valid.  The avail‐
105              able scopes are listed in file /etc/iproute2/rt_scopes.  Prede‐
106              fined scope values are:
107
108                      global - the address is globally valid.
109
110                      site - (IPv6 only, deprecated) the address is site lo‐
111                      cal, i.e. it is valid inside this site.
112
113                      link - the address is link local, i.e. it is valid only
114                      on this device.
115
116                      host - the address is valid only inside this host.
117
118
119       metric NUMBER
120              priority of prefix route associated with address.
121
122
123       valid_lft LFT
124              the valid lifetime of this address; see section 5.5.4 of RFC
125              4862. When it expires, the address is removed by the kernel.
126              Defaults to forever.
127
128
129       preferred_lft LFT
130              the preferred lifetime of this address; see section 5.5.4 of RFC
131              4862. When it expires, the address is no longer used for new
132              outgoing connections. Defaults to forever.
133
134
135       home   (IPv6 only) designates this address the "home address" as de‐
136              fined in RFC 6275.
137
138
139       mngtmpaddr
140              (IPv6 only) make the kernel manage temporary addresses created
141              from this one as template on behalf of Privacy Extensions
142              (RFC3041). For this to become active, the use_tempaddr sysctl
143              setting has to be set to a value greater than zero.  The given
144              address needs to have a prefix length of 64. This flag allows to
145              use privacy extensions in a manually configured network, just
146              like if stateless auto-configuration was active.
147
148
149       nodad  (IPv6 only) do not perform Duplicate Address Detection (RFC
150              4862) when adding this address.
151
152
153       optimistic
154              (IPv6 only) When performing Duplicate Address Detection, use the
155              RFC 4429 optimistic variant.
156
157
158       noprefixroute
159              Do not automatically create a route for the network prefix of
160              the added address, and don't search for one to delete when re‐
161              moving the address. Changing an address to add this flag will
162              remove the automatically added prefix route, changing it to re‐
163              move this flag will create the prefix route automatically.
164
165
166       autojoin
167              Joining multicast groups on Ethernet level via ip maddr command
168              does not work if connected to an Ethernet switch that does IGMP
169              snooping since the switch would not replicate multicast packets
170              on ports that did not have IGMP reports for the multicast ad‐
171              dresses.
172
173              Linux VXLAN interfaces created via ip link add vxlan have the
174              group option that enables them to do the required join.
175
176              Using the autojoin flag when adding a multicast address enables
177              similar functionality for Openvswitch VXLAN interfaces as well
178              as other tunneling mechanisms that need to receive multicast
179              traffic.
180
181
182       proto ADDRPROTO
183              the protocol identifier of this route.  ADDRPROTO may be a num‐
184              ber or a string from the file /etc/iproute2/rt_addrprotos.  If
185              the protocol ID is not given,
186
187              ip assumes protocol 0. Several protocol values have a fixed in‐
188              terpretation. Namely:
189
190                      kernel_lo - The ::1 address that kernel installs on a
191                      loopback netdevice has this
192                        protocol value
193
194
195                      kernel_ra - IPv6 addresses installed in response to
196                      router advertisement messages
197
198
199                      kernel_ll - Link-local addresses have this protocol
200                      value
201
202
203
204              The rest of the values are not reserved and the administrator is
205              free to assign (or not to assign) protocol tags.
206
207
208   ip address delete - delete protocol address
209       Arguments: coincide with the arguments of ip addr add.  The device name
210       is a required argument. The rest are optional.  If no arguments are
211       given, the first address is deleted.
212
213
214   ip address show - look at protocol addresses
215       dev IFNAME (default)
216              name of device.
217
218
219       scope SCOPE_VAL
220              only list addresses with this scope.
221
222
223       to PREFIX
224              only list addresses matching this prefix.
225
226
227       label PATTERN
228              only list addresses with labels matching the PATTERN.  PATTERN
229              is a usual shell style pattern.
230
231
232       master DEVICE
233              only list interfaces enslaved to this master device.
234
235
236       vrf NAME
237              only list interfaces enslaved to this vrf.
238
239
240       type TYPE
241              only list interfaces of the given type.
242
243              Note that the type name is not checked against the list of sup‐
244              ported types - instead it is sent as-is to the kernel. Later it
245              is used to filter the returned interface list by comparing it
246              with the relevant attribute in case the kernel didn't filter al‐
247              ready. Therefore any string is accepted, but may lead to empty
248              output.
249
250
251       up     only list running interfaces.
252
253
254       nomaster
255              only list interfaces with no master.
256
257
258       dynamic and permanent
259              (IPv6 only) only list addresses installed due to stateless ad‐
260              dress configuration or only list permanent (not dynamic) ad‐
261              dresses. These two flags are inverses of each other, so -dynamic
262              is equal to permanent and -permanent is equal to dynamic.
263
264
265       tentative
266              (IPv6 only) only list addresses which have not yet passed dupli‐
267              cate address detection.
268
269
270       -tentative
271              (IPv6 only) only list addresses which are not in the process of
272              duplicate address detection currently.
273
274
275       deprecated
276              (IPv6 only) only list deprecated addresses.
277
278
279       -deprecated
280              (IPv6 only) only list addresses not being deprecated.
281
282
283       dadfailed
284              (IPv6 only) only list addresses which have failed duplicate ad‐
285              dress detection.
286
287
288       -dadfailed
289              (IPv6 only) only list addresses which have not failed duplicate
290              address detection.
291
292
293       temporary or secondary
294              List temporary IPv6 or secondary IPv4 addresses only. The Linux
295              kernel shares a single bit for those, so they are actually
296              aliases for each other although the meaning differs depending on
297              address family.
298
299
300       -temporary or -secondary
301              These flags are aliases for primary.
302
303
304       primary
305              List only primary addresses, in IPv6 exclude temporary ones.
306              This flag is the inverse of temporary and secondary.
307
308
309       -primary
310              This is an alias for temporary or secondary.
311
312
313       proto ADDRPROTO
314              Only show addresses with a given protocol, or those for which
315              the kernel response did not include protocol. See the corre‐
316              sponding argument to ip addr add for details about address pro‐
317              tocols.
318
319
320   ip address flush - flush protocol addresses
321       This command flushes the protocol addresses selected by some criteria.
322
323
324       This command has the same arguments as show except that type and master
325       selectors are not supported.  Another difference is that it does not
326       run when no arguments are given.
327
328
329       Warning: This command and other flush commands are unforgiving. They
330       will cruelly purge all the addresses.
331
332
333       With the -statistics option, the command becomes verbose. It prints out
334       the number of deleted addresses and the number of rounds made to flush
335       the address list.  If this option is given twice, ip address flush also
336       dumps all the deleted addresses in the format described in the previous
337       subsection.
338
339

EXAMPLES

341       ip address show
342           Shows IPv4 and IPv6 addresses assigned to all network interfaces.
343           The 'show' subcommand can be omitted.
344
345       ip address show up
346           Same as above except that only addresses assigned to active network
347           interfaces are shown.
348
349       ip address show dev eth0
350           Shows IPv4 and IPv6 addresses assigned to network interface eth0.
351
352       ip address add 2001:0db8:85a3::0370:7334/64 dev eth1
353           Adds an IPv6 address to network interface eth1.
354
355       ip address delete 2001:0db8:85a3::0370:7334/64 dev eth1
356           Delete the IPv6 address added above.
357
358       ip address flush dev eth4 scope global
359           Removes all global IPv4 and IPv6 addresses from device eth4. With‐
360           out 'scope global' it would remove all addresses including IPv6
361           link-local ones.
362
363

SEE ALSO

365       ip(8)
366
367

AUTHOR

369       Original Manpage by Michail Litvak <mci@owl.openwall.com>
370
371
372
373iproute2                          20 Dec 2011                    IP-ADDRESS(8)
Impressum