centos系统解决ifconfig command not found
问题:新装的centos系统或者拉取的镜像跑容器的时候,查看ip地址时输入ifconfig
会显示ifconfig command not found
。
-
输入
ip addr
确认IP地址是否设置正常,设置好如下所示,如果没有获取到IP地址,则需要设置一个。 -
确认ifconfig命令是否未安装
cd /sbin
ls -ll
发现并没有ifconfig。 -
安装net-tool插件,此插件中带有此命令
安装命令:sudo yum install net-tools
等待安装完成,再次输入ifconfig
,成功查看到ip。