Vagrant网络与非主机网络冲突

use*_*759 13 virtualbox vagrant

我试图让一个流浪的盒子运行起来,但我不断遇到网络碰撞错误.这个盒子是trusty64的新下载.我一直在搜索处理vagrant的每个文件和文件夹,试图找到指定IP的东西我不能.我在Windows 7机器上运行流浪汉.这是我的Vagrantfile:

C:\ Users \用户.vagrant \盒...\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)
Run Code Online (Sandbox Code Playgroud)

这是我从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.
Run Code Online (Sandbox Code Playgroud)

如何让我的虚拟机上的IP不会发生冲突?

UPDATE

我的Vagrantfile的图像

Vagrantfile

Agu*_*ndo 19

检查LAN连接上的IP,确保没有设备与Vagrantfile上的IP冲突.

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

  • 只有当我在家时,我的流浪机器才会表现得很奇怪。发现它正在共享我的路由器的 IP 地址。更改流浪 IP 地址解决了该问题。 (2认同)

小智 6

我遇到了同样的挑战,并做了以下工作来解决它:

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

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

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

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