-
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
Vagrant errors when specifying custom Host-Only attached adapter network #8878
Comments
I encountered the same issue, and was able to work around it by adding the following monkey patch to the top of my class VagrantPlugins::ProviderVirtualBox::Action::Network
def dhcp_server_matches_config?(dhcp_server, config)
true
end
end |
Ryan - thank you, added your snippet to the top of Vagrantfile and this resolved the issue for me, now VBox/Vagrant does not create the extra vboxnet rather uses the already existing one. Quite annoying though. |
+1 encountered same issue. Vagrant 2.1.5 |
Ran into this too. |
I also ran into this. Host O/S - Ubuntu 18.04.3 LTS Vagrant 2.2.5 Applied the monkey patch at the bottom of my vagrant file and worked. |
I also had this issue: Host O/S: Windows 10 Pro Vagrant: 2.2.5 Monkey patch worked for me. |
Monkey patch worked on: |
This is coming up consistently for me upon upgrading to 2.2.7 and VirtualBox 6.1 (but never before). The snippet seems to be working. Thanks. |
I hit this one yesterday setting up a new machine for a friend with the latest VirtualBox and Vagrant and the monkey patch worked for her. |
I have tested that yesterday. And all worked good. I'm setting private network. ANd in addition to that I assign nodes with static predefined IPs node.vm.network "private_network", ip: my_host_settings_map["ip"] |
I hit this today too. The work around that @RyanKoppenhaver-NCC provided worked. But... |
I hit this today and RyanKoppenhaver-NCC monkey patch (see further up the trail) worked perfectly. And +1 on the comments of "why has this not been fixed?'!!! I spent over an hour trying to get this to work so I could use a vagrant file for a training class. |
I was redirected here from #11364. Unfortunately I don't have time to test this again. I reverted to VirtualBox 6.0.16 and it works for me. I hope this information helps. |
Today was the first day I've seen this error, only after updating from vagrant v2.2.6 to v2.2.7 and from virtualbox v6.0.16 to v6.1.2. Applying the patch from #8878 (comment) did work around the issue, but I also tested moving back to virtualbox v6.0.16 and it worked again without needing the patch in Vagrantfiles. Platform: MacOS 10.14.6 |
Could be related to #11403 for anyone using Vagrant 2.2.7 with Virtualbox 6.1. A fix has been merged to master and will be included in the next release. |
any ETA for 2.2.8 ? |
Is there any workaround as long as we do not have a new release? |
@j3mdamas thanks! / I should have read it .. 🤦♂️ |
I've done some debugging on this and I've managed to get closer to a root cause. Note that I'm running vagrant v2.2.7 and virtualbox 6.1.6 on OSx. I've added the following code to my class VagrantPlugins::ProviderVirtualBox::Action::Network
alias_method :old_dhcp_server_matches_config?, :dhcp_server_matches_config?
def dhcp_server_matches_config?(dhcp_server, config)
p 'dhcp_server_matches_config?', dhcp_server, config
old_dhcp_server_matches_config?(dhcp_server, config)
end
alias_method :old_find_matching_dhcp_server, :find_matching_dhcp_server
def find_matching_dhcp_server(interface)
p 'find_matching_dhcp_server', interface
res = old_find_matching_dhcp_server(interface)
p res
res
end
end With this I get the following output:
It looks like the Here's how it's defined: vagrant/plugins/providers/virtualbox/action/network.rb Lines 538 to 548 in b886ec0
It clearly needs the When I dig a little deeper, it seems that the function responsible for finding the dhcp server settings ( Following the code leads me to the vagrant/plugins/providers/virtualbox/driver/version_6_1.rb Lines 14 to 35 in a10b2c3
I can't tell what the problem is by just looking at the code. When I run
It seems like the output is all there but the parsing of those fields fails somehow. I'd really like this to get fixed because I'm really not fond of the workaround proposed above. That workaround disables all sanity checking on the DHCP server and systematically re-uses the same DHCP server every time even tho they might conflict. |
There's actually a solution out! This was fixed in a10b2c3 which was released under v2.2.9 🎉 I upgraded my local version of vagrant to v2.2.9 and it's all fixed now. 🎉 |
@dotboris I am not sure that is 100% accurate. In my case the problem just manifested with Virtualbox Version 6.1.28 r147628 and Vagrant 2.2.19 |
I have the same configuration, but my Virtual Box Version 6.0.24 r139119 and Vagrant the same. |
If you specify the DHCP configuration in the Vagrantfile, i.e. matching the DHCP configuration of the config.vm.network "private_network", type: "dhcp", netmask: "255.255.0.0", name: "vboxnet3", dhcp_ip:"10.101.0.2", dhcp_lower: "10.101.4.3", :dhcp_upper=>"10.101.4.254" If you do not specify the |
Looks to be working for me, changing of course the values according to the ones from my VirtualBox > Tools |
Vagrant version
Vagrant 1.9.7
Host operating system
OSX 10.11.6
Guest operating system
Ubuntu 16.04
CentOS 7
Virtualbox version
5.1.26 r117224 (Qt5.6.2)
Vagrantfile
Debug output
https://gist.github.com/ggeldenhuis/ebfd3db970892a24f5bbff691d7e2e9d
Expected behavior
The expectation is that two network adaptors should be created in Virtualbox. The first should be attached to the NAT network and allow the machine out bound connectivity. The second adapter should be attached to the Host-Only adapter connected to the vboxnet1 network.
Actual behavior
I get an error:
A host only network interface you're attempting to configure via DHCP
already has a conflicting host only adapter with DHCP enabled. The
DHCP on this adapter is incompatible with the DHCP settings. Two
host only network interfaces are not allowed to overlap, and each
host only network interface can have only one DHCP server. Please
reconfigure your host only network or remove the virtual machine
using the other host only network.
Steps to reproduce
If you omit the name of the network vagrant will create a new vboxnet2 network and attach the adapter to that network.
Destroy the VM. Modify the vboxnet2 network to be a different range. Now specify the name as vboxnet2 and run vagrant up. The same error occurs.
It appears that vagrant does not like my custom networks and gives an error when I try to use them. If I don't modify the network then it all works fine.
I have been able to reproduce this with three different box files as shown in the config file above.
References
The text was updated successfully, but these errors were encountered: