title: Setting up multiple virtual machines, that can all talk to each other, as well as other physical hosts
body: <p>I am trying to set up a server environment as follows:</p>
  
  <ul>
  <li>Physical Host machine: (192.168.0.106)</li>
  <li>Physical Laptop: (192.168.0.130)</li>
  </ul>
  
  <p>On the host machine, I am trying to use vagrant to set up 2 Virtual Machines</p>
  
  <ul>
  <li>Virtual Machine 1 (VM_IP_1). Vagrant is set up to port forward 5555:8080. This machine will be running some sort of webserver, on port 8080</li>
  <li>Virtual Machine 2 (VM_IP_2). </li>
  </ul>
  
  <hr>
  
  <p>I am trying to accomplish the following:</p>
  
  <ol>
  <li>From Physical Host Machine, I want to be able to open up a web browser, navigate to VM_IP_1:5555, and connect to the web server, displaying some web page</li>
  <li>From Laptop Machine, I want to be able to open up a web browser, navigate to VM_IP_1:5555, and connect to the web server, displaying some web page (same as 1)</li>
  <li>From Virtual Machine 2, I want to be able to open up a web browser, navigate to VM_IP_1:5555, and connect to the web server, displaying some web page (same as 1).</li>
  </ol>
  
  <p>Is this even possible? I've spent the last 2 days, tinkering, trying to automate it, but no luck.</p>
  
  <p>Basically, I want to simulate a non-trivial network architecture consisting of web servers, load balancers, databases, etc. I want to be able to test as if my single powerful server was a simulation of a network (i.e it would run 4 VMs) but also have the flexibility and re usability of my vagrant automation to be able to deploy to production something like (2 powerful servers, each running 2 VMS for a total of 4)</p>
  
  <p>Everyone should be able to communicate with everyone (assuming I have the ports forwarded correctly - routing tables too)</p>
  
  <p>Here are the VagrantFiles I've been playing around with. Tried with private_network but I don't think that's right. There's <code>Host Only</code> but I don't think that's right eitherI am thinking that maybe I need to have some sort of reverse <code>port_forwarding</code> from VM 2. But that doesn't sound right.</p>
  
  <pre><code>VagrantFile VM 1
     config.vm.network 'public_network', ip: '192.168.0.140'
     config.vm.network 'forwarded_port', guest: 8080, host: 5555
  
  VagrantFile VM 2
     config.vm.network 'public_network', ip: '192.168.0.150'
  </code></pre>
  
  <p><strong>EDIT</strong>: As I discovered, it seems that the <code>forwarded_port</code> seems to be pretty much useless when using <code>'public_network'</code>. I am not sure I 100% understand why, but I can do everything as I outlined above if I change from port 5555 to 8080</p>