Linux iproute2 命令家族(ip / ss)
iproute 简介
iproute 与 内核是密切相关的,所以两者版本是一致的。
[root@LeeMumu ~]# rpm -qi iproute
Name : iproute
Version : 4.11.0
Release : 14.el7_6.2
Architecture: x86_64
Install Date: Sun 28 Jul 2019 09:28:29 AM EDT
Group : Applications/System
Size : 1793061
License : GPLv2+ and Public Domain
Signature : RSA/SHA256, Mon 29 Apr 2019 11:45:09 AM EDT, Key ID 24c6a8a7f4a80eb5
Source RPM : iproute-4.11.0-14.el7_6.2.src.rpm
Build Date : Wed 24 Apr 2019 10:03:34 AM EDT
Build Host : x86-02.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://kernel.org/pub/linux/utils/net/iproute2/
Summary : Advanced IP routing and network device configuration tools
Description :
The iproute package contains networking utilities (ip and rtmon, for example)
which are designed to use the advanced networking capabilities of the Linux
kernel.
[root@LeeMumu ~]# uname -r
3.10.0-957.el7.x86_64
[root@LeeMumu ~]# cat /etc/redhat-release
CentOS Linux release 7.6.1810 (Core)
ip 命令
用来显示或操纵Linux主机的路由、网络设备、策略路由和隧道,是Linux下较新的功能强大的网络配置工具。
show / manipulate routing, devices, policy routing and tunnels
语法格式:
# ip [ OPTIONS ] OBJECT {
COMMAND | help }
OBJECT := {
link | addr | route | netns }
注意: OBJECT可简写,各OBJECT的子命令也可简写
1、ip link
ip link: network device configuration
1.1 up / down 和 multicast
ip link set - change device attributes
dev NAME (default) # 指明要管理的设备,dev 关键字可省略
up 和 down # 对接口进行up或down
multicast on 或 multicast off # 启用或禁用多播功能
# ip link set tangtang multicast on
1.2 name
# ip link set name NAME:重命名接口
# 重命名接口时,需要对接口进行down,才能进行操作
# ip link set wlp2s0 name tangtang
RTNETLINK answers: Device or resource busy
# ip link set wlp2s0 down
# ip link set wlp2s0 name tangtang
# ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
link/loopback 00:00: