Vvv: How to make sites available on local network?

Created on 25 Jun 2015  路  5Comments  路  Source: Varying-Vagrant-Vagrants/VVV

What is the easiest way to make my VVV sites available on my local home network? I want to test my sites with my mobile devices.

question

Most helpful comment

In VVV's Vagrantfile find the following line:

config.vm.network :private_network, ip: "192.168.50.4"
and disable the private network settings by commenting them out like so:
# config.vm.network :private_network, ip: "192.168.50.4"

Now enable publick network to access to the guest machine from other devices (i.e. your mobile device) on the same network. To do this find the following line:
# config.vm.network "public_network"
and enable by removing the leading '#'
config.vm.network "public_network"

Save the Vagrant file.
Make sure your vagrant VM is halted and _not_ suspended
Start your vagrant VM with vagrant up
If prompted, choose the network device your host machine uses to connect to your network (i.e. wlan0 if you connect the host machine via Wifi to your router)
That's it

One problem I encountered was that my hosts where not mapped after setting up a public network, so I had to access the running guest VM via it's IP address from any other devices on the network.

To find out the IP address of your vagrant VM make sure it's up and running and use vagrant ssh to access the machine via SSH.

Run ifconfig on your SSH console and have a look at the eth1 device which should carry the VMs public IP address.

All 5 comments

In VVV's Vagrantfile find the following line:

config.vm.network :private_network, ip: "192.168.50.4"
and disable the private network settings by commenting them out like so:
# config.vm.network :private_network, ip: "192.168.50.4"

Now enable publick network to access to the guest machine from other devices (i.e. your mobile device) on the same network. To do this find the following line:
# config.vm.network "public_network"
and enable by removing the leading '#'
config.vm.network "public_network"

Save the Vagrant file.
Make sure your vagrant VM is halted and _not_ suspended
Start your vagrant VM with vagrant up
If prompted, choose the network device your host machine uses to connect to your network (i.e. wlan0 if you connect the host machine via Wifi to your router)
That's it

One problem I encountered was that my hosts where not mapped after setting up a public network, so I had to access the running guest VM via it's IP address from any other devices on the network.

To find out the IP address of your vagrant VM make sure it's up and running and use vagrant ssh to access the machine via SSH.

Run ifconfig on your SSH console and have a look at the eth1 device which should carry the VMs public IP address.

I am a newbie to VVV (migrating from MAMP), was struggling with same yesterday, tried above but didnt work on my mac for some reason. I then tried an alternate approach from @salcode explained at http://salferrarello.com/vagrant-vvv-setup-wordpress/ - and that worked for me. (thought to pitch in if above doesnt work for you as well)

In addition to the above, I'll toss my Various Networking Configurations in VVV in as an additional explainer. I'd like to get more of this built out so that we can provide nicer docs on varyingvagrantvagrants.org one day.

In #566 @JPry provides some clarification on using the Public Network option. Re-reading Various Networking Configurations in VVV I see this information was covered but I needed to be hit over the head with it explicitly, which is my own short-coming but I thought I'd mention it here in case it helps others.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joelworsham picture joelworsham  路  5Comments

JDGrimes picture JDGrimes  路  4Comments

pvanbavel picture pvanbavel  路  4Comments

caseyallen386 picture caseyallen386  路  5Comments

tomjn picture tomjn  路  3Comments