【问题标题】:How do you create a host-only network in Vagrant for NFS?你如何在 Vagrant 中为 NFS 创建一个仅限主机的网络?
【发布时间】:2016-12-22 21:17:22
【问题描述】:

我在文档中找不到有关此错误消息的任何信息:

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.

这是我的 Vagrant 配置:

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']

当被问到时,我选择了桥接的机场连接(Wi-Fi (AirPort))。

我在 Vagrant 文档中找不到 hostonly 的单一用法。

使用 Vagrant 1.7.4

我的目标只是能够从我家的其他计算机(和我的手机)访问在我家的一台计算机上运行的 VM。

【问题讨论】:

    标签: networking vagrant


    【解决方案1】:

    如果你想拥有 NFS 和公共/桥接网络,试试这个:

    流浪文件

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

    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)"
    

    【讨论】:

      【解决方案2】:

      在您的 Vagrantfile 中将 hostonly 替换为 ip

      config.vm.network "public_network", ip: "192.168.33.10"
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2012-08-31
        • 2015-11-12
        • 1970-01-01
        • 2020-12-25
        • 2021-02-15
        • 1970-01-01
        • 1970-01-01
        • 2014-02-27
        相关资源
        最近更新 更多