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