VM虚拟机克隆移动导致网卡丢失

  • Author:ZERO-A-ONE
  • Date:2021-11-01

最近因为克隆了一台电脑上的虚拟机到自己的电脑上突然发现网卡丢失了,简单介绍一下当时的情况:

  • 被克隆VMWare Pro Version:16.0
  • 本机VMWare Pro Version:16.2.0 build-18760230
  • 克隆系统:Ubuntu 18.04 LTS

这种问题一般是因为克隆机一开始运行在桥接模式,到新的平台上网卡配置出现了问题,我们首先把虚拟机的网卡调整为NAT模式,然后打开ubuntu里的网络设置:

$ sudo vim /etc/network/interfaces

配置如下:

auto eth0
iface eth0 inet dhcp

重启网络设备:

/etc/init.d/networking restart

会报下面的错误

SIOCSIFADDR: No such device
eth0: ERROR while getting interface flags: No such device
eth0: ERROR while getting interface flags: No such device
Bind socket to interface: No such device
Failed to bring up eth0.

使用ifconfig -a看我们拥有的网络设备,发现网卡名字并不是eth0,一般而言虚拟机使用NAT模式网卡的名字其实是ens33,这时我们再次执行:

$ sudo vim /etc/network/interfaces

然后修改配置文件为:

auto ens33
iface ens33 inet dhcp

再次重启网络设备:

/etc/init.d/networking restart

然后重启即可

$ sudo reboot

老版本的Ubuntu其实也可以考虑删除直接下面的文件

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

然后,重启linux就可以把网卡名变回ens33了

扫描二维码关注公众号,回复: 15319004 查看本文章

猜你喜欢

转载自blog.csdn.net/kelxLZ/article/details/121073195