今天打开虚拟机,使用 ifconfig 命令时,没有显示出 IP 地址
Centos7没有IP地址,查看网络状态显示No suitable device found for this connection (devint match)) Linux 第1张

(更好的阅读体验可访问 这里 )
使用 systemctl status network 命令查看网络状态 显示没有合适的网络装置
Centos7没有IP地址,查看网络状态显示No suitable device found for this connection (devint match)) Linux 第2张

SRE实战 互联网时代守护先锋,助力企业售后服务体系运筹帷幄!一键直达领取阿里云限量特价优惠。

突然想起来前几天重装了系统,于是进入网络配置目录 cd /etc/sysconfig/network-scripts 查看
Centos7没有IP地址,查看网络状态显示No suitable device found for this connection (devint match)) Linux 第3张

果然发现,此时的网卡配置文件 与之前的 ens32 对应不上。于是更新一下网卡配置文件
cp ifcfg-eno16777728 ifcfg-ens32 (注:修改时要对应自己的网卡名称)
然后编辑 ifcfg-ens32 文件,注释掉其中的 HWADDRUUID,这两项都是与原网卡相关的配置,注释掉即可,不影响系统使用。非要想添加后续也可通过命令实现。

修改 NAME 为现网卡的名称
Centos7没有IP地址,查看网络状态显示No suitable device found for this connection (devint match)) Linux 第4张

保存,退出,
ls 查看当前目录文件,ifcfg 开头的只保留 ifcfg-ens32 和 ifcfg-lo,删除其它 ifcfg 多余文件(注:注意对应自己的网卡名称)
Centos7没有IP地址,查看网络状态显示No suitable device found for this connection (devint match)) Linux 第5张

systemctl restart network 重新启动网络服务
ifup ens32 启动网卡
Centos7没有IP地址,查看网络状态显示No suitable device found for this connection (devint match)) Linux 第6张

再次查看 IP地址 和网络服务状态,已经全部显示正常了。
Centos7没有IP地址,查看网络状态显示No suitable device found for this connection (devint match)) Linux 第7张

Centos7没有IP地址,查看网络状态显示No suitable device found for this connection (devint match)) Linux 第8张

总结:由于虚拟机移动到了另外的操作系统,而里面网卡的配置信息还是原系统的,所以需要更改。

扫码关注我们
微信号:SRE实战
拒绝背锅 运筹帷幄