Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

vagrant homestead - public network not working on osx

I've been trying all day to get a public network setup using Vagrant 1.6.5 with VirtualBox. I really need to be able to access all my Homestead sites on my other devices (iPad, iPhone, Android phone, etc.) on my local network. The box provisions fine but the sites all timeout.

homestead.rb

config.vm.network "public_network", :bridge => "en0: Wi-Fi (AirPort)", :ip => "192.168.1.200"

My host is OS X mavericks using DHCP (192.168.1.137).

Private networking works fine, but I can't get public networking to work with any variation of the above config.

like image 552
Jared Eitnier Avatar asked Feb 11 '23 19:02

Jared Eitnier


2 Answers

You can just grab the host's internal IP address (NOT the VM ip) and add the port :8000. Let's say your host ip is 192.168.0.5, then from any other device on your network, you can just browse to the host at 192.168.0.5:8000 and you'll hit the VM and see the Laravel home page.

This works great for me with the default homestead.rb setting:

# Configure A Private Network IP
config.vm.network :private_network, ip: settings["ip"] ||= "192.168.10.10"
like image 199
prograhammer Avatar answered Feb 16 '23 03:02

prograhammer


To get my homestead machine to be visible from my LAN I did the following:

  1. Edit the Homestead/scripts/homestead.rb file and set config.vm.network :public_network, ip: "192.168.1.123" (just make sure the IP is free).

  2. Do a vagrant reload

  3. Make sure my old local hosts file now points to the new IP.

The result is I can ping 192.168.1.123 from another machine in my LAN.

like image 33
Lpgfmk Avatar answered Feb 16 '23 02:02

Lpgfmk