主机是Windows 8.1; 提供者是VirtualBox 4.3.4; Vagrant版本是1.3.5.
主机只有一个有线的NIC,IP 192.168.1.100.
Vagrantfiles读取:
config.vm.box = "precise64" config.vm.box_url = "http://cloud-images.ubuntu.com/vagrant/precise/current/precise-server-cloudimg-amd64-vagrant-disk1.box" config.vm.network :forwarded_port, guest: 80, host: 8080 config.vm.provision :puppet do |puppet| puppet.manifests_path = "puppet/manifests" puppet.module_path = "puppet/modules" puppet.manifest_file = "init.pp" puppet.options="--verbose --debug"
但是,以下vagrant up
,VM获取完全错误的 IP地址.ifconfig
对于客人说:
vagrant@vagrant-ubuntu-precise-64:~$ ifconfig eth0 Link encap:Ethernet HWaddr 08:00:27:1a:b6:5e inet addr:10.0.2.15 Bcast:10.0.2.255 Mask:255.255.25 inet6 addr: fe80::a00:27ff:fe1a:b65e/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:356 errors:0 dropped:0 overruns:0 frame:0 TX packets:239 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:38937 (38.9 KB) TX bytes:33157 (33.1 KB)
为什么Vagrant完全忽略了vagrantfile上的端口转发设置?IP地址应该是192.168.1.x
,而我随机得到这个10.0.2.15
.有任何想法吗?
编辑:主机甚至无法ping通10.0.2.15
.即使虚拟机启动,也没有响应.有些东西很破碎.
编辑2:现在我/sbin/ip addr flush dev eth1 2> /dev/null
开始使用2个不同的系统.哎呀.
Ssh进入机器
删除文件/etc/udev/rules.d/70-persistent-net.rules
退出机器
做一个"流浪汉重装"
我觉得这样做诀窍=]