Vagrant 网络与非主机网络发生冲突

Vagrant network collides with a non-hostonly network

我正在尝试启动一个 vagrant box 运行,但我一直收到网络冲突错误。这个盒子是 trusty64 的全新下载。我一直在搜索与流浪汉打交道的每个文件和文件夹,试图找到我找不到的指定 IP 的内容。我是 运行 一台 windows 7 机器上的流浪汉。这是我的 Vagrantfile:

C:\Users\.vagrant\boxes...\Vagrantfile

Vagrant::Config.run do |config|
  # This Vagrantfile is auto-generated by 'vagrant package' to contain
  # the MAC address of the box. Custom configuration should be placed in
  # the actual 'Vagrantfile' in this box.
  config.vm.base_mac = "0800278493DB"
end

# Load include vagrant file if it exists after the auto-generated
# so it can override any of the settings
include_vagrantfile = File.expand_path("../include/_Vagrantfile", __FILE__)
load include_vagrantfile if File.exist?(include_vagrantfile)

这是我从 vagrant up 命令收到的错误:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set network interfaces...
The specified host network collides with a non-hostonly network!
This will cause your specified IP to be inaccessible. Please change
the IP or name of your host only network so that it no longer matches that of
a bridged or non-hostonly network.

如何让我的 virtualbox 上的 IP 不冲突?

更新

我的 Vagrantfile 的图片

1。 在 homestead.rb 中找到

配置私网IP config.vm.network :private_network, ip: settings["ip"] ||= "192.168.10.10"

因为ip是固定的

2。 设置自己的ip config.vm.network :public_network, ip: 设置["ip"] ||= "192.168.1.234", :bridge => 'your own IP'

3。 重新加载框并选择您正在使用 WIFI 现在您可以在本地网络中访问了

检查您在 LAN 连接上的 IP,并确保没有设备与 Vagrantfile 上的 IP 冲突。

我遇到了这个错误,我在笔记本电脑的 wifi 上设置了 192.168.1.2,并且在我的 Vagrantfile 上设置了 192.168.1.10。所以我将 Vagrantfile 上的 IP 更改为 192.168.2.10 以确保它不会与我网络上的任何设备发生冲突。

我遇到了同样的挑战,并按照以下方法解决了这个问题:

在 VirtualBox 中,转到文件 -> 主机网络管理器

记下此 window 中的 IPv4 地址。在您的 Vagrantfile 中,使用保留的私有 IPv4 网络范围内的任何 IP。假设您的 VirtualBox IPv4 地址是 192.168.56.1/24。然后在您的 Vagrantfile 中添加

config.vm.network "private_network", ip: "192.168.56.5"

如果需要,请记住相应地配置您的 hosts 文件。

我通过断开与互联网的连接来解决此连接,然后 运行 vagrant up。一旦流浪者完成了它的处理,所以我再次连接。

在这个问题之前,我检查了我的 ip,所以它是 10.1,我的 homestead 在 10.10 上 运行ning,我解决了这个问题

我在家工作时遇到了同样的问题,所以我在 Vagrantfile 上所做的是:

# app.vm.network :private_network, ip: '10.0.0.07' # work
  app.vm.network :private_network, ip: '192.168.56.77' # home

我comment/uncomment取决于我在哪里。

热点提示!如果您正在编辑配置文件但没有任何效果,请仔细检查您正在编辑 Homestead.yaml - 而不是 Homestead.yaml.example

我做到了,我们都做到了,别那样看着我

让我失望的是我想要 public 网络而不是私人 host-only 网络。因此,我没有使用 config.vm.network "private_network", ip: "192.168.1.1",而是使用了 config.vm.network "public_network", ip: "192.168.1.1",而且效果很好。我检查过没有ip冲突。