報錯信息
==> 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" 這段配置的表示使用現有的網絡配置,不再自動創建對應的網卡信息。
再次啟動即可進入虛擬機了~~~