Sharing host VPN with Vagrant - Rob Allen


When moving a project into Vagrant, I realized that I needed the vagrant guest to share my OS X's VPN.

I'm using a separate IP address within a private network like this: :private_network, ip: ""
So, after some Googling, I added this provider configuration setting:
  config.vm.provider :virtualbox do |vb|
      vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
and now my VM is sending data over the VPN. Note that this will not work when using the Vagrant's public_network setting though.


These settings are the default for puphpet, BUT if you setup a public_network interface it will not work.

Resources -- quoted here.

Here is an example of how to add public_network only when you need it... 
➜ IP='public' vagrant status
added to Vagrantfile

Vagrant.configure("2") do |config|

  # IP='public' vagrant status
  if ENV['IP'] == "public"
      puts("[info] PUBLIC interface added") "public_network", :mac => "4CA3AB1EBBB1"

Popular Posts