Using Vagrant With Proxy

 ·  · 

Setting up vagrant to use proxy.

 

1. Installation

Install vagrant-proxyconf plugin.

$ vagrant plugin install vagrant-proxyconf --plugin-source http://rubygems.org

If you meet a Bundler error with above command, make sure your http_proxy environment variable has been exported correctly.

$ export http_proxy=http://user:[email protected]_proxy_host:port

Then you can execute following command instead.

$ vagrant plugin install vagrant-proxyconf --plugin-source http://rubygems.org

 

2. Configuration

Edit Vagrantfile:

$ vim Vagrantfile

Add configuration lines below:

# file: Vagrantfile

Vagrant.configure("2") do |config|
  if Vagrant.has_plugin?("vagrant-proxyconf")
    config.proxy.http     = "http://your_proxy_server:port"
    config.proxy.https    = "http://your_proxy_server:port"
    config.proxy.no_proxy = "localhost,127.0.0.1,site_want_to_access_directly.com"
  end
end