man-pages/man8/ip.8.html
2021-03-31 01:06:50 +01:00

626 lines
12 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML><HEAD><TITLE>Man page of IP</TITLE>
</HEAD><BODY>
<H1>IP</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">&nbsp;</A>
<H2>NAME</H2>
ip - show / manipulate routing, network devices, interfaces and tunnels
<A NAME="lbAC">&nbsp;</A>
<H2>SYNOPSIS</H2>
<P>
<BR>
<B>ip</B>
[ <I>OPTIONS</I> ] <I>OBJECT</I> { <I>COMMAND</I> |
<B>help</B> }
<P>
<P>
<BR>
<B>ip</B>
[ <B>-force</B> ]
<B>-batch </B><I>filename</I>
<P>
<P>
<BR>
<I>OBJECT</I> := {
<B>link</B> | <B>address</B> | <B>addrlabel</B> | <B>route</B> | <B>rule</B> | <B>neigh</B> | <B>ntable</B> | <B>tunnel</B> | <B>tuntap</B> | <B>maddress</B> | <B>mroute</B> | <B>mrule</B> | <B>monitor</B> | <B>xfrm</B> | <B>netns</B> }
<P>
<P>
<BR>
<I>OPTIONS</I> := {
<B>-V</B>[<I>ersion</I>] |
<B>-h</B>[<I>uman-readable</I>] |
<B>-s</B>[<I>tatistics</I>] |
<B>-d</B>[<I>etails</I>] |
<B>-r</B>[<I>esolve</I>] |
<B>-iec</B> |
<B>-f</B>[<I>amily</I>] {
<B>inet</B> | <B>inet6</B> | <B>link</B> } |
<B>-4</B> |
<B>-6</B> |
<B>-I</B> |
<B>-D</B> |
<B>-B</B> |
<B>-0</B> |
<B>-l</B>[<I>oops</I>] { <B>maximum-addr-flush-attempts</B> } |
<B>-o</B>[<I>neline</I>] |
<B>-rc</B>[<I>vbuf</I>] [<B>size</B>] |
<B>-t</B>[<I>imestamp</I>] |
<B>-ts</B>[<I>hort</I>] |
<B>-n</B>[<I>etns</I>] name |
<B>-N</B>[<I>umeric</I>] |
<B>-a</B>[<I>ll</I>] |
<B>-c</B>[<I>olor</I>] |
<B>-br</B>[<I>ief</I>] |
<B>-j</B>[son] |
<B>-p</B>[retty] }
<P>
<A NAME="lbAD">&nbsp;</A>
<H2>OPTIONS</H2>
<P>
<DL COMPACT>
<DT id="1"><B>-V</B>,<B> -Version</B>
<DD>
Print the version of the
<B>ip</B>
utility and exit.
<P>
<DT id="2"><B>-h,</B> -human,<B> -human-readable</B>
<DD>
output statistics with human readable values followed by suffix.
<P>
<DT id="3"><B>-b,</B> -batch <B>&lt;FILENAME&gt;</B>
<DD>
Read commands from provided file or standard input and invoke them.
First failure will cause termination of ip.
<P>
<DT id="4"><B>-force</B>
<DD>
Don't terminate ip on errors in batch mode. If there were any errors
during execution of the commands, the application return code will be
non zero.
<P>
<DT id="5"><B>-s</B>,<B> -stats</B>,<B> -statistics</B>
<DD>
Output more information. If the option
appears twice or more, the amount of information increases.
As a rule, the information is statistics or some time values.
<P>
<DT id="6"><B>-d</B>,<B> -details</B>
<DD>
Output more detailed information.
<P>
<DT id="7"><B>-l</B>,<B> -loops </B>&lt;COUNT&gt;
<DD>
Specify maximum number of loops the 'ip address flush' logic
will attempt before giving up. The default is 10.
Zero (0) means loop until all addresses are removed.
<P>
<DT id="8"><B>-f</B>,<B> -family </B>&lt;FAMILY&gt;
<DD>
Specifies the protocol family to use. The protocol family identifier
can be one of
<B>inet</B>,<B> inet6</B>,<B> bridge</B>,<B> mpls</B>
or
<B>link</B>.
If this option is not present,
the protocol family is guessed from other arguments. If the rest
of the command line does not give enough information to guess the
family,
<B>ip</B>
falls back to the default one, usually
<B>inet</B>
or
<B>any</B>.
<B>link</B>
is a special family identifier meaning that no networking protocol
is involved.
<P>
<DT id="9"><B>-4</B>
<DD>
shortcut for
<B>-family inet</B>.
<P>
<DT id="10"><B>-6</B>
<DD>
shortcut for
<B>-family inet6</B>.
<P>
<DT id="11"><B>-B</B>
<DD>
shortcut for
<B>-family bridge</B>.
<P>
<DT id="12"><B>-M</B>
<DD>
shortcut for
<B>-family mpls</B>.
<P>
<DT id="13"><B>-0</B>
<DD>
shortcut for
<B>-family link</B>.
<P>
<DT id="14"><B>-o</B>,<B> -oneline</B>
<DD>
output each record on a single line, replacing line feeds
with the
<B>'\'</B>
character. This is convenient when you want to count records
with
<B><A HREF="/cgi-bin/man/man2html?1+wc">wc</A></B>(1)
or to
<B><A HREF="/cgi-bin/man/man2html?1+grep">grep</A></B>(1)
the output.
<P>
<DT id="15"><B>-r</B>,<B> -resolve</B>
<DD>
use the system's name resolver to print DNS names instead of
host addresses.
<P>
<DT id="16"><B>-n</B>,<B> -netns </B>&lt;NETNS&gt;
<DD>
switches
<B>ip</B>
to the specified network namespace
<I>NETNS</I>.
Actually it just simplifies executing of:
<P>
<B>ip netns exec</B>
<I>NETNS</I>
<B>ip</B>
[ <I>OPTIONS</I> ] <I>OBJECT</I> { <I>COMMAND</I> |
<B>help</B> }
<P>
to
<P>
<B>ip</B>
-n[etns] <I>NETNS</I> [ <I>OPTIONS</I> ] <I>OBJECT</I> { <I>COMMAND</I> |
<B>help</B> }
<P>
<DT id="17"><B>-N</B>,<B> -Numeric</B>
<DD>
Print the number of protocol, scope, dsfield, etc directly instead of
converting it to human readable name.
<P>
<DT id="18"><B>-a</B>,<B> -all</B>
<DD>
executes specified command over all objects, it depends if command
supports this option.
<P>
<DT id="19"><B>-c</B>[<B>color</B>][<B>=</B>{<B>always</B>|<B>auto</B>|<B>never</B>}
<DD>
Configure color output. If parameter is omitted or
<B>always</B>,
color output is enabled regardless of stdout state. If parameter is
<B>auto</B>,
stdout is checked to be a terminal before enabling color output. If
parameter is
<B>never</B>,
color output is disabled. If specified multiple times, the last one takes
precedence. This flag is ignored if
<B>-json</B>
is also given.
<P>
Used color palette can be influenced by
<B>COLORFGBG</B>
environment variable
(see
<B>ENVIRONMENT</B>).
<P>
<DT id="20"><B>-t</B>,<B> -timestamp</B>
<DD>
display current time when using monitor option.
<P>
<DT id="21"><B>-ts</B>,<B> -tshort</B>
<DD>
Like
<B>-timestamp</B>,
but use shorter format.
<P>
<DT id="22"><B>-rc</B>,<B> -rcvbuf</B>&lt;SIZE&gt;
<DD>
Set the netlink socket receive buffer size, defaults to 1MB.
<P>
<DT id="23"><B>-iec</B>
<DD>
print human readable rates in IEC units (e.g. 1Ki = 1024).
<P>
<DT id="24"><B>-br</B>,<B> -brief</B>
<DD>
Print only basic information in a tabular format for better
readability. This option is currently only supported by
<B>ip addr show </B>and<B> ip link show </B>commands.
<P>
<DT id="25"><B>-j,</B> -json
<DD>
Output results in JavaScript Object Notation (JSON).
<P>
<DT id="26"><B>-p,</B> -pretty
<DD>
The default JSON format is compact and more efficient to parse but
hard for most users to read. This flag adds indentation for
readability.
<P>
</DL>
<A NAME="lbAE">&nbsp;</A>
<H2>IP - COMMAND SYNTAX</H2>
<P>
<A NAME="lbAF">&nbsp;</A>
<H3><I>OBJECT</I>
</H3>
<P>
<DL COMPACT>
<DT id="27"><B>address</B>
<DD>
- protocol (IP or IPv6) address on a device.
<P>
<DT id="28"><B>addrlabel</B>
<DD>
- label configuration for protocol address selection.
<P>
<DT id="29"><B>l2tp</B>
<DD>
- tunnel ethernet over IP (L2TPv3).
<P>
<DT id="30"><B>link</B>
<DD>
- network device.
<P>
<DT id="31"><B>maddress</B>
<DD>
- multicast address.
<P>
<DT id="32"><B>monitor</B>
<DD>
- watch for netlink messages.
<P>
<DT id="33"><B>mroute</B>
<DD>
- multicast routing cache entry.
<P>
<DT id="34"><B>mrule</B>
<DD>
- rule in multicast routing policy database.
<P>
<DT id="35"><B>neighbour</B>
<DD>
- manage ARP or NDISC cache entries.
<P>
<DT id="36"><B>netns</B>
<DD>
- manage network namespaces.
<P>
<DT id="37"><B>ntable</B>
<DD>
- manage the neighbor cache's operation.
<P>
<DT id="38"><B>route</B>
<DD>
- routing table entry.
<P>
<DT id="39"><B>rule</B>
<DD>
- rule in routing policy database.
<P>
<DT id="40"><B>tcp_metrics/tcpmetrics</B>
<DD>
- manage TCP Metrics
<P>
<DT id="41"><B>token</B>
<DD>
- manage tokenized interface identifiers.
<P>
<DT id="42"><B>tunnel</B>
<DD>
- tunnel over IP.
<P>
<DT id="43"><B>tuntap</B>
<DD>
- manage TUN/TAP devices.
<P>
<DT id="44"><B>xfrm</B>
<DD>
- manage IPSec policies.
<P>
</DL>
<P>
The names of all objects may be written in full or
abbreviated form, for example
<B>address</B>
can be abbreviated as
<B>addr</B>
or just
<B>a.</B>
<P>
<A NAME="lbAG">&nbsp;</A>
<H3><I>COMMAND</I>
</H3>
<P>
Specifies the action to perform on the object.
The set of possible actions depends on the object type.
As a rule, it is possible to
<B>add</B>,<B> delete</B>
and
<B>show</B>
(or
<B>list</B>
) objects, but some objects do not allow all of these operations
or have some additional commands. The
<B>help</B>
command is available for all objects. It prints
out a list of available commands and argument syntax conventions.
<P>
If no command is given, some default command is assumed.
Usually it is
<B>list</B>
or, if the objects of this class cannot be listed,
<B>help</B>.
<P>
<A NAME="lbAH">&nbsp;</A>
<H2>ENVIRONMENT</H2>
<DL COMPACT>
<DT id="45"><B>COLORFGBG</B>
<DD>
If set, it's value is used for detection whether background is dark or
light and use contrast colors for it.
<P>
COLORFGBG environment variable usually contains either two or three
values separated by semicolons; we want the last value in either case.
If this value is 0-6 or 8, chose colors suitable for dark background:
<P>
COLORFGBG=&quot;;0&quot; ip -c a
<P>
</DL>
<A NAME="lbAI">&nbsp;</A>
<H2>EXIT STATUS</H2>
Exit status is 0 if command was successful, and 1 if there is a syntax error.
If an error was reported by the kernel exit status is 2.
<P>
<A NAME="lbAJ">&nbsp;</A>
<H2>EXAMPLES</H2>
<P>
ip addr
<DL COMPACT><DT id="46"><DD>
Shows addresses assigned to all network interfaces.
</DL>
<P>
ip neigh
<DL COMPACT><DT id="47"><DD>
Shows the current neighbour table in kernel.
</DL>
<P>
ip link set x up
<DL COMPACT><DT id="48"><DD>
Bring up interface x.
</DL>
<P>
ip link set x down
<DL COMPACT><DT id="49"><DD>
Bring down interface x.
</DL>
<P>
ip route
<DL COMPACT><DT id="50"><DD>
Show table routes.
</DL>
<P>
<A NAME="lbAK">&nbsp;</A>
<H2>HISTORY</H2>
<B>ip</B>
was written by Alexey N. Kuznetsov and added in Linux 2.2.
<A NAME="lbAL">&nbsp;</A>
<H2>SEE ALSO</H2>
<B><A HREF="/cgi-bin/man/man2html?8+ip-address">ip-address</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+ip-addrlabel">ip-addrlabel</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+ip-l2tp">ip-l2tp</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+ip-link">ip-link</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+ip-maddress">ip-maddress</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+ip-monitor">ip-monitor</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+ip-mroute">ip-mroute</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+ip-neighbour">ip-neighbour</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+ip-netns">ip-netns</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+ip-ntable">ip-ntable</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+ip-route">ip-route</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+ip-rule">ip-rule</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+ip-tcp_metrics">ip-tcp_metrics</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+ip-token">ip-token</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+ip-tunnel">ip-tunnel</A></B>(8),
<B><A HREF="/cgi-bin/man/man2html?8+ip-xfrm">ip-xfrm</A></B>(8)
<BR>
IP Command reference <B>ip-cref.ps</B>
<A NAME="lbAM">&nbsp;</A>
<H2>REPORTING BUGS</H2>
Report any bugs to the Network Developers mailing list
<B>&lt;<A HREF="mailto:netdev@vger.kernel.org">netdev@vger.kernel.org</A>&gt;</B>
where the development and maintenance is primarily done.
You do not have to be subscribed to the list to send a message there.
<P>
<A NAME="lbAN">&nbsp;</A>
<H2>AUTHOR</H2>
Original Manpage by Michail Litvak &lt;<A HREF="mailto:mci@owl.openwall.com">mci@owl.openwall.com</A>&gt;
<P>
<HR>
<A NAME="index">&nbsp;</A><H2>Index</H2>
<DL>
<DT id="51"><A HREF="#lbAB">NAME</A><DD>
<DT id="52"><A HREF="#lbAC">SYNOPSIS</A><DD>
<DT id="53"><A HREF="#lbAD">OPTIONS</A><DD>
<DT id="54"><A HREF="#lbAE">IP - COMMAND SYNTAX</A><DD>
<DL>
<DT id="55"><A HREF="#lbAF"><I>OBJECT</I>
</A><DD>
<DT id="56"><A HREF="#lbAG"><I>COMMAND</I>
</A><DD>
</DL>
<DT id="57"><A HREF="#lbAH">ENVIRONMENT</A><DD>
<DT id="58"><A HREF="#lbAI">EXIT STATUS</A><DD>
<DT id="59"><A HREF="#lbAJ">EXAMPLES</A><DD>
<DT id="60"><A HREF="#lbAK">HISTORY</A><DD>
<DT id="61"><A HREF="#lbAL">SEE ALSO</A><DD>
<DT id="62"><A HREF="#lbAM">REPORTING BUGS</A><DD>
<DT id="63"><A HREF="#lbAN">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>