流浪的客人无法通过private_network互相访问

时间:2015-03-04 20:13:56

标签: vagrant private-network

我试图让2个Vagrant虚拟机通过专用网络进行通信,但我不能做正确的事情,因为两者都不能在我指定的IP地址上ping另一个。这是我的Vagrantfile配置:

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
  config.vm.box = "nrel/CentOS-6.5-x86_64"

  config.vm.define "vm1" do |box|
    box.vm.hostname = "vm1"
    box.vm.provider "virtualbox" do |v|
      v.memory = 512
      v.name   = "vm1"
    end
    box.vm.network :private_network, :ip => "10.0.2.51"
  end

  config.vm.define "vm2" do |box|
    box.vm.hostname = "vm2"
    box.vm.provider "virtualbox" do |v|
      v.memory = 512
      v.name   = "vm2"
    end
    box.vm.network :private_network, :ip => "10.0.2.52"
  end
end

但是,当我尝试从vm1 ping vm2时,我得到的是:

[vagrant@vm1 ~]$ ping 10.0.2.52
PING 10.0.2.52 (10.0.2.52) 56(84) bytes of data.
From 10.0.2.15 icmp_seq=1 Destination Host Unreachable
From 10.0.2.15 icmp_seq=2 Destination Host Unreachable
From 10.0.2.15 icmp_seq=3 Destination Host Unreachable

我在每台机器上检查了ifconfig,它们看起来像是:

VM1:

eth2 ... inet addr:10.0.2.51  Bcast:10.0.2.255  Mask:255.255.255.0 ...

VM2:

eth2 ... inet addr:10.0.2.52  Bcast:10.0.2.255  Mask:255.255.255.0 ...

我甚至无法通过主机ping或ssh到任何一位来宾。 任何想法为什么这不起作用?

0 个答案:

没有答案