-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Host-Only-Adapter has wrong IP and subnetmask #1014
Comments
I had the same issue with a Vagrantfile that had 2 machines that each used :hostonly with just an IP specified. It worked well for several weeks, but today I ran into it. After a reboot and recreating the machines it worked again. Versions: |
seems like this bug https://www.virtualbox.org/ticket/8796 |
I have the same issue. I think is because Vagrant can't identify a matching host-only network adapter and create a new one. no matter what even if the last host-only network adapter is still there. This issue is on windows as host, because with the same configuration on a Linux machine as host everything run as expected.
Greetings from Mexico. |
actually the problem is windows specific and you cannot fix it within the vagrant file. The problem manifests when you destroy and recreate the adapter via the vboxmanage.exe. Under some circumstances windows will then give your adapter an APIPA address (169.254.x.x) and the default subnet mask 255.255.0.0 .You cannot change this behaviour. A tricky workaround, that works great is to create a dummy box in virtual box that uses a hostonly adapter with the correct ip and subnet, then vagrant won't delete and recreate the adapter and cannot run into that problem. The workaround also prevents you from clicking the annoying UAC popup all the time. On the ChefConf i talked with Mitchell and he will probably create a switch to prevent vagrant from deleting and recreating the adapter. |
my take on this, you need 2 things: the first step dont ask me ... virtualbox create the adapter with that driver on and it fucks everything up. the second step its weird too... if you change the ip and net mask in the GUI it only lets you define a 255.255.0.0 mask other than that it will not save. but with the CLI command it works! so add the virtualbox folder to the PATH and run the cmd with the ip and net mask you want. after that if the ip on your vagrantfile is in the same range of the one you define in the step 2 go ahead and vagrant up. Vagrant will use "VirtualBox Host-Only Ethernet Adapter #2" and will not create a new one. |
Based on everything I've read here as well as the evidence put forward, I'm going to say this is a VirtualBox bug. What Vagrant does when you specify a host only network is look for a matching one and use it. In this case, it looks like VirtualBox isn't properly keeping the settings set, and therefore it no longer matches. If I'm wrong, feel free to add more. Thanks |
Well, I had the same problem on windows 8.1, but I just had to rerun the vagrant up command again and it worked xD. |
The same problem. I upgraded Virtualbox and Vagrant to the latest versions, and thus I created problems for me. Downgrade doesn't help. Every time I do vagrant up, vagrant creates a new host-only adapter with the wrong settings.
IP and mask for a new adapter (if it doesn't exists) should be 192.168.56.1 and 255.255.255.0 but like it is said above it is (169.254.x.x). So I can't visit guest by its IP. I try to change settings of host-only adapter in Virtualbox, but it reset it to 169.254.x.x again. The only thing that helped me is manual changind ipv4 settings of virtual host-only adapter and after turn off/turn on this adapter and after reloading vagrant everything begins to work like before. What does all that mean? I shouldn't use private network anymore? |
I have the latest versions of Vagrant and Virtualbox. What is solution for this problem now? Virtualbox is guilty or not, the problem still exists. Somebody do something or tell me what is the best practice to solve problem for now. |
When starting a box with host-only-networking, sometimes the created virtual network adapter in VirtualBox has a different IP and subnetmask than specified. That causes the problem, that if I start an other box of our Vagrant environment, VirtualBox registers a "Virtualbox Host Only Adapter #2", #3, etc. This prevents the different VMs from communicating with each other, because the first VMs network card is "Virtualbox Host Only Adapter", and the second VMs adapter is "Virtualbox Host Only Adapter #2".
This problem occurs sporadically on different hosts with Windows 7. After rebooting the host machine, the error usually does not occur anymore.
The Vagrantfile we use:
In the Virtualbox Console, "VirtualBox Host-Only Ethernet Adapter" has the following properties:
We found this workaround, to force the VMs to use one network adapter, even if it has the wrong ip data :
man_config.vm.customize ["modifyvm", :id, "--nic2", "hostonly", "--cableconnected2", "on", "--hostonlyadapter2", "VirtualBox Host-Only Ethernet Adapter"]
This workaround is very helpful but it seems to be not a clean solution for permanent usage.
Software in Use:
Windows 7 64bit
Vagrant 1.0.3
VirtualBox 4.1.16
Thanks in advance and kind regards
Aimo
The text was updated successfully, but these errors were encountered: