要回答原來的問題以及@ 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框圖像:) –