Getting two vagrant VMs to communicate -
i've looked around lot solution seems simple problem, , have not come answer.
i have vagrantfile defines 2 vms:
vagrant.configure("2") |config| config.vm.define :box1 |config| config.vm.box = "hashicorp/precise32" config.vm.hostname = "box1" config.vm.network "private_network", ip: "192.168.0.21" config.vm.provision :hosts end config.vm.define :box2 |config| config.vm.box = "hashicorp/precise32" config.vm.hostname = "box2" config.vm.network "private_network", ip: "192.168.0.22" config.vm.provision :hosts end end
so, understanding of i'm giving each box own ip address, , running hosts
provisioner (provided vagrant-hosts
plugin). vagrant-hosts docs, should need do.
however:
$ vagrant ssh box1 -c 'ping 192.128.0.22' ping 192.168.0.22 (192.168.0.22) 56(84) bytes of data. 192.168.0.21 icmp_seq=1 destination host unreachable 192.168.0.21 icmp_seq=2 destination host unreachable 192.168.0.21 icmp_seq=3 destination host unreachable ^c --- 192.168.0.22 ping statistics --- 6 packets transmitted, 0 received, +3 errors, 100% packet loss, time 5031ms pipe 3 connection 127.0.0.1 closed.
for life of me, can't figure out how make 2 vms communicate each other. missing?
by default vagrant uses nat networking guest vm instances.
you need alter vm configuration change bridged networking (the easiest) or create virtual network switch allow inter-vm communication (or along lines) whatever hypervisor provider using. varies provider , not appear directly supported vagrant.
http://friendsofvagrant.github.io/v1/docs/bridged_networking.html
in fact appears official vagrant documentation doesn't seem indicate support bridged networking instead allows configure public networks. may more need/want it's worth:
Comments
Post a Comment