问题原由:
minimal版CentOS7安装结束后,进入到系统。需要使用"ifconfig"命令查看网卡信息的时候,提示找不到"ifconfig"命令。
分析问题:
找不到命令,应该是没有安装该功能。使用以下命令查看"ifconfig"命令是由哪个包提供的。
yum provides ifconfig yum whatprovides ifconfig
结果如下:
[root@localhost ~]# yum whatprovides ifconfig Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * extras: mirrors.shu.edu.cn * updates: mirrors.aliyun.com net-tools-2.0-0.22.20131004git.el7.x86_64 : Basic networking tools Repo : @base Matched from: Filename : /usr/sbin/ifconfig
可以看到"ifconfig"所属的包为:net-tools-2.0-0.22.20131004git.el7.x86_64。
解决问题:
安装"ifconfig"命令所属的包
yum install net-tools
使用命令验证问题:
[root@localhost ~]# ifconfig ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.206.142 netmask 255.255.255.0 broadcast 192.168.206.255 inet6 fe80::c3b0:713e:dfcb:f9e4 prefixlen 64 scopeid 0x20<link> ether 00:0c:29:4b:3d:0f txqueuelen 1000 (Ethernet) RX packets 20692 bytes 25540256 (24.3 MiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 5909 bytes 378455 (369.5 KiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10<host> loop txqueuelen 1 (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
命令可以使用,问题解决。
参考地址:https://linux.cn/article-3631-1.html