当前位置: 首页 > 工具软件 > CIP Reporting > 使用案例 >

ip:网络配置工具

沈淇
2023-12-01

一、语法

onlylove@ubuntu:~$ ip -help
Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }
       ip [ -force ] -batch filename
where  OBJECT := { link | address | addrlabel | route | rule | neigh | ntable |
                   tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |
                   netns | l2tp | fou | macsec | tcp_metrics | token | netconf | ila |
                   vrf | sr | nexthop }
       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |
                    -h[uman-readable] | -iec | -j[son] | -p[retty] |
                    -f[amily] { inet | inet6 | mpls | bridge | link } |
                    -4 | -6 | -I | -D | -M | -B | -0 |
                    -l[oops] { maximum-addr-flush-attempts } | -br[ief] |
                    -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] |
                    -rc[vbuf] [size] | -n[etns] name | -N[umeric] | -a[ll] |
                    -c[olor]}
onlylove@ubuntu:~$

二、man ip

IP(8)                                                     Linux                                                    IP(8)

NAME
       ip - show / manipulate routing, network devices, interfaces and tunnels
            显示/操作路由、网络设备、接口和隧道

SYNOPSIS
       ip [ OPTIONS ] OBJECT { COMMAND | help }

       ip [ -force ] -batch filename

       OBJECT := { link | address | addrlabel | route | rule | neigh | ntable | tunnel | tuntap | maddress | mroute |
               mrule | monitor | xfrm | netns | l2tp | tcp_metrics | token | macsec }

       OPTIONS := { -V[ersion] | -h[uman-readable] | -s[tatistics] | -d[etails] | -r[esolve] | -iec | -f[amily] { inet |
               inet6 | link } | -4 | -6 | -I | -D | -B | -0 | -l[oops] { maximum-addr-flush-attempts } | -o[neline] |
               -rc[vbuf] [size] | -t[imestamp] | -ts[hort] | -n[etns] name | -N[umeric] | -a[ll] | -c[olor] | -br[ief] |
               -j[son] | -p[retty] }

OPTIONS
       -V, -Version
              Print the version of the ip utility and exit.

              打印 ip 实用程序的版本并退出。

       -h, -human, -human-readable
              output statistics with human readable values followed by suffix.

              输出具有人类可读值的统计信息,后跟后缀。

       -b, -batch <FILENAME>
              Read commands from provided file or standard input and invoke them.  First failure will cause termination of ip.

              从提供的文件或标准输入中读取命令并调用它们。 第一次失败将导致 ip 终止。

       -force 
              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.

              在批处理模式下,不要在出现错误时终止 IP。如果在执行命令期间出现任何错误,则应用程序返回代码将不为零。

       -s, -stats, -statistics
              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.

              输出更多信息。如果该选项出现两次或更多次,则信息量会增加。通常,信息是统计信息或某些时间值。

       -d, -details
              Output more detailed information.

              输出更详细的信息。

       -l, -loops <COUNT>
              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.

              指定"IP 地址刷新"逻辑在放弃之前将尝试的最大循环数。默认值为 10。 零(0) 表示循环,直到删除所有地址。

       -f, -family <FAMILY>
              Specifies the protocol family to use. The protocol family identifier can be one of inet, inet6, bridge, mpls or link.  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, ip falls back to the default one, usually inet or any.  link is a special family identifier meaning that no networking protocol is involved.

              指定要使用的协议系列。协议系列标识符可以是 inet、inet6、bridge、mpls 或 link 之一。如果这个选项不存在,则从其他参数猜测协议族。如果命令行的其余部分没有提供足够的信息来猜测这个族,ip就会退回到默认值,通常是inet或any。link 是一个特殊的系列标识符,这意味着不涉及任何网络协议。

       -4     shortcut for -family inet. -family inet 的快捷方式

       -6     shortcut for -family inet6. -family inet6 的快捷方式

       -B     shortcut for -family bridge. -family bridge 的快捷方式

       -M     shortcut for -family mpls. -family mpls 的快捷方式

       -0     shortcut for -family link. -family link 的快捷方式

       -o, -oneline
              output each record on a single line, replacing line feeds with the '\' character. This is convenient when you want to count records with wc(1) or to grep(1) the output.

              在一行上输出每条记录,将换行符替换为"\"字符。当您想用wc(1)或输出grep(1)来计数记录时,这是很方便的。

       -r, -resolve
              use the system's name resolver to print DNS names instead of host addresses.

              使用系统的名称解析程序打印 DNS 名称而不是主机地址。

       -n, -netns <NETNS>
              switches ip to the specified network namespace NETNS.  Actually it just simplifies executing of:

              ip netns exec NETNS ip [ OPTIONS ] OBJECT { COMMAND | help }

              to

              ip -n[etns] NETNS [ OPTIONS ] OBJECT { COMMAND | help }

              将 ip 切换到指定的网络命名空间 NETNS。 实际上,它只是简化了以下各项的执行:

       -N, -Numeric
              Print the number of protocol, scope, dsfield, etc directly instead of converting it to human readable name.

              直接打印协议,范围,dsfield等的数量,而不是将其转换为人类可读的名称。

       -a, -all
              executes specified command over all objects, it depends if command supports this option.

              对所有对象执行指定的命令,这取决于命令是否支持此选项。

       -c[color][={always|auto|never}
              Configure color output. If parameter is omitted or always, color output is enabled regardless of stdout state. If parameter is auto, stdout is checked to be a terminal before enabling color output. If parameter is never, color output is disabled. If specified multiple times, the last one takes precedence. This flag is ignored if -json is also given.

              Used color palette can be influenced by COLORFGBG environment variable (see ENVIRONMENT).

              配置颜色输出。如果省略或始终省略参数,则无论 stdout 状态如何,都会启用颜色输出。如果参数是 auto,则在启用颜色输出之前,将 stdout 检查为终端。如果参数从不为,则禁用颜色输出。如果多次指定,则最后一个优先。如果还给出了 -json,则忽略此标志。

              使用的调色板可能会受到 COLORFGBG 环境变量的影响(请参见环境)。

       -t, -timestamp
              display current time when using monitor option.

              使用监视器选项时显示当前时间。

       -ts, -tshort
              Like -timestamp, but use shorter format.

              类似于-timestamp,但使用更短的格式。

       -rc, -rcvbuf<SIZE>
              Set the netlink socket receive buffer size, defaults to 1MB.

              设置网络链接套接字接收缓冲区大小,默认为 1MB。

       -iec   print human readable rates in IEC units (e.g. 1Ki = 1024).

              以IEC单位打印人类可读速率(例如1Ki = 1024)。

       -br, -brief
              Print only basic information in a tabular format for better readability. This option is currently only supported by ip addr show and ip link show commands.

              仅以表格格式打印基本信息,以提高可读性。此选项目前仅受 ip 地址显示和 IP 链接显示命令支持。

       -j, -json
              Output results in JavaScript Object Notation (JSON).

              输出结果为 JavaScript 对象表示法 (JSON)。

       -p, -pretty
              The default JSON format is compact and more efficient to parse but hard for most users to read.  This flag adds indentation for readability.

              默认 JSON 格式紧凑且解析效率更高,但大多数用户难以阅读。此标志添加缩进以提高可读性。

IP - COMMAND SYNTAX
   OBJECT
       address
              - protocol (IP or IPv6) address on a device. 协议(IP 或 IPv6)地址。

       addrlabel
              - label configuration for protocol address selection. 协议地址选择的标签配置。

       l2tp   - tunnel ethernet over IP (L2TPv3). IP 隧道以太网 (L2TPv3)。

       link   - network device. 网络设备。

       maddress
              - multicast address. 多播地址。

       monitor
              - watch for netlink messages. 观察网络链接消息。

       mroute - multicast routing cache entry. 多播路由缓存条目。

       mrule  - rule in multicast routing policy database. 多播路由策略数据库中的规则。

       neighbour
              - manage ARP or NDISC cache entries. 管理 ARP 或 NDISC 缓存条目。

       netns  - manage network namespaces. 管理网络命名空间。

       ntable - manage the neighbor cache's operation. 管理邻居缓存的操作。

       route  - routing table entry. 路由表条目。

       rule   - rule in routing policy database. 路由策略数据库中的规则。

       tcp_metrics/tcpmetrics
              - manage TCP Metrics 管理 TCP 指标

       token  - manage tokenized interface identifiers. 管理标记化的接口标识符。

       tunnel - tunnel over IP. 通过 IP 建立隧道。

       tuntap - manage TUN/TAP devices. 管理 TUN/TAP 设备。

       xfrm   - manage IPSec policies. 管理 IPSec 策略。

       The names of all objects may be written in full or abbreviated form, for example address can be abbreviated as addr or just a.

       所有对象的名称都可以以完整或缩写的形式编写,例如地址可以缩写为addr或只是a。

   COMMAND
       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 add, delete and show (or list ) objects, but some objects do not allow all of these operations or have some additional commands. The help command is available for all objects. It prints out a list of available commands and argument syntax conventions.

       If no command is given, some default command is assumed.  Usually it is list or, if the objects of this class cannot be listed, help.

       指定要对对象执行的操作。可能的操作集取决于对象类型。通常,可以添加,删除和显示(或列出)对象,但某些对象不允许所有这些操作或具有一些附加命令。帮助命令可用于所有对象。它打印出可用命令和参数语法约定的列表。

       如果未给出任何命令,则假定使用某些默认命令。通常它是列表,或者,如果无法列出此类的对象,则提供帮助。

ENVIRONMENT
       COLORFGBG
              If set, it's value is used for detection whether background is dark or light and use contrast colors for it.

              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:

              COLORFGBG=";0" ip -c a

              如果设置,则其值用于检测背景是深色还是浅色,并为其使用对比色。COLORFGBG环境变量通常包含两个或三个用分号分隔的值;在这两种情况下,我们都需要最后一个值。 如果此值为 0-6 或 8,请选择适合深色背景的颜色:

              COLORFGBG=";0" ip -c a

EXIT STATUS
       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.

       如果命令成功,则退出状态为 0;如果存在语法错误,则退出状态为 1。如果内核退出状态报告错误,则状态为 2。

EXAMPLES
       ip addr
           Shows addresses assigned to all network interfaces.

           显示分配给所有网络接口的地址。

       ip neigh
           Shows the current neighbour table in kernel.

           显示内核中的当前邻居表。

       ip link set x up
           Bring up interface x.

           调出接口 x。

       ip link set x down
           Bring down interface x.

           关闭接口 x。

       ip route
           Show table routes.

           显示表路由。

HISTORY
       ip was written by Alexey N. Kuznetsov and added in Linux 2.2.

       ip由Alexey N. Kuznetsov编写,并添加到Linux 2.2中。

SEE ALSO
       ip-address(8), ip-addrlabel(8), ip-l2tp(8), ip-link(8), ip-maddress(8), ip-monitor(8), ip-mroute(8), ip-neigh‐
       bour(8), ip-netns(8), ip-ntable(8), ip-route(8), ip-rule(8), ip-tcp_metrics(8), ip-token(8), ip-tunnel(8), ip-
       xfrm(8)
       IP Command reference ip-cref.ps

REPORTING BUGS
       Report any bugs to the Network Developers mailing list <netdev@vger.kernel.org> where the development and maintenance is primarily done.  You do not have to be subscribed to the list to send a message there.

AUTHOR
       Original Manpage by Michail Litvak <mci@owl.openwall.com>

iproute2                                               20 Dec 2011                                                 IP(8)

三、特别说明

不同的 OBJECT 参数对应不同,具体 OBJECT 使用 man OBJECT 命令查看。以 ip-address 为例参看相关使用说明,使用 man ip-address 命令进行查看 ip-address 详细命令。

四、man ip-address

IP-ADDRESS(8)                                             Linux                                            IP-ADDRESS(8)

NAME
       ip-address - protocol address management 协议地址管理

SYNOPSIS
       ip [ OPTIONS ] address  { COMMAND | help }

       ip address { add | change | replace } IFADDR dev IFNAME [ LIFETIME ] [ CONFFLAG-LIST ]

       ip address del IFADDR dev IFNAME [ mngtmpaddr ]

       ip address { save | flush } [ dev IFNAME ] [ scope SCOPE-ID ] [ metric METRIC ] [ to PREFIX ] [ FLAG-LIST ] [ la‐
               bel PATTERN ] [ up ]

       ip address [ show [ dev IFNAME ] [ scope SCOPE-ID ] [ to PREFIX ] [ FLAG-LIST ] [ label PATTERN ] [ master DEVICE
               ] [ type TYPE ] [ vrf NAME ] [ up ] ]

       ip address { showdump | restore }

       IFADDR := PREFIX | ADDR peer PREFIX [ broadcast ADDR ] [ anycast ADDR ] [ label LABEL ] [ scope SCOPE-ID ]

       SCOPE-ID := [ host | link | global | 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 | noprefixroute | autojoin ]

       LIFETIME := [ valid_lft LFT ] [ preferred_lft LFT ]

       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 ]

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.

       该地址是附加到网络设备的协议(IPv4 或 IPv6)地址。每个设备必须至少有一个地址才能使用相应的协议。可以将多个不同的地址附加到一个设备。这些地址不受歧视,因此术语别名不太适合它们,我们在本文档中不使用它。

       IP 地址命令显示地址及其属性,添加新地址并删除旧地址。

   ip address add - add new protocol address. 添加新的协议地址。
       dev IFNAME
              the name of the device to add the address to.

              要向其添加地址的设备的名称。

       local ADDRESS (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.

              接口的地址。地址的格式取决于协议。它是 IP 的虚线四边形,也是 IPv6 的十六进制半字序列,用冒号分隔。ADDRESS 后跟斜杠和十进制数,用于对网络前缀长度进行编码。

       peer ADDRESS
              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.

              点接口的远程终结点的地址。同样,ADDRESS 后面可以跟斜杠和十进制数,用于编码网络前缀长度。如果指定了对等地址,则本地地址不能具有前缀长度。网络前缀与对等方相关联,而不是与本地地址相关联。

       broadcast ADDRESS
              the broadcast address on the interface.

              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.

              接口上的广播地址。

              可以使用特殊符号"+"和"-"代替广播地址。在这种情况下,广播地址是通过设置/重置接口前缀的主机位来派生的。

       label LABEL
              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.

              每个地址都可以用标签字符串进行标记。为了保持与 Linux-2.0 网络别名的兼容性,此字符串必须与设备名称一致,或者必须以设备名称后跟冒号为前缀。标签允许的最大总长度为 15 个字符。

       scope SCOPE_VALUE
              the scope of the area where this address is valid.  The available scopes are listed in file /etc/iproute2/rt_scopes.  Predefined scope values are:

                      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.

              此地址有效的区域的范围。可用作用域列在文件 /etc/iproute2/rt_scopes 中。 预定义的作用域值为:

                     global - 该地址具有全局有效性。

                     site - (仅限 IPv6,已弃用)该地址是站点本地地址,即它在此站点内有效。

                     link - 该地址是本地链接,即它仅在此设备上有效。

                     host - 该地址仅在此主机内有效。


       metric NUMBER
              priority of prefix route associated with address.

              与地址关联的前缀路由的优先级。

       valid_lft LFT
              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.

              此地址的有效生存期;请参阅 RFC 4862 的 5.5.4 节。当它过期时,该地址将被内核删除。 默认为永久。

       preferred_lft LFT
              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.

              此地址的首选生存期;请参阅 RFC 4862 的 5.5.4 节。过期后,该地址将不再用于新的传出连接。默认为永久。

       home   (IPv6 only) designates this address the "home address" as defined in RFC 6275.

              (仅限 IPv6)将此地址指定为 RFC 6275 中定义的"home address"。

       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.

              (仅限 IPv6)使内核管理从此临时地址创建的临时地址,作为代表隐私扩展 (RFC3041) 的模板。要使此功能变为活动状态,必须将use_tempaddr sysctl 设置设置为大于零的值。给定地址的前缀长度需要为 64。此标志允许在手动配置的网络中使用隐私扩展,就像无状态自动配置处于活动状态一样。

       nodad  (IPv6 only) do not perform Duplicate Address Detection (RFC 4862) when adding this address.

              添加此地址时(仅限 IPv6)不执行重复地址检测 (RFC 4862)。

       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
              Joining multicast groups on Ethernet level via ip maddr 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.

              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.

              如果连接到执行 IGMP 监听的以太网交换机,则通过 ip maddr 命令加入以太网级别的多播组将不起作用,因为该交换机不会在没有针对多播地址的 IGMP 报告的端口上复制多播数据包。

              通过 ip 链接创建的 Linux VXLAN 接口添加 vxlan 具有组选项,使它们能够执行所需的加入。

              在添加多播地址时使用自动加入标志可为 Openvswitch VXLAN 接口以及需要接收多播流量的其他隧道机制启用类似的功能。

   ip address delete - delete protocol address 删除协议地址
       Arguments: coincide with the arguments of ip addr add.  The device name is a required argument. The rest are optional.  If no arguments are given, the first address is deleted.

       参数:与 ip addr addr add 的参数一致。设备名称是必需的参数。其余的都是可选的。 如果未给出任何参数,则删除第一个地址。



   ip address show - look at protocol addresses 查看协议地址
       dev IFNAME (default)
              name of device.

       scope SCOPE_VAL
              only list addresses with this scope.

              仅列出具有此作用域的地址。

       to PREFIX
              only list addresses matching this prefix.

              仅列出与此前缀匹配的地址。

       label PATTERN
              only list addresses with labels matching the PATTERN.  PATTERN is a usual shell style pattern.

              仅列出标签与 PATTERN 匹配的地址。 PATTERN是一种常见的shell样式模式。

       master DEVICE
              only list interfaces enslaved to this master device.

              只列出从这个主设备的接口。

       vrf NAME
              only list interfaces enslaved to this vrf.

              只列出被该vrf指定的接口。

       type TYPE
              only list interfaces of the given type.

              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.

       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.

              (仅IPv6)仅列出由于无状态地址配置而安装的地址,或仅列出永久(非动态)地址。这两个标志是相反的,所以-dynamic等于permanent, -permanent等于dynamic。

       tentative
              (IPv6 only) only list addresses which have not yet passed duplicate address detection.

              (仅限 IPv6)仅列出尚未通过重复地址检测的地址。

       -tentative
              (IPv6 only) only list addresses which are not in the process of duplicate address detection currently.

              (仅限 IPv6)仅列出当前未进行重复地址检测的地址。

       deprecated
              (IPv6 only) only list deprecated addresses.

              (仅限 IPv6)仅列出已弃用的地址。

       -deprecated
              (IPv6 only) only list addresses not being deprecated.

              (仅限 IPv6)仅列出未弃用的地址。

       dadfailed
              (IPv6 only) only list addresses which have failed duplicate address detection.

              (仅限 IPv6)仅列出重复地址检测失败的地址。

       -dadfailed
              (IPv6 only) only list addresses which have not failed duplicate address detection.

              (仅限 IPv6)仅列出未失败的重复地址检测的地址。

       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.

              仅列出临时 IPv6 或辅助 IPv4 地址。Linux内核共享这些的单个位,因此它们实际上是彼此的别名,尽管含义因地址系列而异。

       -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.

              仅列出主地址,在 IPv6 中排除临时地址。此标志是临时和次要的倒数。

       -primary
              This is an alias for temporary or secondary.

              这是临时或辅助的别名。

   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.

       此命令将刷新由某些条件选择的协议地址。

       此命令具有与 show 相同的参数,只是类型和主选择器不受支持。另一个区别是,当没有给出参数时,它不会运行。

       警告:此命令和其他刷新命令是无情的。他们将残酷地清除所有地址。

       使用 -statistics 选项时,命令将变为详细。它会打印出被删除的地址数和刷新地址列表的轮数。如果为此选项提供两次,则 IP 地址刷新还会以上一小节中描述的格式转储所有已删除的地址。

EXAMPLES
       ip address show
           Shows IPv4 and IPv6 addresses assigned to all network interfaces. The 'show' subcommand can be omitted.

           显示分配给所有网络接口的 IPv4 和 IPv6 地址。可以省略"显示"子命令。

       ip address show up
           Same as above except that only addresses assigned to active network interfaces are shown.

           与上述相同,只是仅显示分配给活动网络接口的地址。

       ip address show dev eth0
           Shows IPv4 and IPv6 addresses assigned to network interface eth0.

           显示分配给网络接口 eth0 的 IPv4 和 IPv6 地址。

       ip address add 2001:0db8:85a3::0370:7334/64 dev eth1
           Adds an IPv6 address to network interface eth1.

           将 IPv6 地址添加到网络接口 eth1。

       ip address delete 2001:0db8:85a3::0370:7334/64 dev eth1
           Delete the IPv6 address added above.

           删除上面添加的 IPv6 地址。

       ip address flush dev eth4 scope global
           Removes all global IPv4 and IPv6 addresses from device eth4. Without 'scope global' it would remove all addresses including IPv6 link-local ones.

           从设备 eth4 中删除所有全局 IPv4 和 IPv6 地址。如果没有"作用域全局",它将删除所有地址,包括IPv6链路本地地址。

SEE ALSO
       ip(8)

AUTHOR
       Original Manpage by Michail Litvak <mci@owl.openwall.com>

iproute2                                               20 Dec 2011                                         IP-ADDRESS(8)

 类似资料: