I am managing multiple VMs with Vagrant. Networks are configured as private, ip addresses have been set and hostnames are assigned. As shown in the Vagrantfile below.
The VMs can communicate with each other via the IP address, but I would like to know how to allow VMs to communicate using their assigned hostname. I.e. How to make ping comtest2
work from comtest1
?
Vagrantfile:
Vagrant.configure("2") do |config|
config.vm.define "comtest1" do |comtest1|
comtest1.vm.box = "precise32"
comtest1.vm.hostname = "comtest1"
comtest1.vm.network "private_network", ip: "192.168.10.21"
end
config.vm.define "comtest2" do |comtest2|
comtest2.vm.box = "precise32"
comtest2.vm.hostname = "comtest2"
comtest2.vm.network "private_network", ip: "192.168.10.22"
end
end