在进行命令 ifconfig 的时候没有出现eth0网卡信息,造成不能上网,不能连接xshell,具体如下:


解决:虚拟机 Centos6 没有 eth0 网卡,造成不能上网,不能连接xshell!!!

原因是虚拟机根本就没有eth0网卡,用命令 ifconfig -a 查看虚拟机识别的网卡到底是什么?如下:

解决:虚拟机 Centos6 没有 eth0 网卡,造成不能上网,不能连接xshell!!!

发现虚拟机识别的网卡就是:eth1

所以改网卡名字为eth1

具体如下:

1.设置mac地址

cd /etc/udev/rules.d/70-persistent-net.rules/70-persistent-net.rules

删除其他网卡信息,只留下eth1的信息,把NAME="eth0"改成NAME="eth1",如下:

解决:虚拟机 Centos6 没有 eth0 网卡,造成不能上网,不能连接xshell!!!

 

2.为了方便,把网卡文件名改成和网卡名一样:

mv /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1

3.把eth1网卡的mac地址:解决:虚拟机 Centos6 没有 eth0 网卡,造成不能上网,不能连接xshell!!!设置为与/etc/sysconfig/network-scripts/ifcfg-eth0文件下的解决:虚拟机 Centos6 没有 eth0 网卡,造成不能上网,不能连接xshell!!! 一致,且修改此文件里面的网卡名为:DEVICE="eth1"

 vim /etc/sysconfig/network-scripts/ifcfg-eth1

解决:虚拟机 Centos6 没有 eth0 网卡,造成不能上网,不能连接xshell!!!

 

4.重启网络服务

 service network restart

如下:

解决:虚拟机 Centos6 没有 eth0 网卡,造成不能上网,不能连接xshell!!!

5.ping www.baidu.com

成功!!!

解决:虚拟机 Centos6 没有 eth0 网卡,造成不能上网,不能连接xshell!!!

6.连接xshell

成功!!!

解决:虚拟机 Centos6 没有 eth0 网卡,造成不能上网,不能连接xshell!!!

相关文章:

  • 2021-09-28
  • 2021-11-10
  • 2022-01-21
  • 2021-04-14
  • 2021-09-14
  • 2021-12-06
  • 2021-03-28
猜你喜欢
  • 2021-11-21
  • 2022-02-07
  • 2021-11-29
  • 2021-11-21
  • 2021-11-13
  • 2022-01-09
  • 2021-11-01
相关资源
相似解决方案