717 lines
14 KiB
HTML
717 lines
14 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of IP-ADDRESS</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>IP-ADDRESS</H1>
|
|
Section: Linux (8)<BR>Updated: 20 Dec 2011<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
ip-address - protocol address management
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<P>
|
|
|
|
|
|
<BR>
|
|
|
|
<B>ip</B>
|
|
|
|
[ <I>OPTIONS</I> ]
|
|
|
|
<B>address</B>
|
|
|
|
{ <I>COMMAND</I> |
|
|
|
|
<B>help</B> }
|
|
|
|
<P>
|
|
<P>
|
|
<BR>
|
|
|
|
<B>ip address</B> { <B>add</B> | <B>change</B> | <B>replace</B> }
|
|
|
|
<I>IFADDR</I><B> dev </B><I>IFNAME</I>
|
|
|
|
[ <I>LIFETIME</I> ] [ <I>CONFFLAG-LIST</I> ]
|
|
|
|
<P>
|
|
<BR>
|
|
|
|
<B>ip address del</B>
|
|
|
|
<I>IFADDR</I><B> dev </B><I>IFNAME</I><B> [ </B><I>mngtmpaddr</I><B> ]</B>
|
|
|
|
<P>
|
|
<BR>
|
|
|
|
<B>ip address</B> { <B>save</B> | <B>flush</B> } [ <B>dev</B>
|
|
|
|
<I>IFNAME</I> ] [
|
|
|
|
<B>scope</B>
|
|
|
|
<I>SCOPE-ID</I> ] [
|
|
|
|
<B>metric</B>
|
|
|
|
<I>METRIC</I> ] [
|
|
|
|
<B>to</B>
|
|
|
|
<I>PREFIX</I> ] [ <I>FLAG-LIST</I> ] [
|
|
|
|
<B>label</B>
|
|
|
|
<I>PATTERN</I> ] [ <I>up</I> ]
|
|
|
|
<P>
|
|
<BR>
|
|
|
|
<B>ip address</B> [ <B>show</B> [ <B>dev</B>
|
|
|
|
<I>IFNAME</I> ] [
|
|
|
|
<B>scope</B>
|
|
|
|
<I>SCOPE-ID</I> ] [
|
|
|
|
<B>to</B>
|
|
|
|
<I>PREFIX</I> ] [ <I>FLAG-LIST</I> ] [
|
|
|
|
<B>label</B>
|
|
|
|
<I>PATTERN</I> ] [
|
|
|
|
<B>master</B>
|
|
|
|
<I>DEVICE</I> ] [
|
|
|
|
<B>type</B>
|
|
|
|
<I>TYPE</I> ] [
|
|
|
|
<B>vrf</B>
|
|
|
|
<I>NAME</I> ] [
|
|
|
|
<B>up</B> ] ]
|
|
|
|
<P>
|
|
<BR>
|
|
|
|
<B>ip address</B> { <B>showdump</B> | <B>restore</B> }
|
|
|
|
<P>
|
|
<BR>
|
|
|
|
<I>IFADDR</I> := <I>PREFIX</I> | <I>ADDR</I>
|
|
|
|
<B>peer</B>
|
|
|
|
<I>PREFIX</I> [
|
|
|
|
<B>broadcast</B>
|
|
|
|
<I>ADDR</I> ] [
|
|
|
|
<B>anycast</B>
|
|
|
|
<I>ADDR</I> ] [
|
|
|
|
<B>label</B>
|
|
|
|
<I>LABEL</I> ] [
|
|
|
|
<B>scope</B>
|
|
|
|
<I>SCOPE-ID</I> ]
|
|
|
|
<P>
|
|
<BR>
|
|
|
|
<I>SCOPE-ID</I> :=
|
|
|
|
[ <B>host</B> | <B>link</B> | <B>global</B> |
|
|
|
|
<I>NUMBER</I> ]
|
|
|
|
<P>
|
|
<BR>
|
|
|
|
<I>FLAG-LIST</I> := [ <I>FLAG-LIST</I> ] <I>FLAG</I>
|
|
|
|
<P>
|
|
<BR>
|
|
|
|
<I>FLAG</I> := [
|
|
|
|
[<B>-</B>]<B>permanent</B> |
|
|
|
|
[<B>-</B>]<B>dynamic</B> |
|
|
|
|
[<B>-</B>]<B>secondary</B> |
|
|
|
|
[<B>-</B>]<B>primary</B> |
|
|
|
|
[<B>-</B>]<B>tentative</B> |
|
|
|
|
[<B>-</B>]<B>deprecated</B> |
|
|
|
|
[<B>-</B>]<B>dadfailed</B> |
|
|
|
|
[<B>-</B>]<B>temporary</B> |
|
|
|
|
<I>CONFFLAG-LIST</I> ]
|
|
|
|
<P>
|
|
<BR>
|
|
|
|
<I>CONFFLAG-LIST</I> := [ <I>CONFFLAG-LIST</I> ] <I>CONFFLAG</I>
|
|
|
|
<P>
|
|
<BR>
|
|
|
|
<I>CONFFLAG</I> :=
|
|
|
|
[ <B>home</B> | <B>mngtmpaddr</B> | <B>nodad</B> | <B>noprefixroute</B> | <B>autojoin</B> ]
|
|
|
|
<P>
|
|
<BR>
|
|
|
|
<I>LIFETIME</I> := [
|
|
|
|
<B>valid_lft</B><I> LFT</I>
|
|
|
|
] [ <B>preferred_lft</B>
|
|
|
|
<I>LFT</I> ]
|
|
|
|
<P>
|
|
<BR>
|
|
|
|
<I>LFT</I> := [
|
|
|
|
<B>forever</B> |
|
|
|
|
<I>SECONDS</I> ]
|
|
|
|
<P>
|
|
<BR>
|
|
|
|
<I>TYPE</I> := [
|
|
|
|
<B>bridge</B> |
|
|
|
|
<B>bridge_slave</B> |
|
|
|
|
<B>bond</B> |
|
|
|
|
<B>bond_slave</B> |
|
|
|
|
<B>can</B> |
|
|
|
|
<B>dummy</B> |
|
|
|
|
<B>hsr</B> |
|
|
|
|
<B>ifb</B> |
|
|
|
|
<B>ipoib</B> |
|
|
|
|
<B>macvlan</B> |
|
|
|
|
<B>macvtap</B> |
|
|
|
|
<B>vcan</B> |
|
|
|
|
<B>veth</B> |
|
|
|
|
<B>vlan</B> |
|
|
|
|
<B>vxlan</B> |
|
|
|
|
<B>ip6tnl</B> |
|
|
|
|
<B>ipip</B> |
|
|
|
|
<B>sit</B> |
|
|
|
|
<B>gre</B> |
|
|
|
|
<B>gretap</B> |
|
|
|
|
<B>erspan</B> |
|
|
|
|
<B>ip6gre</B> |
|
|
|
|
<B>ip6gretap</B> |
|
|
|
|
<B>ip6erspan</B> |
|
|
|
|
<B>vti</B> |
|
|
|
|
<B>vrf</B> |
|
|
|
|
<B>nlmon</B> |
|
|
|
|
<B>ipvlan</B> |
|
|
|
|
<B>lowpan</B> |
|
|
|
|
<B>geneve</B> |
|
|
|
|
<B>macsec</B> ]
|
|
|
|
<P>
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
The
|
|
<B>address</B>
|
|
|
|
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
|
|
<B>alias</B>
|
|
|
|
is not quite appropriate for them and we do not use it in this document.
|
|
<P>
|
|
The
|
|
<B>ip address</B>
|
|
|
|
command displays addresses and their properties, adds new addresses
|
|
and deletes old ones.
|
|
<P>
|
|
<A NAME="lbAE"> </A>
|
|
<H3>ip address add - add new protocol address.</H3>
|
|
|
|
<P>
|
|
<DL COMPACT>
|
|
<DT id="1"><B>dev</B><I> IFNAME </I>
|
|
|
|
<DD>
|
|
the name of the device to add the address to.
|
|
<P>
|
|
<DT id="2"><B>local</B><I> ADDRESS </I><B>(default)</B>
|
|
|
|
<DD>
|
|
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
|
|
<I>ADDRESS</I>
|
|
|
|
may be followed by a slash and a decimal number which encodes
|
|
the network prefix length.
|
|
<P>
|
|
<DT id="3"><B>peer</B><I> ADDRESS</I>
|
|
|
|
<DD>
|
|
the address of the remote endpoint for pointopoint interfaces.
|
|
Again, the
|
|
<I>ADDRESS</I>
|
|
|
|
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.
|
|
<P>
|
|
<DT id="4"><B>broadcast</B><I> ADDRESS</I>
|
|
|
|
<DD>
|
|
the broadcast address on the interface.
|
|
<P>
|
|
It is possible to use the special symbols
|
|
<B>'+'</B>
|
|
|
|
and
|
|
<B>'-'</B>
|
|
|
|
instead of the broadcast address. In this case, the broadcast address
|
|
is derived by setting/resetting the host bits of the interface prefix.
|
|
<P>
|
|
<DT id="5"><B>label</B><I> LABEL</I>
|
|
|
|
<DD>
|
|
Each address may be tagged with a label string.
|
|
In order to preserve compatibility with Linux-2.0 net aliases,
|
|
this string must coincide with the name of the device or must be prefixed
|
|
with the device name followed by colon.
|
|
The maximum allowed total length of label is 15 characters.
|
|
<P>
|
|
<DT id="6"><B>scope</B><I> SCOPE_VALUE</I>
|
|
|
|
<DD>
|
|
the scope of the area where this address is valid.
|
|
The available scopes are listed in file
|
|
<B>/etc/iproute2/rt_scopes</B>.
|
|
|
|
Predefined scope values are:
|
|
<P>
|
|
|
|
<B>global</B>
|
|
|
|
- the address is globally valid.
|
|
<P>
|
|
<B>site</B>
|
|
|
|
- (IPv6 only, deprecated) the address is site local, i.e. it is
|
|
valid inside this site.
|
|
<P>
|
|
<B>link</B>
|
|
|
|
- the address is link local, i.e. it is valid only on this device.
|
|
<P>
|
|
<B>host</B>
|
|
|
|
- the address is valid only inside this host.
|
|
|
|
<P>
|
|
<DT id="7"><B>metric</B><I> NUMBER</I>
|
|
|
|
<DD>
|
|
priority of prefix route associated with address.
|
|
<P>
|
|
<DT id="8"><B>valid_lft</B><I> LFT</I>
|
|
|
|
<DD>
|
|
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
|
|
<B>forever</B>.
|
|
|
|
<P>
|
|
<DT id="9"><B>preferred_lft</B><I> LFT</I>
|
|
|
|
<DD>
|
|
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
|
|
<B>forever</B>.
|
|
|
|
<P>
|
|
<DT id="10"><B>home</B>
|
|
|
|
<DD>
|
|
(IPv6 only) designates this address the "home address" as defined in
|
|
RFC 6275.
|
|
<P>
|
|
<DT id="11"><B>mngtmpaddr</B>
|
|
|
|
<DD>
|
|
(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 <B>use_tempaddr</B> 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.
|
|
<P>
|
|
<DT id="12"><B>nodad</B>
|
|
|
|
<DD>
|
|
(IPv6 only) do not perform Duplicate Address Detection (RFC 4862) when
|
|
adding this address.
|
|
<P>
|
|
<DT id="13"><B>noprefixroute</B>
|
|
|
|
<DD>
|
|
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.
|
|
<P>
|
|
<DT id="14"><B>autojoin</B>
|
|
|
|
<DD>
|
|
Joining multicast groups on Ethernet level via
|
|
<B>ip maddr</B>
|
|
|
|
command does not work if connected to an Ethernet switch that does IGMP
|
|
snooping since the switch would not replicate multicast packets on ports that
|
|
did not have IGMP reports for the multicast addresses.
|
|
<P>
|
|
Linux VXLAN interfaces created via
|
|
<B>ip link add vxlan</B>
|
|
|
|
have the
|
|
<B>group</B>
|
|
|
|
option that enables them to do the required join.
|
|
<P>
|
|
Using the
|
|
<B>autojoin</B>
|
|
|
|
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.
|
|
<P>
|
|
</DL>
|
|
<A NAME="lbAF"> </A>
|
|
<H3>ip address delete - delete protocol address</H3>
|
|
|
|
<B>Arguments:</B>
|
|
|
|
coincide with the arguments of
|
|
<B>ip addr add.</B>
|
|
|
|
The device name is a required argument. The rest are optional.
|
|
If no arguments are given, the first address is deleted.
|
|
<P>
|
|
<A NAME="lbAG"> </A>
|
|
<H3>ip address show - look at protocol addresses</H3>
|
|
|
|
<P>
|
|
<DL COMPACT>
|
|
<DT id="15"><B>dev</B><I> IFNAME </I><B>(default)</B>
|
|
|
|
<DD>
|
|
name of device.
|
|
<P>
|
|
<DT id="16"><B>scope</B><I> SCOPE_VAL</I>
|
|
|
|
<DD>
|
|
only list addresses with this scope.
|
|
<P>
|
|
<DT id="17"><B>to</B><I> PREFIX</I>
|
|
|
|
<DD>
|
|
only list addresses matching this prefix.
|
|
<P>
|
|
<DT id="18"><B>label</B><I> PATTERN</I>
|
|
|
|
<DD>
|
|
only list addresses with labels matching the
|
|
<I>PATTERN</I>.
|
|
|
|
<I>PATTERN</I>
|
|
|
|
is a usual shell style pattern.
|
|
<P>
|
|
<DT id="19"><B>master</B><I> DEVICE</I>
|
|
|
|
<DD>
|
|
only list interfaces enslaved to this master device.
|
|
<P>
|
|
<DT id="20"><B>vrf</B><I> NAME </I>
|
|
|
|
<DD>
|
|
only list interfaces enslaved to this vrf.
|
|
<P>
|
|
<DT id="21"><B>type</B><I> TYPE</I>
|
|
|
|
<DD>
|
|
only list interfaces of the given type.
|
|
<P>
|
|
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.
|
|
<P>
|
|
<DT id="22"><B>up</B>
|
|
|
|
<DD>
|
|
only list running interfaces.
|
|
<P>
|
|
<DT id="23"><B>dynamic</B> and <B>permanent</B>
|
|
|
|
<DD>
|
|
(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
|
|
<B>-dynamic</B> is equal to <B>permanent</B> and
|
|
|
|
<B>-permanent</B> is equal to <B>dynamic</B>.
|
|
|
|
<P>
|
|
<DT id="24"><B>tentative</B>
|
|
|
|
<DD>
|
|
(IPv6 only) only list addresses which have not yet passed duplicate
|
|
address detection.
|
|
<P>
|
|
<DT id="25"><B>-tentative</B>
|
|
|
|
<DD>
|
|
(IPv6 only) only list addresses which are not in the process of
|
|
duplicate address detection currently.
|
|
<P>
|
|
<DT id="26"><B>deprecated</B>
|
|
|
|
<DD>
|
|
(IPv6 only) only list deprecated addresses.
|
|
<P>
|
|
<DT id="27"><B>-deprecated</B>
|
|
|
|
<DD>
|
|
(IPv6 only) only list addresses not being deprecated.
|
|
<P>
|
|
<DT id="28"><B>dadfailed</B>
|
|
|
|
<DD>
|
|
(IPv6 only) only list addresses which have failed duplicate
|
|
address detection.
|
|
<P>
|
|
<DT id="29"><B>-dadfailed</B>
|
|
|
|
<DD>
|
|
(IPv6 only) only list addresses which have not failed duplicate
|
|
address detection.
|
|
<P>
|
|
<DT id="30"><B>temporary</B> or <B>secondary</B>
|
|
|
|
<DD>
|
|
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.
|
|
<P>
|
|
<DT id="31"><B>-temporary</B> or <B>-secondary</B>
|
|
|
|
<DD>
|
|
These flags are aliases for
|
|
<B>primary</B>.
|
|
|
|
<P>
|
|
<DT id="32"><B>primary</B>
|
|
|
|
<DD>
|
|
List only primary addresses, in IPv6 exclude temporary ones. This flag is the
|
|
inverse of
|
|
<B>temporary</B> and <B>secondary</B>.
|
|
|
|
<P>
|
|
<DT id="33"><B>-primary</B>
|
|
|
|
<DD>
|
|
This is an alias for
|
|
<B>temporary</B> or <B>secondary</B>.
|
|
|
|
<P>
|
|
</DL>
|
|
<A NAME="lbAH"> </A>
|
|
<H3>ip address flush - flush protocol addresses</H3>
|
|
|
|
This command flushes the protocol addresses selected by some criteria.
|
|
<P>
|
|
<P>
|
|
|
|
This command has the same arguments as
|
|
<B>show</B> except that <B>type</B> and <B>master</B> selectors are not supported.
|
|
|
|
Another difference is that it does not run when no arguments are given.
|
|
<P>
|
|
<P>
|
|
|
|
<B>Warning:</B>
|
|
|
|
This command and other
|
|
<B>flush</B>
|
|
|
|
commands are unforgiving. They will cruelly purge all the addresses.
|
|
<P>
|
|
<P>
|
|
|
|
With the
|
|
<B>-statistics</B>
|
|
|
|
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,
|
|
<B>ip address flush</B>
|
|
|
|
also dumps all the deleted addresses in the format described in the
|
|
previous subsection.
|
|
<P>
|
|
<A NAME="lbAI"> </A>
|
|
<H2>EXAMPLES</H2>
|
|
|
|
<P>
|
|
|
|
ip address show
|
|
<DL COMPACT><DT id="34"><DD>
|
|
Shows IPv4 and IPv6 addresses assigned to all network interfaces. The 'show'
|
|
subcommand can be omitted.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
ip address show up
|
|
<DL COMPACT><DT id="35"><DD>
|
|
Same as above except that only addresses assigned to active network interfaces
|
|
are shown.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
ip address show dev eth0
|
|
<DL COMPACT><DT id="36"><DD>
|
|
Shows IPv4 and IPv6 addresses assigned to network interface eth0.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
ip address add 2001:0db8:85a3::0370:7334/64 dev eth1
|
|
<DL COMPACT><DT id="37"><DD>
|
|
Adds an IPv6 address to network interface eth1.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
ip address delete 2001:0db8:85a3::0370:7334/64 dev eth1
|
|
<DL COMPACT><DT id="38"><DD>
|
|
Delete the IPv6 address added above.
|
|
</DL>
|
|
|
|
<P>
|
|
|
|
ip address flush dev eth4 scope global
|
|
<DL COMPACT><DT id="39"><DD>
|
|
Removes all global IPv4 and IPv6 addresses from device eth4. Without 'scope
|
|
global' it would remove all addresses including IPv6 link-local ones.
|
|
</DL>
|
|
|
|
<P>
|
|
<A NAME="lbAJ"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<BR>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?8+ip">ip</A></B>(8)
|
|
|
|
<P>
|
|
<A NAME="lbAK"> </A>
|
|
<H2>AUTHOR</H2>
|
|
|
|
Original Manpage by Michail Litvak <<A HREF="mailto:mci@owl.openwall.com">mci@owl.openwall.com</A>>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="40"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="41"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="42"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DL>
|
|
<DT id="43"><A HREF="#lbAE">ip address add - add new protocol address.</A><DD>
|
|
<DT id="44"><A HREF="#lbAF">ip address delete - delete protocol address</A><DD>
|
|
<DT id="45"><A HREF="#lbAG">ip address show - look at protocol addresses</A><DD>
|
|
<DT id="46"><A HREF="#lbAH">ip address flush - flush protocol addresses</A><DD>
|
|
</DL>
|
|
<DT id="47"><A HREF="#lbAI">EXAMPLES</A><DD>
|
|
<DT id="48"><A HREF="#lbAJ">SEE ALSO</A><DD>
|
|
<DT id="49"><A HREF="#lbAK">AUTHOR</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:06:12 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|