centos7 ipaddr 无法查看虚拟机IP解决办法

一、问题

新安装的CentOS 7,ip addr查看不了IP地址

二、解决

原因: CentOS 7 默认是不启动网卡的

  • 进入/etc/sysconfig/network-scripts/目录
[root@localhost etc]# cd /etc/sysconfig/network-scripts/
  •  打开第一项 ifcfg-ens33 有的可能不叫这个
[root@localhost network-scripts]# vi ifcfg-ens33

  •  利用vim编辑器将no改为yes

 

  • 重启网络服务,再次使用ip addr即可看到ip了
[root@localhost network-scripts]# service network restart

 

参考:https://blog.csdn.net/wxx729418277/article/details/79130649

原文地址:https://www.cnblogs.com/helf/p/10224833.html