2
votes

I have an multi vm vagrant enviroment with 3 vms. The problem is, that they have to communicate with each other. How can I setup my vagrantfile, so that one script from VM1 can curl to the VM2?

This config setting is not working:

VM1: config.vm.network "private_network", ip: "192.168.50.4"

VM2: config.vm.network "private_network", ip: "192.168.50.5"

In VM1:

curl 192.168.50.5

The result is, that I can not connect to the other VM. If I try to ping the other VM it seems,that host is unreachable. Can someone help?

1

1 Answers

0
votes

I will try to answer you the question based on the following example.

You have a two VM's where first one is handling backend application and second is handling frontend application.

On your host machine where two VM's are working you setted up hosts file like this:

192.168.33.10 frontend.app.dev
192.168.33.20 backend.app.dev

Now, when you want to talk from the frontend VM to the backend VM you have to set the same configuration of /etc/hosts on your frontend VM to be able to resolve it's host.