UbuntuServer 16.04 VirtualBox机器 - 网络接口的紧急模式

时间:2016-12-29 18:39:07

标签: virtual-machine ubuntu-server ifconfig

我正在使用带有Ubuntu16.04Server O.S的虚拟机。在Windows主机上。 一切都运行得很好,但在关闭所有东西然后回到我的虚拟服务器后,机器无法启动。

它显示:

  

[FAILED]无法启动提升网络接口。请参阅&system; systemctl status networking.service'详情。

因此系统进入紧急模式! 通过输入journalctl -xb,我可以看到以下问题:

...
ifup[1987]: Cannot find device "ens33"
...
ifup[1987]: Failed to bring up ens33.
systemd[1]: netowrking.service: Main process exited, code=exited ....

所以我发现无法启动提升网络接口

Subject: Unit networking.service has failed
Defined-By: systemd

输入ifconfig我只看到lo界面。没有显示ens33

在我的/etc/network/interfaces我还有两行:

auto ens33
iface ens33 inet dhcp

输入lshw我有以下与网络相关的输出:

*-network DISABLED
    description: Ethernet interfaces
    product: 82540EM Gigabit Ethernet Controller
    vendor: Intel Corporation
    physical id: 3
    bus info: pci@0000:00:03.0
    logical name: enp0s3
    ...
    ...
    configuration: autonegotiation=on broadcast=yes driver=e1000 driverversion=7.3.21-k8-NAPI duplex=full.......

因此,如果我运行ifup ens33,我会收到错误

Cannot find device ens33
Error getting hardware address for "ens33": No such device

虚拟机将默认以太网卡Intel PRO / 1000 MT Desktop(82540EM)连接为NAT。

完全陷入困境,我无法前进,只有紧急模式

1 个答案:

答案 0 :(得分:0)

终于找到了解决方案: 这个问题似乎应该与以太网卡的不匹配有关,我的解决方案是:

更换虚拟机上的卡 进入紧急模式 编辑/etc/network/interfaces文件,方法是更改​​ens33接口参数并添加新的eth0接口:

auto ens33
iface ens33 inet manual

auto eth0
iface eth' inet dhcp

此时通过重新启动网络服务,我可以看到界面。

在必要时编辑/etc/default/grub文件,从

更改行
GRUB_CMDLINE_LINUX=""

GRUB_CMDLINE_LINUX="net.ifnames=0 biosdevname=0"

然后我运行了以下命令:

sudo update-grub
sudo reboot