Configure the Vagrant virtual machine to use a specific proxy using the vagrant-proxyconf plugin.
Install vagrant-proxyconf
plugin.
$ vagrant plugin install vagrant-proxyconf
Installing the 'vagrant-proxyconf' plugin. This can take a few minutes... Fetching vagrant-libvirt-0.1.2.gem Fetching vagrant-proxyconf-2.0.10.gem Parsing documentation for vagrant-libvirt-0.1.2 Installing ri documentation for vagrant-libvirt-0.1.2 Parsing documentation for vagrant-scp-0.1.0 Parsing documentation for vagrant-proxyconf-2.0.10 Installing ri documentation for vagrant-proxyconf-2.0.10 Done installing documentation for vagrant-libvirt, vagrant-scp, vagrant-proxyconf after 0 seconds Successfully uninstalled fog-core-1.43.0
List installed plugins.
$ vagrant plugin list
vagrant-libvirt (0.0.45, system) vagrant-proxyconf (2.0.10, global) vagrant-scp (0.1.0, global)
Use this plugin to define proxy inside Vagrantfile
.
# -*- mode: ruby -*- # vi: set ft=ruby : Vagrant.configure("2") do |config| if Vagrant.has_plugin?("vagrant-proxyconf") config.proxy.http = "http://192.168.0.1:3128/" config.proxy.https = "http://192.168.0.1:3128/" config.proxy.no_proxy = "localhost,127.0.0.1,.example.org" end config.vm.box = "debian/buster64" config.vm.provider "virtualbox" do |vb| vb.memory = "1024" end config.vm.provision "shell", inline: <<-SHELL apt-get update apt-get install -y apache2 SHELL end
Alternatively, use environment variables.
$ VAGRANT_HTTP_PROXY="http://192.168.0.1:3128/" vagrant up