流浪的机器没有选择网络设置

时间:2013-09-16 02:03:31

标签: virtualbox vagrant

我正在尝试使用以下设置启动新VM

Vagrant.configure("2") do |config|

  config.vm.define :master do |master|
    master.vm.box = "saucy64"

    master.vm.provider :virtualbox do |v|
      v.name = "vm-cluster-node1"
      v.customize ["modifyvm", :id, "--memory", "4096"]
    end
    #  master.vm.network :private_network, ip: "10.211.55.100"
    master.vm.hostname = "vm-cluster-node1"
    master.vm.provision :shell, path: "bootstrap.sh"
  end
end

如果我注释掉网络线路,我会收到以下错误:

The guest machine entered an invalid state while waiting for it 
to boot. Valid states are 'starting, running'. The machine is in the
'poweroff' state. Please verify everything is configured
properly and try again.

为什么机器无法接收网络设置?

我尝试更改IP范围以查看它是否与网络上的某些内容发生冲突,但在所有情况下都会出错。

Vagrant 1.3.1 Virtualbox 4.2

2 个答案:

答案 0 :(得分:0)

我已尝试使用Vagrant Ubuntu Cloud Image配置 - Saucy amd64。无论是否有master.vm.network :private_network,ip: "10.211.55.100"行,它都能很好地工作。

尝试使用VBoxManage controlvm UUID|NAME poweroff关闭虚拟机并重新启动它。有时,流浪汉无法停止虚拟机。

  

注意:我将外部shell脚本更改为内联,因为我甚至懒得编写一个简短的脚本; - )

# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.define :master do |master|
    master.vm.box = "saucy64"

    master.vbguest.auto_update = false

    master.vm.provider :virtualbox do |v|
      v.name = "vm-cluster-node1"
      v.customize ["modifyvm", :id, "--memory", "1024"]
    end

    master.vm.network :private_network,ip: "10.211.55.100"
    master.vm.hostname = "vm-cluster-node1"
    master.vm.provision "shell",
      inline: "echo hello world"
  end
end

vagrant ssh进入它,我可以看到2个接口

    vagrant@vm-cluster-node1:~$ ifconfig
    eth0      Link encap:Ethernet  HWaddr 08:00:27:8e:c7:2d  
              inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0
              inet6 addr: fe80::a00:27ff:fe8e:c72d/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:337 errors:0 dropped:0 overruns:0 frame:0
              TX packets:265 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:41271 (41.2 KB)  TX bytes:34336 (34.3 KB)

    eth1      Link encap:Ethernet  HWaddr 08:00:27:b2:8a:f6  
              inet addr:10.211.55.100  Bcast:10.211.55.255  Mask:255.255.255.0
              inet6 addr: fe80::a00:27ff:feb2:8af6/64 Scope:Link
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000 
              RX bytes:0 (0.0 B)  TX bytes:798 (798.0 B)
    vagrant@vm-cluster-node1:~$ hostname
    vm-cluster-node1
    vagrant@vm-cluster-node1:~$ hostname -f
    vm-cluster-node1

答案 1 :(得分:0)

我发现在内核3.1上运行的虚拟框4.1.16中存在错误

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=721786

由于它不能正常工作。

我将其升级到4.1.18并且工作正常

感谢所有回答

的人