1、以管理员身份启动vm。
2、在虚拟机里ifconfig -a查看网卡;通常由于修改配置导致网卡名字被修改。
这种情况,通常网卡配置中已经没有eth0的配置了。
可以手动添加:
cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
source /etc/network/interfaces.d/*
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
#iface eth0 inet static
#address 192.168.0.129
#network 192.168.0.0
#netmask 255.255.255.0
#broadcast 192.168.0.255
#gateway 192.168.0.1
allow-hotplug eth0
3、如果是网卡名字被修改成了其他名字,可以通过dmesg查看是否被修改。
dmesg | grep -i eth
[ 1.007772] e1000 0000:02:01.0 eth0: (PCI:66MHz:32-bit) 00:0c:29:07:93:6a
[ 1.007776] e1000 0000:02:01.0 eth0: Intel(R) PRO/1000 Network Connection
[ 1.008309] e1000 0000:02:01.0 ens33: renamed from eth0
修改成eth0:
#vim /etc/default/grub
GRUB_CMDLINE_LINUX=""
修改为
GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"
# grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found background image: /usr/share/images/desktop-base/desktop-grub.png
Found linux image: /boot/vmlinuz-4.9.0-6-amd64
Found initrd image: /boot/initrd.img-4.9.0-6-amd64
done
#reboot
重启虚拟机。
#service networking restart
重启网络
#ifconfig -a
查看网卡名字是否恢复到eth0,是否up
4、打开服务,启动Device install service, Device setup manager,并设置为自动启动。
5、在网络编辑器里还原默认配置。重启虚拟机即可