【Linux】CentOS 7最小化安装后找不到‘ifconfig’命令

ifconfig”命令用于配置GNU/Linux系统的网络接口。它显示网络接口卡的详细信息,包括IP地址,MAC地址,以及网络接口卡状态之类。但是,该命令已经过时了,而且在最小化版本的RHEL 7以及它的克隆版本CentOS 7,Oracle Linux 7和Scientific Linux 7中也找不到该命令。

在CentOS最小化服务器版本中如何查找网卡IP和其它详细信息?

CentOS 7最小化系统,使用“ip addr”和“ip link”命令来查找网卡详情。要知道统计数据,可以使用“ip -s link”。

要查看网卡细节,输入以下命令:

ip addr

输出样例:

[root@centos7 ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 00:0c:29:3d:2d:48 brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.128/24 brd 192.168.10.255 scope global noprefixroute dynamic ens33
       valid_lft 1001sec preferred_lft 1001sec
    inet6 fe80::f6a3:bfed:255f:96a6/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

在CentOS 7最小化服务器版本中如何启用并使用“ifconfig”命令?

如果你不知道在哪里可以找到ifconfig命令,请按照以下简单的步骤来找到它。首先,让我们找出哪个包提供了ifconfig命令。要完成这项任务,

输入以下命令:yum provides ifconfig

[root@centos7 ~]# yum provides ifconfig
已加载插件:fastestmirror
Determining fastest mirrors
 * base: mirror.bit.edu.cn
 * extras: mirror.bit.edu.cn
 * updates: mirrors.cn99.com
base                                                                                | 3.6 kB  00:00:00     
extras                                                                              | 3.4 kB  00:00:00     
updates                                                                             | 3.4 kB  00:00:00     
(1/4): base/7/x86_64/group_gz                                                       | 166 kB  00:00:01     
(2/4): base/7/x86_64/primary_db                                                     | 5.9 MB  00:00:02     
(3/4): extras/7/x86_64/primary_db                                                   | 205 kB  00:00:02     
(4/4): updates/7/x86_64/primary_db                                                  | 6.0 MB  00:00:03     
base/7/x86_64/filelists_db                                                          | 6.9 MB  00:00:30     
extras/7/x86_64/filelists_db                                                        | 603 kB  00:00:01     
updates/7/x86_64/filelists_db                                                       | 3.4 MB  00:00:01     
No matches found

或者:yum whatprovides ifconfig

[root@centos7 ~]# yum whatprovides ifconfig
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirror.bit.edu.cn
 * extras: mirror.bit.edu.cn
 * updates: mirrors.cn99.com
net-tools-2.0-0.22.20131004git.el7.x86_64 : Basic networking tools
源    :@base
匹配来源:
文件名    :/usr/sbin/ifconfig

就像你在上面的输出中所看到的,net-tools包提供了ifconfig命令。因此,让我们安装net-tools包来使用ifconfig命令。

yum install net-tools

现在,你就可以像以往一样使用ifconfig命令了。

猜你喜欢

转载自blog.csdn.net/wjx_jasin/article/details/84672231