Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Configure Vagrant VM to use Host DNS for VPN
Vagrant::Config.run do |config|
# ...
config.vm.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
@abtris

This comment has been minimized.

Copy link

@abtris abtris commented Feb 17, 2012

how it possiblem in new vagrant configure this "config.vm.customize now takes an array of arguments" ? Thx

@fingermark

This comment has been minimized.

Copy link

@fingermark fingermark commented Feb 25, 2012

Same question

@mitchellh

This comment has been minimized.

Copy link
Owner Author

@mitchellh mitchellh commented Feb 25, 2012

I updated the gist to be accurate again :)

@jbrown

This comment has been minimized.

Copy link

@jbrown jbrown commented Sep 14, 2012

Is this still accurate for the latest version of Vagrant? Doesn't seem to work for me...

@Alexandervn

This comment has been minimized.

Copy link

@Alexandervn Alexandervn commented Oct 19, 2012

Thanks a lot!

Worked perfect for me on Ubuntu 12.10 host with Ubuntu 12.04 guest.

@marcgibbons

This comment has been minimized.

Copy link

@marcgibbons marcgibbons commented Jan 24, 2013

Very nice

@patcon

This comment has been minimized.

Copy link

@patcon patcon commented Jan 29, 2013

Worked perfect on ubuntu lucid

@JerryPreissler

This comment has been minimized.

Copy link

@JerryPreissler JerryPreissler commented Jan 29, 2013

Worked with the Lucid Box for Vagrant running on Quantal. Thanks a lot.

@adamdicarlo

This comment has been minimized.

Copy link

@adamdicarlo adamdicarlo commented Feb 15, 2013

Hmm, what does this solve exactly? My issue is that my vagrant NFS shares don't work when my host is logged into a VPN because it captures all network traffic...

@ichilton

This comment has been minimized.

Copy link

@ichilton ichilton commented Mar 4, 2013

Does this have any performance impact?

@apinstein

This comment has been minimized.

Copy link

@apinstein apinstein commented Mar 21, 2013

after I do this and halt/up, vagrant no longer works. The machine will still boot, and the DNS is fast again, but there are no vagrant shared folders and provision fails due to nothing in /vagrant.

Any idea?

@eikonomega

This comment has been minimized.

Copy link

@eikonomega eikonomega commented Apr 4, 2013

I found that this syntax didn't work as expected on V1.1.5
Here the replacement that worked for me.

config.vm.provider :virtualbox do |vb|
    vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
@awsiv

This comment has been minimized.

Copy link

@awsiv awsiv commented Jun 3, 2013

@eikonomega: thanks!

This also works with v1.2

@foton

This comment has been minimized.

Copy link

@foton foton commented Jan 31, 2014

Yes, this make it work on Ubuntu 13.10.

@danmayer

This comment has been minimized.

Copy link

@danmayer danmayer commented Feb 5, 2014

This fixes DNS lookup but host is still unreachable from within the VM, anyone have a tip for that?

@AnalogJ

This comment has been minimized.

Copy link

@AnalogJ AnalogJ commented Jul 7, 2014

Does this fix work for Vagrant + VMWare + VPN's as well?

@mattgray

This comment has been minimized.

Copy link

@mattgray mattgray commented Dec 23, 2014

Hi, I had the same problem trying to configure host DNS resolver so that I can resolve addresses from a private DNS server over a VPN, except using Test Kitchen instead of plain Vagrant. This gist configures the the test kitchen vagrant driver in the same way as above gist, except in the .kitchen.yaml syntax : https://gist.github.com/mattgray/0a72e8d61a5ca115c406

@rafaelrp

This comment has been minimized.

Copy link

@rafaelrp rafaelrp commented Mar 24, 2015

Worked in homestead/vagrant 1.6.3 with Ubuntu 14.10

=]

@ducminhvu

This comment has been minimized.

Copy link

@ducminhvu ducminhvu commented Sep 7, 2018

work like a charm thanks

@GTP95

This comment has been minimized.

Copy link

@GTP95 GTP95 commented Jul 2, 2021

Unfortunately, this seems to not be working anymore, got the following error while trying to destroy my previous VM:
`There are errors in the configuration of this machine. Please fix
the following errors and try again:

vm:

  • The following settings shouldn't exist: customize
    `
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment