衆所周知,「ifconfig」命令用於配置GNU/Linux系統的網絡接口。它顯示網絡接口卡的詳細信息,包括IP地址,MAC地址,以及網絡接口卡狀態之類。可是,該命令已通過時了,並且在最小化版本的RHEL 7以及它的克隆版本CentOS 7,Oracle Linux 7和Scientific Linux 7中也找不到該命令。那麼問題來了,怎麼在Centos7中查看ip信息呢?怎麼操做才能找回之前的習慣呢?
html
7版系統查看網絡信息的命令linux
CentOS 7最小化系統,使用「ip addr」和「ip link」命令來查找網卡詳情。要知道統計數據,能夠使用「ip -s link」。git
要查看網卡細節:ip addrcentos
[root@linuxprobe ~]#ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN link/void inet 127.0.0.1/32 scope host venet0 inet 192.168.1.101/32 brd 192.168.1.101 scope global venet0:0
要查看網絡接口統計數據:ip link服務器
[root@linuxprobe ~]#ip link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT link/void
或者使用:ip -s link網絡
[root@linuxprobe ~]#ip -s link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN mode DEFAULT link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 RX: bytes packets errors dropped overrun mcast 0 0 0 0 0 0 TX: bytes packets errors dropped carrier collsns 0 0 0 0 0 0 2: venet0: <BROADCAST,POINTOPOINT,NOARP,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN mode DEFAULT link/void RX: bytes packets errors dropped overrun mcast 8515667 6667 0 0 0 0 TX: bytes packets errors dropped carrier collsns 300403 4249 0 0 0 0
在CentOS 7最小化服務器版本中啓用「ifconfig」命令ide
若是你不知道在哪裏能夠找到ifconfig命令,請按照如下簡單的步驟來找到它。oop
首先,讓咱們找出哪一個包提供了ifconfig命令:htm
[root@linuxprobe ~]# yum provides ifconfig Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: centos.aol.in * extras: centos.aol.in * updates: centos.aol.in net-tools-2.0-0.17.20131004git.el7.x86_64 : Basic networking tools Repo : @base Matched from: Filename : /usr/sbin/ifconfig
或者你也能夠使用如下命令接口
yum whatprovides ifconfig
這裏,「provides」或者「whatprovides」開關用於找出某個包提供了某些功能或文件。
net-tools包提供了ifconfig命令。所以,安裝net-tools包也能夠使用ifconfig命令。
安裝net-tools包
yum install net-tools
如今,你就能夠像以往同樣使用ifconfig命令了。
[root@linuxprobe ~]# ifconfig -a lo: flags=73<UP,LOOPBACK,RUNNING> mtu 16436 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 0 (Local Loopback) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 venet0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP> mtu 1500 inet 127.0.0.1 netmask 255.255.255.255 broadcast 0.0.0.0 destination 127.0.0.1 unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 0 (UNSPEC) RX packets 7073 bytes 8549159 (8.1 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 4611 bytes 359201 (350.7 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 venet0:0: flags=211<UP,BROADCAST,POINTOPOINT,RUNNING,NOARP> mtu 1500 inet 192.168.1.101 netmask 255.255.255.255 broadcast 192.168.1.101 destination 192.168.1.101 unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 txqueuelen 0 (UNSPEC)
盡情享受吧!
本文地址:http://www.linuxprobe.com/centos-7-use-ifconfig.html