Linux网络工具学习之:IP命令学习1 标签(空格分隔): 网络 本文旨在通过IP命令介绍和学习Linux网络的相关知识 1. 概述 1.1 关于 ip是iproute2软件包里面的一个强大的网络配置工具 1.2 语法 本文使用的版本和相关命令如下 [user]# ip -V ip utility, iproute2-ss130716 [user]# ip Usage: ip [ OPTIONS ] OBJECT { COMMAND | help } ip [ -force ] -batch filename where OBJECT := { link | addr | addrlabel | route | rule | neigh | ntable | tunnel | tuntap | maddr | mroute | mrule | monitor | xfrm | netns
Linux网络工具学习之:IP命令学习2 标签(空格分隔): 网络 本文旨在通过IP命令介绍和学习Linux网络的相关知识 1. 概述 2. ip link 2.1 概述 缩写:set、s Usage: ip link add [link DEV] [ name ] NAME [ txqueuelen PACKETS ] [ address LLADDR ] [ broadcast LLADDR ] [ mtu MTU ] [ numtxqueues QUEUE_COUNT ] [ numrxqueues QUEUE_COUNT ] type TYPE [ ARGS ] ip link delete DEV type TYPE [ ARGS ] ip link set { dev DEVICE | group DEVGROUP } [ { up | down } ] [ arp { on | off } ] [ dynamic { on | off } ] [ multicast { on | off } ] [ allmulticast { on | off } ] [ promisc { on | off } ] [ trailers { on | off } ] [ txqueuelen PACKETS ] [ name NEWNAME ] [ address LLADDR ] [ broadcast LLADDR ] [ mtu MTU ] [ netns PID ] [ netns NAME ] [ link-netnsid ID ] [ alias NAME ] [ vf NUM [ mac LLADDR ] [ vlan VLANID [ qos VLAN-QOS ] ] [ rate TXRATE ] ] [ spoofchk { on | off} ] ] [ query_rss { on | off} ] ] [ state { auto | enable | disable} ] ] [ master DEVICE ] [ nomaster ] [ addrgenmode { eui64 | none } ] ip link show [ DEVICE | group GROUP ] [up] TYPE := { vlan | veth | vcan | dummy | ifb | macvlan | can | bridge | ipoib | ip6tnl | ipip | sit | vxlan | gre | gretap | ip6gre | ip6gretap } 2.2 ip link show 2.2.1 简介 Displaying link layer characteristics with ip link show Manual 2.2.2 例子 ——————————————— ip link show [ DEVICE | group GROUP ] [up] 设备 设备组 只显示running状态的设备 ——————————————— ——————————————— example 1 ——————————————— [root@10-10-229-73 ~]# ip link show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1454 qdisc pfifo_fast state UP mode DEFAULT qlen 1000 link/ether 52:54:00:e7:ae:ff brd ff:ff:ff:ff:ff:ff 3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN mode DEFAULT link/ether 02:42:c4:87:09:25 brd ff:ff:ff:ff:ff:ff 5: veth0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT qlen 1000 link/ether 92:57:fa:48:7c:b2 brd ff:ff:ff:ff:ff:ff 显示的信息: 设备名: <设备flags>, MTU, the active queueing mechanism (if any), queue size if there is a queue present.
Linux网络工具学习之:IP命令学习3 标签(空格分隔): 网络 本文旨在通过IP命令介绍和学习Linux网络的相关知识 1. 概述 2. ip link 3. ip addr 3.1 概述 缩写 address、addr、a 对象 这里的地址是绑定到网络设备上的协议(IP或者IPv6)地址。每个网络设备至 少应该有一个协议地址。而且,一个网络设备可以绑定多个协议地址。 ip addr命令能够显示网络设备的协议地址及其性质,添加新的地址,删除旧的地 址。 命令 add、delete、flush和show(或者list) [root@10-9-151-160 ~]# ip addr help Usage: ip addr {add|change|replace} IFADDR dev STRING [ LIFETIME ] [ CONFFLAG-LIST ] ip addr del IFADDR dev STRING ip addr {show|save|flush} [ dev STRING ] [ scope SCOPE-ID ] [ to PREFIX ] [ FLAG-LIST ] [ label PATTERN ] [up] ip addr {showdump|restore} IFADDR := PREFIX | ADDR peer PREFIX [ broadcast ADDR ] [ anycast ADDR ] [ label STRING ] [ 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 | nodad ] LIFETIME := [ valid_lft LFT ] [ preferred_lft LFT ] LFT := forever | SECONDS 参考 : Man page>ip-address 3.2 ip address add 添加一个新的协议地址 参数(参数说明见下面的例子) |参数|说明 |-|- |dev IFNAME|the name of the device to add the address to.