| devIFNAME | the name of the device to add the address to. |
| localADDRESS(default) | the address of the interface. The format of the address depends on the protocol. It is a dotted quad for IP and a sequence of hexadecimal halfwords separated by colons for IPv6. The ADDRESS may be followed by a slash and a decimal number which encodes the network prefix length. |
| peerADDRESS | the address of the remote endpoint for pointopoint interfaces. Again, the ADDRESS may be followed by a slash and a decimal number, encoding the network prefix length. If a peer address is specified, the local address cannot have a prefix length. The network prefix is associated with the peer rather than with the local address. |
| broadcastADDRESS | It is possible to use the special symbols '+' and '-' instead of the broadcast address. In this case, the broadcast address is derived by setting/resetting the host bits of the interface prefix. |
| labelLABEL | Each address may be tagged with a label string. The maximum allowed total length of label is 15 characters. |
| scopeSCOPE_VALUE | global - the address is globally valid. site - (IPv6 only, deprecated) the address is site local, i.e. it is valid inside this site. link - the address is link local, i.e. it is valid only on this device. host - the address is valid only inside this host. |
| metricNUMBER | priority of prefix route associated with address. |
| valid_lftLFT | the valid lifetime of this address; see section 5.5.4 of RFC 4862. When it expires, the address is removed by the kernel. Defaults to forever. |
| preferred_lftLFT | the preferred lifetime of this address; see section 5.5.4 of RFC 4862. When it expires, the address is no longer used for new outgoing connections. Defaults to forever. |
| home | (IPv6 only) designates this address the "home address" as defined in RFC 6275. |
| mngtmpaddr | (IPv6 only) make the kernel manage temporary addresses created from this one as template on behalf of Privacy Extensions (RFC3041). For this to become active, the use_tempaddr sysctl setting has to be set to a value greater than zero. The given address needs to have a prefix length of 64. This flag allows to use privacy extensions in a manually configured network, just like if stateless auto-configuration was active. |
| nodad | (IPv6 only) do not perform Duplicate Address Detection (RFC 4862) when adding this address. |
| optimistic | (IPv6 only) When performing Duplicate Address Detection, use the RFC 4429 optimistic variant. |
| noprefixroute | Do not automatically create a route for the network prefix of the added address, and don't search for one to delete when removing the address. Changing an address to add this flag will remove the automatically added prefix route, changing it to remove this flag will create the prefix route automatically. |
| autojoin | Linux VXLAN interfaces created via ip link add vxlan have the group option that enables them to do the required join. Using the autojoin flag when adding a multicast address enables similar functionality for Openvswitch VXLAN interfaces as well as other tunneling mechanisms that need to receive multicast traffic. |
| protoADDRPROTO | ip assumes protocol 0. Several protocol values have a fixed interpretation. Namely: kernel_lo - The ::1 address that kernel installs on a loopback netdevice has this protocol value kernel_ra - IPv6 addresses installed in response to router advertisement messages kernel_ll - Link-local addresses have this protocol value The rest of the values are not reserved and the administrator is free to assign (or not to assign) protocol tags. |
| devIFNAME(default) | name of device. |
| scopeSCOPE_VAL | only list addresses with this scope. |
| toPREFIX | only list addresses matching this prefix. |
| labelPATTERN | only list addresses with labels matching the PATTERN. PATTERN is a usual shell style pattern. |
| masterDEVICE | only list interfaces enslaved to this master device. |
| vrfNAME | only list interfaces enslaved to this vrf. |
| typeTYPE | Note that the type name is not checked against the list of supported types - instead it is sent as-is to the kernel. Later it is used to filter the returned interface list by comparing it with the relevant attribute in case the kernel didn't filter already. Therefore any string is accepted, but may lead to empty output. |
| up | only list running interfaces. |
| down | only list not running interfaces. |
| nomaster | only list interfaces with no master. |
| dynamic and permanent | (IPv6 only) only list addresses installed due to stateless address configuration or only list permanent (not dynamic) addresses. These two flags are inverses of each other, so -dynamic is equal to permanent and -permanent is equal to dynamic. |
| tentative | (IPv6 only) only list addresses which have not yet passed duplicate address detection. |
| -tentative | (IPv6 only) only list addresses which are not in the process of duplicate address detection currently. |
| deprecated | (IPv6 only) only list deprecated addresses. |
| -deprecated | (IPv6 only) only list addresses not being deprecated. |
| dadfailed | (IPv6 only) only list addresses which have failed duplicate address detection. |
| -dadfailed | (IPv6 only) only list addresses which have not failed duplicate address detection. |
| temporary or secondary | List temporary IPv6 or secondary IPv4 addresses only. The Linux kernel shares a single bit for those, so they are actually aliases for each other although the meaning differs depending on address family. |
| -temporary-secondary | These flags are aliases for primary. |
| primary | List only primary addresses, in IPv6 exclude temporary ones. This flag is the inverse of temporary and secondary. |
| -primary | This is an alias for temporary or secondary. |
| protoADDRPROTO | Only show addresses with a given protocol, or those for which the kernel response did not include protocol. See the corresponding argument to ip address add for details about address protocols. |
NAME
ip-address - protocol address management
SYNOPSIS
ip [ OPTIONS ] address { COMMAND | help }
ip address { add | change | replace } IFADDRdevIFNAME [ LIFETIME ] [ CONFFLAG-LIST ]
ip address deleteIFADDRdevIFNAME[mngtmpaddr]
ip address { save | flush } [ devIFNAME ] [ scopeSCOPE-ID ] [ metricMETRIC ] [ toPREFIX ] [ FLAG-LIST ] [ labelPATTERN ] [ { up | down } ]
ip address [ show [ devIFNAME ] [ scopeSCOPE-ID ] [ toPREFIX ] [ FLAG-LIST ] [ labelPATTERN ] [ masterDEVICE ] [ typeTYPE ] [ vrfNAME ] [ { up | down } ] [ nomaster ] protoADDRPROTO ] ]
ip address { showdump | restore }
IFADDR := PREFIX | ADDRpeerPREFIX [ broadcastADDR ] [ anycastADDR ] [ labelLABEL ] [ scopeSCOPE-ID ] [ protoADDRPROTO ]
SCOPE-ID := [ host | link | global | NUMBER ]
ADDRPROTO := [ NAME | NUMBER ]
FLAG-LIST := [ FLAG-LIST ] FLAG
FLAG := [ [-]permanent | [-]dynamic | [-]secondary | [-]primary | [-]tentative | [-]deprecated | [-]dadfailed | [-]temporary | CONFFLAG-LIST ]
CONFFLAG-LIST := [ CONFFLAG-LIST ] CONFFLAG
CONFFLAG := [ home | mngtmpaddr | nodad | optimistic | noprefixroute | autojoin ]
LIFETIME := [ valid_lftLFT ] [ preferred_lftLFT ]
LFT := [ forever | SECONDS ]
TYPE := [ bridge | bridge_slave | bond | bond_slave | can | dummy | hsr | ifb | ipoib | macvlan | macvtap | vcan | veth | vlan | vxlan | ip6tnl | ipip | sit | gre | gretap | erspan | ip6gre | ip6gretap | ip6erspan | vti | vrf | nlmon | ipvlan | lowpan | geneve | macsec | netkit ]
DESCRIPTION
The address is a protocol (IPv4 or IPv6) address attached to a network device. Each device must have at least one address to use the corresponding protocol. It is possible to have several different addresses attached to one device. These addresses are not discriminated, so that the term alias is not quite appropriate for them and we do not use it in this document.
The ip address command displays addresses and their properties, adds new addresses and deletes old ones.
ip address add - add new protocol address.
- devIFNAME
the name of the device to add the address to.
- localADDRESS(default)
the address of the interface. The format of the address depends on the protocol. It is a dotted quad for IP and a sequence of hexadecimal halfwords separated by colons for IPv6. The ADDRESS may be followed by a slash and a decimal number which encodes the network prefix length.
- peerADDRESS
the address of the remote endpoint for pointopoint interfaces. Again, the ADDRESS may be followed by a slash and a decimal number, encoding the network prefix length. If a peer address is specified, the local address cannot have a prefix length. The network prefix is associated with the peer rather than with the local address.
- broadcastADDRESS
It is possible to use the special symbols '+' and '-' instead of the broadcast address. In this case, the broadcast address is derived by setting/resetting the host bits of the interface prefix.
- labelLABEL
Each address may be tagged with a label string. The maximum allowed total length of label is 15 characters.
- scopeSCOPE_VALUE
global - the address is globally valid.
site - (IPv6 only, deprecated) the address is site local, i.e. it is valid inside this site.
link - the address is link local, i.e. it is valid only on this device.
host - the address is valid only inside this host.
- metricNUMBER
priority of prefix route associated with address.
- valid_lftLFT
the valid lifetime of this address; see section 5.5.4 of RFC 4862. When it expires, the address is removed by the kernel. Defaults to forever.
- preferred_lftLFT
the preferred lifetime of this address; see section 5.5.4 of RFC 4862. When it expires, the address is no longer used for new outgoing connections. Defaults to forever.
- home
(IPv6 only) designates this address the "home address" as defined in RFC 6275.
- mngtmpaddr
(IPv6 only) make the kernel manage temporary addresses created from this one as template on behalf of Privacy Extensions (RFC3041). For this to become active, the use_tempaddr sysctl setting has to be set to a value greater than zero. The given address needs to have a prefix length of 64. This flag allows to use privacy extensions in a manually configured network, just like if stateless auto-configuration was active.
- nodad
(IPv6 only) do not perform Duplicate Address Detection (RFC 4862) when adding this address.
- optimistic
(IPv6 only) When performing Duplicate Address Detection, use the RFC 4429 optimistic variant.
- noprefixroute
Do not automatically create a route for the network prefix of the added address, and don't search for one to delete when removing the address. Changing an address to add this flag will remove the automatically added prefix route, changing it to remove this flag will create the prefix route automatically.
- autojoin
Linux VXLAN interfaces created via ip link add vxlan have the group option that enables them to do the required join.
Using the autojoin flag when adding a multicast address enables similar functionality for Openvswitch VXLAN interfaces as well as other tunneling mechanisms that need to receive multicast traffic.
- protoADDRPROTO
ip assumes protocol 0. Several protocol values have a fixed interpretation. Namely:
kernel_lo - The ::1 address that kernel installs on a loopback netdevice has this protocol value
kernel_ra - IPv6 addresses installed in response to router advertisement messages
kernel_ll - Link-local addresses have this protocol value
The rest of the values are not reserved and the administrator is free to assign (or not to assign) protocol tags.
ip address delete - delete protocol address
Arguments: coincide with the arguments of ip address add.
The device name is a required argument.
ip address show - look at protocol addresses
- devIFNAME(default)
name of device.
- scopeSCOPE_VAL
only list addresses with this scope.
- toPREFIX
only list addresses matching this prefix.
- labelPATTERN
only list addresses with labels matching the PATTERN. PATTERN is a usual shell style pattern.
- masterDEVICE
only list interfaces enslaved to this master device.
- vrfNAME
only list interfaces enslaved to this vrf.
- typeTYPE
Note that the type name is not checked against the list of supported types - instead it is sent as-is to the kernel. Later it is used to filter the returned interface list by comparing it with the relevant attribute in case the kernel didn't filter already. Therefore any string is accepted, but may lead to empty output.
- up
only list running interfaces.
- down
only list not running interfaces.
- nomaster
only list interfaces with no master.
- dynamic and permanent
(IPv6 only) only list addresses installed due to stateless address configuration or only list permanent (not dynamic) addresses. These two flags are inverses of each other, so -dynamic is equal to permanent and -permanent is equal to dynamic.
- tentative
(IPv6 only) only list addresses which have not yet passed duplicate address detection.
- -tentative
(IPv6 only) only list addresses which are not in the process of duplicate address detection currently.
- deprecated
(IPv6 only) only list deprecated addresses.
- -deprecated
(IPv6 only) only list addresses not being deprecated.
- dadfailed
(IPv6 only) only list addresses which have failed duplicate address detection.
- -dadfailed
(IPv6 only) only list addresses which have not failed duplicate address detection.
- temporary or secondary
List temporary IPv6 or secondary IPv4 addresses only. The Linux kernel shares a single bit for those, so they are actually aliases for each other although the meaning differs depending on address family.
- -temporary or -secondary
These flags are aliases for primary.
- primary
List only primary addresses, in IPv6 exclude temporary ones. This flag is the inverse of temporary and secondary.
- -primary
This is an alias for temporary or secondary.
- protoADDRPROTO
Only show addresses with a given protocol, or those for which the kernel response did not include protocol. See the corresponding argument to ip address add for details about address protocols.
ip address flush - flush protocol addresses
This command flushes the protocol addresses selected by some criteria.
This command has the same arguments as show except that type and master selectors are not supported. Another difference is that it does not run when no arguments are given.
Warning: This command and other flush commands are unforgiving. They will cruelly purge all the addresses.
With the -statistics option, the command becomes verbose. It prints out the number of deleted addresses and the number of rounds made to flush the address list. If this option is given twice, ip address flush also dumps all the deleted addresses in the format described in the previous subsection.
EXAMPLES
ip address show
ip address show up
ip address show dev eth0
ip address add 2001:0db8:85a3::0370:7334/64 dev eth1
ip address delete 2001:0db8:85a3::0370:7334/64 dev eth1
ip address flush dev eth4 scope global
SEE ALSO
ip(8)
AUTHOR
Original Manpage by Michail Litvak <[email protected]>