天天看点

CentOS 7中没有ifconfig命令,而且不能发现eth0

http://blog.163.com/aaron_yuan/blog/static/16519523220148215950996/

1、由于安装时使用的是最小化安装CentOS 7,安装完成后没有发现ifconfig命令

检查/sbin下也没有这个命令。使用的是root身份。

#yum install -y net-tools*

可以成功安装ifconfig

CentOS 7中没有ifconfig命令,而且不能发现eth0

2、我的网卡是Atheros AR8131 PCI-E,但是安装过程中没有提示设置网卡,安装好后也没有发现ifcfg-eth0的 配置文件。

CentOS 7中没有ifconfig命令,而且不能发现eth0

CentOS 7中没有ifconfig命令,而且不能发现eth0

使用dmesg | grep -in eth检查开机信息中有没有eth0的消息

CentOS 7中没有ifconfig命令,而且不能发现eth0

发现由interface eth0改为了ens33

3、更改网卡的名字 - 由ens33改为eth0

CentOS 7中没有ifconfig命令,而且不能发现eth0

CentOS 7中没有ifconfig命令,而且不能发现eth0

修改grub中的GRUB_CMDLINE_LINUX,追加语句”net.ifnames=0 biosdevname=0“。

然后执行# grub2-mkconfig -o /boot/grub2/grub.cfg

之后重启# reboot

CentOS 7中没有ifconfig命令,而且不能发现eth0

再查看网卡,发现名字已经更改过来了。

CentOS 7中没有ifconfig命令,而且不能发现eth0
CentOS 7中没有ifconfig命令,而且不能发现eth0

但是仍需要将/etc/sysconfig/network-scripts/ifcfg-ens33更名为ifcfg-eth0,同时修改其内容,指定IP、NETMASK及GATEWAY,同时修改onboot=no为yes。最后执行service restart network。

继续阅读