The right thing to do is:
set your VMs on your physical network and give them static IPs and set netmask as well:
config.vm.define "vm1" do |vm1|
vm1.vm.hostname = "vm1"
vm1.vm.network "public_network", ip: "192.168.x.y", bridge: "wlan0", netmask: "255.255.255.0"
end
config.vm.define "vm2" do |vm2|
vm2.vm.hostname = "vm2"
vm2.vm.network "public_network", ip: "192.168.x.y", bridge: "wlan0", netmask: "255.255.255.0"
end
Like this the VMs appear as physical servers on my network and no port-forwarding is necessary ( like in docker with --net=host
parameter ).
At first my services were only accessible from the host on which Vagrant was running until I have figured out that I need to supply the netmask option as well, and boom, after the next vagrant reload
every other device in my local network can now access those services as well.
I have stump upon the solution via this thread.
I think that the official Vagrant docs should be updated to include that option as I couldn't find it initially there, and it's an important one.