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