要回答原来的问题以及@ blong的Vagrant论坛帖子,这是我所做的工作。我正在尝试做类似的事情(实际上是Vagrant/VMware托管Vagrant/Vbox),我已经执行了所有我能想到的优化,为我的“主机”虚拟机提供了大量的RAM(24GB)和6个通过设置“将所有虚拟机内存装入保留的主机内存”,并允许每个虚拟机页面文件(否则它们将存在于限制多少虚拟机的系统页面文件中),禁止将虚拟机交换到磁盘(在Windows上发生这种情况)你可以一次运行)。
我正在做的工作一直很完美,我遇到的网络问题是由于我背后的公司代理。一旦我配置了我的虚拟机可以访问互联网,并且全世界都是正确的。
除了在我的示例(Virtualbox)Vagrantfile中已经设置的natdnsproxy1和naddnshostresolver1之外,我必须通过Vagrantfile手动设置--natbindip1和--natnet1。这些设置可以在Virtualbox文档中找到,以获取正确的用法。总结一下,在虚拟机CPU设置中使用VT-x passthrough /“虚拟化”选项,为虚拟机提供足够的内存,不允许在“根”主机上交换内存,并且尽量确保你的网络范围不重叠,否则你会遇到路由问题。
这是我工作的Vagrantfile,它几乎完全基于andreptb的要求,为现代流行的流浪设置。 https://gist.github.com/andreptb/57e388df5e881937e62a
# -*- mode: ruby -*-
# vi: set ft=ruby :
# box name into env var, same script can be used with different boxes. Defaults to win7-ie11.
box_name = box_name = ENV['box_name'] != nil ? ENV['box_name'].strip : 'win7-ie11'
# box repo into env var, so private repos/cache can be used. Defaults to http://aka.ms
box_repo = ENV['box_repo'] != nil ? ENV['box_repo'].strip : 'http://aka.ms'
Vagrant.configure("2") do |config|
# If the box is win7-ie11, the convention for the box name is modern.ie/win7-ie11
config.vm.box = "modern.ie/" + box_name
# If the box is win7-ie11, the convention for the box url is http://aka.ms/vagrant-win7-ie11
config.vm.box_url = box_repo + "/vagrant-" + box_name
# big timeout since windows boot is very slow
config.vm.boot_timeout = 500
# rdp forward
config.vm.network "forwarded_port", guest: 3389, host: 3389, id: "rdp", auto_correct: true
# winrm config, uses modern.ie default user/password. If other credentials are used must be changed here
config.vm.communicator = "winrm"
config.winrm.username = "IEUser"
config.winrm.password = "Passw0rd!"
config.vm.provider "virtualbox" do |vb|
# first setup requires gui to be enabled so scripts can be executed in virtualbox guest screen
#vb.gui = true
vb.customize ["modifyvm", :id, "--memory", "1024"]
vb.customize ["modifyvm", :id, "--vram", "128"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000]
end
end
我额外的变化:
# Need the WinRM gem for managing from Linux
$ sudo gem install winrm
config.vm.communicator = "winrm"
+ config.winrm.host = "localhost"
config.winrm.username = "IEUser"
config.winrm.password = "Passw0rd!"
# This one may not be necessary, I added it for completeness
+ config.vm.guest = :windows
# In order to USE the two CPUs you need the ioapic
# Virtualbox gives an error in the GUI and only shows 1 CPU in the VM otherwise
vb.customize ["modifyvm", :id, "--cpus", "2"]
+ vb.customize ["modifyvm", :id, "--ioapic", "on"]
# We had to modify the network range because we are running Virtualbox inside VMware
+ vb.customize ["modifyvm", :id, "--natnet1", "192.168.199.0/24"]
取出+迹象,并添加这些行到Vagrantfile上面,你应该有一个相当的工作系统,我一直使用的是什么。
看起来您正在尝试运行嵌入式类型2的虚拟机管理程序。首先,不是所有的hypervisors都支持在其中运行另一个hypervisor(相同或差异)。第二,你真的启用了虚拟机的设置 - CPU - '可视化Intel VT-x或AMD-V'选项吗? –
顺便说一句:只要启用VT-x/AMD-V加速,VirtualBox内部的VirtualBox就是可能的。 –
我可以证实Terry的评论 - 在我以前的地方,我们在vSphere虚拟机内部运行Vagrant虚拟机,以便构建和测试新的核心Vagrant框图像:) –