问题:
使用虚拟机安装CentOS7的最小安装,安装完成后虚拟机无网络,无法ping通其他ip地址。
处理步骤如下:
1.以root用户登录
![](https://img-blog.csdnimg.cn/img_convert/e193bd4efe534a1dbb61c9e30a80e6cf.png)
2.查询网络
ip add
![](https://img-blog.csdnimg.cn/img_convert/dd76e1a07bb84b1ab7f352d0cea3ee05.png)
默认网卡是关闭的,无IP地址,无网络
3.终端root输入命令
网卡配置目录:cd /etc/sysconfig/network-scripts/--ls
![](https://img-blog.csdnimg.cn/img_convert/8ad5cecd169446eb8c5ea9a41fffeaa4.png)
4.编辑配置文件:vi ifcfg-ens33
![](https://img-blog.csdnimg.cn/img_convert/0ce1d5fda4704b79990705db3991cae1.png)
5.进入配置页面:按【i】快速编辑插入
![](https://img-blog.csdnimg.cn/img_convert/048f88c69cbb4ec68ae37be29bf95e95.png)
6.修改ONBOOT=no 为 ONBOOT=yes
![](https://img-blog.csdnimg.cn/img_convert/851b99c494d34f3eb0b187a17be745d7.png)
7.修改完成按【esc】--按【:】按【wq 】保存退出
8.重启网络
输入命令:systemctl restart network
![](https://img-blog.csdnimg.cn/img_convert/6dbdfa15530f4ef2bacddfd34a5b38c1.png)
9.通过ip add查看自己的ip,发现ens33出现了ip地址。
![](https://img-blog.csdnimg.cn/img_convert/fbfe2651c38e43cd81756c60de070f37.png)
10.测试:ping baidu.com
![](https://img-blog.csdnimg.cn/img_convert/956fa2ce175c422b9cddb445bb0c7392.png)
11.重启服务器-----reboot
![](https://img-blog.csdnimg.cn/img_convert/f94a262b03ea42dd925ab959e5472093.png)