Windows10环境vagrant+VirtualBox虚拟机无法创建私有网络的解决方案。

报错信息

==> default: Clearing any previously set network interfaces...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: E_FAIL
VBoxManage.exe: error: Failed to create the host-only adapter
VBoxManage.exe: error: Code E_FAIL (0x80004005) - Unspecified error (extended info not available)
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleCreate(struct HandlerArg *)" at line 70 of file VBoxManageHostonly.cpp

报错原因:

  在Windows10中,网络策略的变化,VirtualBox没有相应权限

解决方案:

  ①打开Orcle VM VirtualBox图形界面。管理-->全局设定-->网络-->仅主机(Host-Only)网络,修改IPv4地址为192.168.33.100。保存退出

  ②更改Windows网络配置,修改VirtualBox Host-Only Ethernet Adapter手动设定ip地址为192.168.33.100。

  ③修改vagrant的配置文件VagrantFile,在private-network中修改对应网络设置为:config.vm.network "private_network", ip: "192.168.33.100", name: "VirtualBox Host-Only Ethernet Adapter" 这段配置的表示使用现有的网络配置,不再自动创建对应的网卡信息。

  再次启动即可进入虚拟机了~~~

原文地址:https://www.cnblogs.com/jixingke/p/7868820.html