Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you create a host-only network in Vagrant for NFS?

I cannot find any information in the docs about this error message:

NFS requires a host-only network to be created.
Please add a host-only network to the machine (with either DHCP or a
static IP) for NFS to work.

Here is my Vagrant config:

Vagrant.configure(2) do |config| 
 config.vm.box = "localbox" 
 config.vm.network "public_network", hostonly: "192.168.33.10"
 config.vm.synced_folder ".", "/var/www",  
    :nfs => true, 
    :mount_options =>['noacl,nolock,vers=3,udp,noatime,nodiratime,rsize=32768,wsize=32768']

When asked, I pick my Airport connection for the bridge (Wi-Fi (AirPort)).

I cannot find a single usage of hostonly in the Vagrant docs.

Using Vagrant 1.7.4

My goal is simply to be able to access the VM running on one computer in my house, from other computers (and my phone) in my house.

like image 838
AgmLauncher Avatar asked Jun 24 '16 22:06

AgmLauncher


1 Answers

If you want to have NFS and Public/bridge network try this:

Vagrantfile

config.vm.network "private_network", ip: "192.168.10.100"
config.vm.network "public_network", ip: "192.168.20.200"

or

config.vm.network "private_network", ip: "192.168.10.100"
config.vm.network "public_network", ip: "192.168.20.200", bridge: "en1: Wi-Fi (AirPort)"
like image 160
Slipstream Avatar answered Sep 25 '22 19:09

Slipstream