虚拟机里输入ifconfig命令出现错误-bash: ifconfig: command not found

1、查看是否真设置IP地址:命令行中输入ip addr,看到ip地址。
虚拟机里输入ifconfig命令出现错误-bash: ifconfig: command not found
2.确认sbin目录是否存在;在命令行中输入:cd /sbin
虚拟机里输入ifconfig命令出现错误-bash: ifconfig: command not found
3、确认是否安装ifconfig命令:在sbin目录中输入ls | grep ‘if’,没有则说明没有安装。
虚拟机里输入ifconfig命令出现错误-bash: ifconfig: command not found
注:这里我已经安装了,如果没有安装则继续第4步。

4、安装net-tools,因为该包中包含ifconfig命令:sudo yum install net-tools
安装中询问是否安装,选择y.
虚拟机里输入ifconfig命令出现错误-bash: ifconfig: command not found
注:因为我已经安装了,是最新的版本了。

5、再次在命令行中输入ifconfig,查看到ip则安装成功。
虚拟机里输入ifconfig命令出现错误-bash: ifconfig: command not found