我正在尝试让 2 个 Vagrant VM 通过专用网络进行通信,但我不能做正确的事情,因为两者都无法在我指定的 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
了每台机器,它们看起来像:
虚拟机1:
eth2 ... inet addr:10.0.2.51 Bcast:10.0.2.255 Mask:255.255.255.0 ...
虚拟机2:
eth2 ... inet addr:10.0.2.52 Bcast:10.0.2.255 Mask:255.255.255.0 ...
我什至不能 ping 或 ssh 到主机的任何一个客人。任何想法为什么这不起作用?