lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | .TH "IP\-ADDRESS" 8 "04 March 2012" "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 |
| 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 " | "\ |
| 59 | tentative " | " 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" |
| 80 | The |
| 81 | .B address |
| 82 | is a protocol (IPv4 or IPv6) address attached |
| 83 | to a network device. Each device must have at least one address |
| 84 | to use the corresponding protocol. It is possible to have several |
| 85 | different addresses attached to one device. These addresses are not |
| 86 | discriminated, so that the term |
| 87 | .B alias |
| 88 | is not quite appropriate for them and we do not use it in this document. |
| 89 | .sp |
| 90 | The |
| 91 | .B ip address |
| 92 | command displays addresses and their properties, adds new addresses |
| 93 | and deletes old ones. |
| 94 | |
| 95 | .SS ip address add - add new protocol address. |
| 96 | |
| 97 | .TP |
| 98 | .BI dev " NAME" |
| 99 | the name of the device to add the address to. |
| 100 | |
| 101 | .TP |
| 102 | .BI local " ADDRESS " (default) |
| 103 | the address of the interface. The format of the address depends |
| 104 | on the protocol. It is a dotted quad for IP and a sequence of |
| 105 | hexadecimal halfwords separated by colons for IPv6. The |
| 106 | .I ADDRESS |
| 107 | may be followed by a slash and a decimal number which encodes |
| 108 | the network prefix length. |
| 109 | |
| 110 | .TP |
| 111 | .BI peer " ADDRESS" |
| 112 | the address of the remote endpoint for pointopoint interfaces. |
| 113 | Again, the |
| 114 | .I ADDRESS |
| 115 | may be followed by a slash and a decimal number, encoding the network |
| 116 | prefix length. If a peer address is specified, the local address |
| 117 | cannot have a prefix length. The network prefix is associated |
| 118 | with the peer rather than with the local address. |
| 119 | |
| 120 | .TP |
| 121 | .BI broadcast " ADDRESS" |
| 122 | the broadcast address on the interface. |
| 123 | .sp |
| 124 | It is possible to use the special symbols |
| 125 | .B '+' |
| 126 | and |
| 127 | .B '-' |
| 128 | instead of the broadcast address. In this case, the broadcast address |
| 129 | is derived by setting/resetting the host bits of the interface prefix. |
| 130 | |
| 131 | .TP |
| 132 | .BI label " NAME" |
| 133 | Each address may be tagged with a label string. |
| 134 | In order to preserve compatibility with Linux-2.0 net aliases, |
| 135 | this string must coincide with the name of the device or must be prefixed |
| 136 | with the device name followed by colon. |
| 137 | |
| 138 | .TP |
| 139 | .BI scope " SCOPE_VALUE" |
| 140 | the scope of the area where this address is valid. |
| 141 | The available scopes are listed in file |
| 142 | .BR "/etc/iproute2/rt_scopes" . |
| 143 | Predefined 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 |
| 159 | RFC 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 |
| 165 | of 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 |
| 171 | RFC 6275. |
| 172 | |
| 173 | .TP |
| 174 | .B nodad |
| 175 | (IPv6 only) do not perform Duplicate Address Detection (RFC 4862) when |
| 176 | adding this address. |
| 177 | |
| 178 | .SS ip address delete - delete protocol address |
| 179 | .B Arguments: |
| 180 | coincide with the arguments of |
| 181 | .B ip addr add. |
| 182 | The device name is a required argument. The rest are optional. |
| 183 | If 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) |
| 189 | name of device. |
| 190 | |
| 191 | .TP |
| 192 | .BI scope " SCOPE_VAL" |
| 193 | only list addresses with this scope. |
| 194 | |
| 195 | .TP |
| 196 | .BI to " PREFIX" |
| 197 | only list addresses matching this prefix. |
| 198 | |
| 199 | .TP |
| 200 | .BI label " PATTERN" |
| 201 | only list addresses with labels matching the |
| 202 | .IR "PATTERN" . |
| 203 | .I PATTERN |
| 204 | is a usual shell style pattern. |
| 205 | |
| 206 | .TP |
| 207 | .BR dynamic " and " permanent |
| 208 | (IPv6 only) only list addresses installed due to stateless |
| 209 | address configuration or only list permanent (not dynamic) |
| 210 | addresses. |
| 211 | |
| 212 | .TP |
| 213 | .B tentative |
| 214 | (IPv6 only) only list addresses which have not yet passed duplicate |
| 215 | address 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 |
| 224 | address detection. |
| 225 | |
| 226 | .TP |
| 227 | .B temporary |
| 228 | (IPv6 only) only list temporary addresses. |
| 229 | |
| 230 | .TP |
| 231 | .BR primary " and " secondary |
| 232 | only list primary (or secondary) addresses. |
| 233 | |
| 234 | .SS ip address flush - flush protocol addresses |
| 235 | This command flushes the protocol addresses selected by some criteria. |
| 236 | |
| 237 | .PP |
| 238 | This command has the same arguments as |
| 239 | .B show. |
| 240 | The difference is that it does not run when no arguments are given. |
| 241 | |
| 242 | .PP |
| 243 | .B Warning: |
| 244 | This command and other |
| 245 | .B flush |
| 246 | commands are unforgiving. They will cruelly purge all the addresses. |
| 247 | |
| 248 | .PP |
| 249 | With the |
| 250 | .B -statistics |
| 251 | option, the command becomes verbose. It prints out the number of deleted |
| 252 | addresses and the number of rounds made to flush the address list. |
| 253 | If this option is given twice, |
| 254 | .B ip address flush |
| 255 | also dumps all the deleted addresses in the format described in the |
| 256 | previous subsection. |
| 257 | |
| 258 | .SH "EXAMPLES" |
| 259 | .PP |
| 260 | ip address show dev eth0 |
| 261 | .RS 4 |
| 262 | Shows the addresses assigned to network interface eth0 |
| 263 | .RE |
| 264 | .PP |
| 265 | ip addr add 2001:0db8:85a3::0370:7334/64 dev eth1 |
| 266 | .RS 4 |
| 267 | Adds an IPv6 address to network interface eth1 |
| 268 | .RE |
| 269 | .PP |
| 270 | ip addr flush dev eth4 |
| 271 | .RS 4 |
| 272 | Removes all addresses from device eth4 |
| 273 | .RE |
| 274 | |
| 275 | .SH SEE ALSO |
| 276 | .br |
| 277 | .BR ip (8) |
| 278 | |
| 279 | .SH AUTHOR |
| 280 | Original Manpage by Michail Litvak <mci@owl.openwall.com> |