blob: 2eb07096a844cf79dd1b7f74ff791caac862afe9 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001.TH "IP\-ADDRESS" 8 "04 March 2012" "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
17.BR "ip address" " { " add " | " change " | " replace " } "
18.IB IFADDR " dev " STRING
19.RI "[ " LIFETIME " ] [ " CONFFLAG-LIST " ]"
20
21.ti -8
22.BR "ip address del"
23.IB IFADDR " dev " STRING
24
25.ti -8
26.BR "ip address" " { " show " | " flush " } [ " dev
27.IR STRING " ] [ "
28.B scope
29.IR SCOPE-ID " ] [ "
30.B to
31.IR PREFIX " ] [ " FLAG-LIST " ] [ "
32.B label
33.IR PATTERN " ]"
34
35.ti -8
36.IR IFADDR " := " PREFIX " | " ADDR
37.B peer
38.IR PREFIX " [ "
39.B broadcast
40.IR ADDR " ] [ "
41.B anycast
42.IR ADDR " ] [ "
43.B label
44.IR STRING " ] [ "
45.B scope
46.IR SCOPE-ID " ]"
47
48.ti -8
49.IR SCOPE-ID " := "
50.RB "[ " host " | " link " | " global " | "
51.IR NUMBER " ]"
52
53.ti -8
54.IR FLAG-LIST " := [ " FLAG-LIST " ] " FLAG
55
56.ti -8
57.IR FLAG " := "
58.RB "[ " permanent " | " dynamic " | " secondary " | " primary " | "\
59tentative " | " deprecated " | " dadfailed " | " temporary " | " CONFFLAG-LIST " ]"
60
61.ti -8
62.IR CONFFLAG-LIST " := [ " CONFFLAG-LIST " ] " CONFFLAG
63
64.ti -8
65.IR CONFFLAG " := "
66.RB "[ " home " | " nodad " ]"
67
68.ti -8
69.IR LIFETIME " := [ "
70.BI valid_lft " LFT"
71.RB "| " preferred_lft
72.IR LFT " ]"
73
74.ti -8
75.IR LFT " := [ "
76.BR forever " |"
77.IR SECONDS " ]"
78
79.SH "DESCRIPTION"
80The
81.B address
82is a protocol (IPv4 or IPv6) address attached
83to a network device. Each device must have at least one address
84to use the corresponding protocol. It is possible to have several
85different addresses attached to one device. These addresses are not
86discriminated, so that the term
87.B alias
88is not quite appropriate for them and we do not use it in this document.
89.sp
90The
91.B ip address
92command displays addresses and their properties, adds new addresses
93and deletes old ones.
94
95.SS ip address add - add new protocol address.
96
97.TP
98.BI dev " NAME"
99the name of the device to add the address to.
100
101.TP
102.BI local " ADDRESS " (default)
103the address of the interface. The format of the address depends
104on the protocol. It is a dotted quad for IP and a sequence of
105hexadecimal halfwords separated by colons for IPv6. The
106.I ADDRESS
107may be followed by a slash and a decimal number which encodes
108the network prefix length.
109
110.TP
111.BI peer " ADDRESS"
112the address of the remote endpoint for pointopoint interfaces.
113Again, the
114.I ADDRESS
115may be followed by a slash and a decimal number, encoding the network
116prefix length. If a peer address is specified, the local address
117cannot have a prefix length. The network prefix is associated
118with the peer rather than with the local address.
119
120.TP
121.BI broadcast " ADDRESS"
122the broadcast address on the interface.
123.sp
124It is possible to use the special symbols
125.B '+'
126and
127.B '-'
128instead of the broadcast address. In this case, the broadcast address
129is derived by setting/resetting the host bits of the interface prefix.
130
131.TP
132.BI label " NAME"
133Each address may be tagged with a label string.
134In order to preserve compatibility with Linux-2.0 net aliases,
135this string must coincide with the name of the device or must be prefixed
136with the device name followed by colon.
137
138.TP
139.BI scope " SCOPE_VALUE"
140the scope of the area where this address is valid.
141The available scopes are listed in file
142.BR "/etc/iproute2/rt_scopes" .
143Predefined scope values are:
144
145.in +8
146.B global
147- the address is globally valid.
148.sp
149.B link
150- the address is link local, i.e. it is valid only on this device.
151.sp
152.B host
153- the address is valid only inside this host.
154.in -8
155
156.TP
157.BI valid_lft " LFT"
158(IPv6 only) the valid lifetime of this address; see section 5.5.4 of
159RFC 4862. Defaults to
160.BR "forever" .
161
162.TP
163.BI preferred_lft " LFT"
164(IPv6 only) the preferred lifetime of this address; see section 5.5.4
165of RFC 4862. Defaults to
166.BR "forever" .
167
168.TP
169.B home
170(IPv6 only) designates this address the "home address" as defined in
171RFC 6275.
172
173.TP
174.B nodad
175(IPv6 only) do not perform Duplicate Address Detection (RFC 4862) when
176adding this address.
177
178.SS ip address delete - delete protocol address
179.B Arguments:
180coincide with the arguments of
181.B ip addr add.
182The device name is a required argument. The rest are optional.
183If no arguments are given, the first address is deleted.
184
185.SS ip address show - look at protocol addresses
186
187.TP
188.BI dev " NAME " (default)
189name of device.
190
191.TP
192.BI scope " SCOPE_VAL"
193only list addresses with this scope.
194
195.TP
196.BI to " PREFIX"
197only list addresses matching this prefix.
198
199.TP
200.BI label " PATTERN"
201only list addresses with labels matching the
202.IR "PATTERN" .
203.I PATTERN
204is a usual shell style pattern.
205
206.TP
207.BR dynamic " and " permanent
208(IPv6 only) only list addresses installed due to stateless
209address configuration or only list permanent (not dynamic)
210addresses.
211
212.TP
213.B tentative
214(IPv6 only) only list addresses which have not yet passed duplicate
215address detection.
216
217.TP
218.B deprecated
219(IPv6 only) only list deprecated addresses.
220
221.TP
222.B dadfailed
223(IPv6 only) only list addresses which have failed duplicate
224address detection.
225
226.TP
227.B temporary
228(IPv6 only) only list temporary addresses.
229
230.TP
231.BR primary " and " secondary
232only list primary (or secondary) addresses.
233
234.SS ip address flush - flush protocol addresses
235This command flushes the protocol addresses selected by some criteria.
236
237.PP
238This command has the same arguments as
239.B show.
240The difference is that it does not run when no arguments are given.
241
242.PP
243.B Warning:
244This command and other
245.B flush
246commands are unforgiving. They will cruelly purge all the addresses.
247
248.PP
249With the
250.B -statistics
251option, the command becomes verbose. It prints out the number of deleted
252addresses and the number of rounds made to flush the address list.
253If this option is given twice,
254.B ip address flush
255also dumps all the deleted addresses in the format described in the
256previous subsection.
257
258.SH "EXAMPLES"
259.PP
260ip address show dev eth0
261.RS 4
262Shows the addresses assigned to network interface eth0
263.RE
264.PP
265ip addr add 2001:0db8:85a3::0370:7334/64 dev eth1
266.RS 4
267Adds an IPv6 address to network interface eth1
268.RE
269.PP
270ip addr flush dev eth4
271.RS 4
272Removes all addresses from device eth4
273.RE
274
275.SH SEE ALSO
276.br
277.BR ip (8)
278
279.SH AUTHOR
280Original Manpage by Michail Litvak <mci@owl.openwall.com>