问题:ifconfig命令功能是查看、配置、启用或禁用指定网络接口,但是CentOS7默认不在自带ifconfig命令,用ip addr命令取代。有些管理工具或者脚本依赖这个命令,那么如何把它安装回来呢?
办法:
如果我们直接输入ifconfig命令运行会报错:
-bash: ifconfig: command not found
我们首先想到可以用yum命令来安装
yum -y install ifconfig
但是运行后报错,没有这个包文件。
那么我们可以用yum命令来搜索一下,发现ifconfig在net-tools.x86_64这个包里面。
yum search ifconfig
最后安装net-tools.x86_64,安装完成后就可以使用ifconfig命令。
yum -y install net-tools.x86_64