How to enable internet access inside Vagrant?

If you are using Vagrant + VirtualBox + Ubuntu, you might want to add the following block to your VagrantFile:

config.vm.provider "virtualbox" do |v|
    v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
    v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end

If you are using ubuntu, and you think your firewall is on, here’s how you turn off the firewall:

sudo ufw disable

Leave a Comment