Question

Can anyone explain why I am getting the following error

"Vagrant: Network type 'bridged' is invalid. Please use a valid network type."

when I try to bring vagrant up on Virtual Box with the following Vagrantfile

# -*- mode: ruby -*-    
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.hostname = "gitserver"
  config.berkshelf.enabled = true
  config.vm.box = "centos57"
  config.vm.box_url = "http://xx.xx.xx.xx/os/centos-5.7-x86_64.box"
  config.vm.network :bridged, :bridge => 'eth0'

  # Provision VM using chef
  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = "cookbooks"
    chef.add_recipe "mysqlserver"
  end

  config.vm.customize ["modifyvm", :id, "--memory", 1024]
end

I have tried all possible combinations with bridged configuration, but it simply does not like it. I cannot find any additional info as to why. Any help here would be hugely appreciated.

Was it helpful?

Solution

Since you are using a Vagrant config file version 2 (and therefore Vagrant 1.1+) instead of :bridge there is now the new type :public_network.

OTHER TIPS

To use v1 code, you can insert it into a config 1 block like this:

Vagrant.configure("1") do |config|
    config.vm.network :bridged, :bridge => 'eth0'
end

For Vagrant 1.3.5 in used the following:

config.vm.network :public_network, bridge: "en0: Wi-Fi (AirPort)"

It worked for me.

I am installing vagrant on ubuntu 10.04 with Virtualbox VirtualBox 4.1.24 from https://www.virtualbox.org/wiki/Linux_Downloads and then downloaded recent version of vagrant.

$ vagrant -v
Vagrant version 1.2.2

$ dpkg -l virtualbox*
ii  virtualbox-4.1 4.1.26-84997~U Oracle VM VirtualBox

In order to use bridge network and specifically wifi i just added the line below inside Vagrantfile

 config.vm.network :public_network, :public_network => "wlan0"

When you will do

 $ vagrant up

You will see option asking for device for bridge interface you can use 1 for wlan0. Hope it helps.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top