虚拟机CentOS联网相关配置

时间:2024-04-30 19:04:38

CentOS 用ifconfig命令,只有lo,没有eth0的解决方案

如果ifconfig -a 也没发现eth0则拷贝lo自己造一个,CentOS7 命令为 ip addr

1、配置虚拟机如下图:

虚拟机CentOS联网相关配置

2、查看本地ipconfig /all 相关ip配置信息:

虚拟机CentOS联网相关配置

3、打开Centos定位至目录:cd /etc/sysconfig/network-scripts/

4. 修改/etc/sysconfig/network-scripts/ifcfg-eth0 文件编辑 vi ifcfg-eth0 , 把ONBOOT=no 改为 ONBOOT=yes,但ifconfig的结果没有任何改变。

5. service network restart,重启。出现shutdown eth0 OK,bring up eth0 OK,determine ip for eth0 OK。

eth0的截图:

虚拟机CentOS联网相关配置