找不到具有给定名称的主机网络接口

The host network interface with the given name could not be found

我正在 运行正在 Windows 10、VirtualBox 5 和 Vagrant 1.7.4 并尝试 运行 openedx plateform。

在我运行vagrant up之后我得到了:

Bringing machine 'default' up with 'virtualbox' provider...
==> 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", "ipconfig", "VirtualBox Host-Only Ethernet Adapter #25", "--ip", "192.168.33.1", "--netmask", "255.255.255.0"]

Stderr: VBoxManage.exe: error: The host network interface with the given name could not be found
VBoxManage.exe: error: Details: code E_INVALIDARG (0x80070057), component HostWrap, interface IHost, callee IUnknown
VBoxManage.exe: error: Context: "FindHostNetworkInterfaceByName(Bstr(pszName).raw(), hif.asOutParam())" at line 204 of file VBoxManageHostonly.cpp

Vagrant 文件:

Vagrant.require_version ">= 1.5.3"

VAGRANTFILE_API_VERSION = "2"

MEMORY = 4096
CPU_COUNT = 2

# map the name of the git branch that we use for a release
# to a name and a file path, which are used for retrieving
# a Vagrant box from the internet.
openedx_releases = {
  "openedx/rc/aspen-2014-09-10" => {
    :name => "aspen-fullstack-rc1", :file => "20141010-aspen-fullstack-rc1.box",
  },
  "aspen.1" => {
    :name => "aspen-fullstack-1", :file => "20141028-aspen-fullstack-1.box",
  },
  "named-release/aspen" => {
    :name => "aspen-fullstack-1", :file => "20141028-aspen-fullstack-1.box",
  },
  "named-release/birch.rc1" => {
    :name => "birch-fullstack-rc1", :file => "20150204-birch-fullstack-rc1.box"
  },
  "named-release/birch.rc2" => {
    :name => "birch-fullstack-rc2", :file => "20150211-birch-fullstack-rc2.box"
  },
  "named-release/birch.rc3" => {
    :name => "birch-fullstack-rc3", :file => "20150213-birch-fullstack-rc3.box"
  },
  "named-release/birch" => {
    :name => "birch-fullstack", :file => "20150224-birch-fullstack.box",
  },
  "named-release/birch.1" => {
    :name => "birch-fullstack-1", :file => "birch-1-fullstack.box",
  },
}
openedx_releases.default = {
  :name => "kifli-fullstack", :file => "20140826-kifli-fullstack.box"
}
openedx_releases_vmware = {
  "named-release/birch" => {
    :name => "birch-fullstack-vmware", :file => "20150610-birch-fullstack-vmware.box",
  },
}
openedx_releases_vmware.default = {
  :name => "kifli-fullstack-vmware", :file => "20140829-kifli-fullstack-vmware.box",
}
rel = ENV['OPENEDX_RELEASE']

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  # Creates an edX fullstack VM from an official release
  config.vm.box     = openedx_releases[rel][:name]
  config.vm.box_url = "http://files.edx.org/vagrant-images/#{openedx_releases[rel][:file]}"

  config.vm.synced_folder  ".", "/vagrant", disabled: true
  config.ssh.insert_key = true

  config.vm.network :private_network, ip: "192.168.33.10"
  config.hostsupdater.aliases = ["preview.localhost"]

  config.vm.provider :virtualbox do |vb|
    vb.customize ["modifyvm", :id, "--memory", MEMORY.to_s]
    vb.customize ["modifyvm", :id, "--cpus", CPU_COUNT.to_s]

    # Allow DNS to work for Ubuntu 12.10 host
    # http://askubuntu.com/questions/238040/how-do-i-fix-name-service-for-vagrant-client
    vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
  end

  config.vm.provider :virtualbox do |v, override|
  v.gui=true
  end

  ["vmware_fusion", "vmware_workstation"].each do |vmware_provider|
    config.vm.provider vmware_provider do |v, override|
      override.vm.box     = openedx_releases_vmware[rel][:name]
      override.vm.box_url = "http://files.edx.org/vagrant-images/#{openedx_releases_vmware[rel][:file]}"
      v.vmx["memsize"] = MEMORY.to_s
      v.vmx["numvcpus"] = CPU_COUNT.to_s
    end
  end
end

当我评论这一行时,一切顺利

config.vm.network :private_network, ip: "192.168.33.10"

但我无法访问 te LMS 和 CMS 页面(因为我当然评论了这一行)

如有任何建议,我们将不胜感激!

终于!我解决了!这是解决方案:

1- 我 运行 VBox-Win10-fix-14040.exe 作为管理员(参见 this Discussion

2- 运行 VirtualBox.exe 作为管理员 + 与 Windows 7[ 的兼容性=14=]

3- 和 Vagrant up :)

就是这样!

for windows 7 x86,也许你的虚拟盒子更新到最新版本。尝试恢复到版本 4。可以选择在 2014 年 3 月或 9 月发布

简单的解决方案:从 VirtualBox 首选项和 运行 sh launch.sh 中删除已经创建的(默认)仅主机以太网适配器(如果您在安装 Mirantis Openstack 软件包时收到错误)。

P.S。我看不出为什么它也不适用于 Vagrant。

如果您在尝试在 Virtualbox 上设置 Mirantis Openstack 包时遇到类似于以下的错误:

VBoxManage.exe:错误:找不到主机网络接口名称 'VirtualBox Host-Only Et'VBoxManage.exe:错误:名为 'VirtualBox Host-Only Et' 的主机网络接口找不到 打开 network.sh 脚本并添加 | sed 's/\r$//' 之前如下 | egrep:

本地found_iface=(execute VBoxManage list hostonlyifs | sed 's/\r$//'| egrep "Name: + $name$" | awk '/Name/ { = ""; print substr([=10=], 2) }')

本地new_name=(execute VBoxManage list hostonlyifs | sed 's/\r$//' | egrep -A9 "Name: + $name$" | awk '/Name/ { = ""; print substr([=11=], 2) }')

本地new_ip=(execute VBoxManage list hostonlyifs | sed 's/\r$//'| egrep -A9 "Name: + $name$" | awk '/IPAddress:/ { print }')

本地 new_mask=(execute VBoxManage list hostonlyifs | sed 's/\r$//'| egrep -A9 "Name: + $name$" | awk '/NetworkMask:/ { print }')

本地new_dhcp=(execute VBoxManage list hostonlyifs | sed 's/\r$//'| egrep -A9 "Name: + $name$" | awk '/DHCP:/ { print }')

本地id=execute VBoxManage hostonlyif create | sed 's/\r$//'| sed "s/'/_/g" | cut -d "_" -f2 | sed 's/\r$//'| sed "s/^_//" | sed "s/_$//"