Vagrant自动生成的配置在Win10系统联网有问题,经常时好时坏,需要改动配置文件,如下:
config.vm.provider "virtualbox" do |vb|
# # Display the VirtualBox GUI when booting the machine
# vb.gui = true
#
# # Customize the amount of memory on the VM:
# vb.memory = "1024"
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
另外也可能是DNS的问题,需要配置/etc/resolv.conf中的nameserver。
配置完后,需要执行vagrant halt,vagrant up,这样创建的虚拟机就能访问网络了