Vagrant network collides with a non-hostonly network
Asked Answered
B

7

23

I am trying to get a vagrant box up and running, but I keep getting network collide errors. This box is a fresh download of trusty64. I have been searching every file and folder dealing with vagrant trying to find something specifying an IP I can't. I am running vagrant on a windows 7 machine. Here is my 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)

This is the error I receive from a vagrant up command:

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.

How do I get the IP on my virtualbox not to collide?

UPDATE

A image of my Vagrantfile

Vagrantfile

Bugloss answered 20/8, 2016 at 1:50 Comment(7)
Show your whole Vagrantfile .Sampling
No, it isn't. It does not even contain the reference to trusty64 box you mentioned.Sampling
Please find the image of my Vagrantfile above.Bugloss
This is not your Vagrantfile. It is a piece that is included in the box. Please show the Vagrantfile you use to run the machine.Sampling
I don't know of another Vagrantfile. Where would I be located on my windows machine?Bugloss
Please read the Vagrant tutorial; starting with the Project setup.Sampling
line 10 of your Vagrantfile, you include another vagrant, this is where the setting will be .. show the file at ../include/VagrantfileAcne
W
33

Check the IP you have on your LAN connection and make sure no devices are colliding with the IP on your Vagrantfile.

I got this error and I had 192.168.1.2 on my laptop's wifi and I was setting 192.168.1.10 on my Vagrantfile. So I changed the IP on my Vagrantfile to 192.168.2.10 to make sure it won't collide with any device on my network.

Weldon answered 11/3, 2017 at 19:42 Comment(1)
My vagrant machine was acting weird only when I was home. Found out it was sharing my router's IP address. Changing the vagrant IP address fixed the issue.Tuggle
R
11

I had the same challenge, and did the following to solve it:

In VirtualBox, go to File -> Host Network Manager

Take note of the IPv4 address in this window. In your Vagrantfile, use any IP in the reserved private IPv4 network range. Let's say your VirtualBox IPv4 address is 192.168.56.1/24. In your Vagrantfile you could then add

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

Remember to configure your hosts file accordingly, should that be required.

Requisite answered 2/1, 2018 at 1:14 Comment(0)
S
3

I had the same issue when I was working from home so what I did on my Vagrantfile was:

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

and I comment/uncomment depending on where I am.

Spicy answered 29/2, 2020 at 16:30 Comment(0)
S
1

What tripped me up was that i wanted public network not private host-only network. So instead of config.vm.network "private_network", ip: "192.168.1.1" i did config.vm.network "public_network", ip: "192.168.1.1" and that worked just fine. I had checked there were no ip conflicts.

Sakti answered 15/5, 2022 at 13:47 Comment(0)
A
0

1. in homestead.rb find

Configure A Private Network IP config.vm.network :private_network, ip: settings["ip"] ||= "192.168.10.10"

because ip is fixed

2. To set your own ip config.vm.network :public_network, ip: settings["ip"] ||= "192.168.1.234", :bridge => 'your own IP'

3. reload box and choose you are using WIFI now you can access in the local network

Aphelion answered 2/9, 2016 at 3:52 Comment(0)
L
0

Hot tip! If you're editing the hell out of your config file and nothing is working, double check that you are editing Homestead.yaml - NOT Homestead.yaml.example

I did it, we all do it, don't look at me like that

Liesa answered 11/1, 2022 at 11:20 Comment(0)
S
-2

I resolve this connection, by disconnecting with internet, then run vagrant up. Once vagrant done its processing so i connect again.

Before this issue, i checked my ip, so it was 10.1 and my homestead is running on 10.10 and i resolved this iss

Secessionist answered 19/3, 2018 at 18:2 Comment(2)
This does not fix the issue just a work around, it would be quite painful to do this each time.Minaret
agreed, @ZacGrierson what about if we change ip address from homestead.yml file. this would be quick fix, right?Secessionist

© 2022 - 2024 — McMap. All rights reserved.