为了回答原问题以及@blong的Vagrant论坛帖子,这是我所做的使其工作的方法。
我自己也在尝试类似的事情(实际上是Vagrant / VMware托管Vagrant / Vbox),并且已经执行了我能想到的所有优化,给我的“主机”VM分配了大量内存(24GB)和6个核心,通过设置“将所有VM内存适合保留的主机内存”来禁用将VM交换到磁盘(当它发生时,在Windows上会导致问题),并允许每个VM页面文件(否则它们将驻留在系统页文件中,这限制了您可以同时运行的VM数量)。
我所做的一切都非常完美,我遇到的网络问题是由于我身后的公司代理引起的。一旦我配置好,我的VM就可以访问互联网,一切都正常了。
我确实不得不手动设置--natbindip1和--natnet1,除了我的示例(Virtualbox)Vagrantfile中已经设置的natdnsproxy1和naddnshostresolver1之外。这些设置可以在Virtualbox文档中找到正确的使用方法。
总之,在VM CPU设置中使用VT-x直通/"虚拟化"选项,为VM提供足够的内存,不允许该内存在"根"主机上被交换,并尝试确保您的网络范围不重叠,否则会出现路由问题。
这是我正在使用的Vagrantfile,它几乎完全基于andreptb的gist进行现代.ie vagrant设置。
https://gist.github.com/andreptb/57e388df5e881937e62a
box_name = box_name = ENV['box_name'] != nil ? ENV['box_name'].strip : 'win7-ie11'
box_repo = ENV['box_repo'] != nil ? ENV['box_repo'].strip : 'http://aka.ms'
Vagrant.configure("2") do |config|
config.vm.box = "modern.ie/" + box_name
config.vm.box_url = box_repo + "/vagrant-" + box_name
config.vm.boot_timeout = 500
config.vm.network "forwarded_port", guest: 3389, host: 3389, id: "rdp", auto_correct: true
config.vm.communicator = "winrm"
config.winrm.username = "IEUser"
config.winrm.password = "Passw0rd!"
config.vm.provider "virtualbox" do |vb|
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
我额外的更改:
$ sudo gem install winrm
config.vm.communicator = "winrm"
+ config.winrm.host = "localhost"
config.winrm.username = "IEUser"
config.winrm.password = "Passw0rd!"
+ config.vm.guest = :windows
vb.customize ["modifyvm", :id, "--cpus", "2"]
+ vb.customize ["modifyvm", :id, "--ioapic", "on"]
+ vb.customize ["modifyvm", :id, "--natnet1", "192.168.199.0/24"]
去掉加号并将这些行添加到Vagrantfile中,您应该拥有一个与我使用的等效工作系统。