-
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
shield the guest from nameserver changes when using :hostonly networking #749
Conversation
…hostonly networking
@schisamo - what is the impact of this setting when using a VM with both NAT and Host-only adapters? |
@miketheman it does what I would consider to be "the right thing" and disables the DNS proxy: A
produces:
|
@miketheman This would require a NAT adapter. As you can see in the patch it looks like @schisamo is simply using the Vagrant assumption that there is a NAT adapter on NIC 1 to enable this. @schisamo I actually enable this on almost every VM I create, using The one negative thing I can think of is eventually I would like to get rid of Vagrant's reliance on NIC1 being a NAT adapter, and this code would be complicated to maintain backwards compatibility in that case, since then the driver would have to find the NAT adapter (if there is one) and enable it. Hm. I think I'm going to take a day or two to think over and see if I can think of any other negative effects of this... then I'll merge. |
@mitchellh thanks for the tip about using |
Okay! I think this makes sense to include as a default. I think you're right that where you put it isn't the best place for it. I think the best place for it may be as another middleware like |
@schisamo If you're still interested in this can you perhaps try to add this feature to the SaneDefaults middleware: https://github.com/mitchellh/vagrant/blob/master/lib/vagrant/action/vm/sane_defaults.rb I've started putting some opinionated defaults in there. :) |
I provisioned a VM at coworking today and the guest VM inherited the nameserver info from that network:
I went home where I expected this configuration:
VirtualBox ships with the ability to enable a DNS proxy in NAT mode to shield the guest VM from this issue. When this mode is enabled the guest VM receives this configuration:
10.0.2.3
is a DNS proxy that 'does the right thing'. We should probably enable by default when Vagrant has a network type:hostonly
. This commit does just that!