0

Does any one know how to configure multi-vm mode to be able to communicate each VM with others. I want to deploy client-server application and my VMs can't communicate by dns without adding hosts rules.

Roman Iuvshin
  • 131
  • 2
  • 8

1 Answers1

0

Put each VM in the same private network. If needed, have vagrant give them static IP addresses. For example

Vagrant.configure("2") do |config|

  config.vm.define "web" do |web|
    web.vm.network "private_network", ip: "192.168.50.4"
  end

  config.vm.define "db" do |db|
    db.vm.network "private_network", ip: "192.168.50.5"
  end
end
sciurus
  • 12,678
  • 2
  • 31
  • 49
  • same private network will allow to communicate by dns? I can't use static IPs – Roman Iuvshin Apr 01 '14 at 18:55
  • No, this does not automatically set up DNS for you. If you want to have Vagrant setup DNS look at https://github.com/phinze/landrush – sciurus Apr 01 '14 at 19:25
  • I can set up host name just but pure vagrant like, vm.host_name = hostname + '.' + domain But I need a way that will allow recognize vm each other by DNS – Roman Iuvshin Apr 01 '14 at 19:33