Thomas R.
Thomas R.

Reputation: 15

interface for private network not created when switching from v1 config to v2

in my v1 vagrant config I declared the networking like this.

config.vm.network :hostonly, "10.11.12.13", :netmask => "255.255.0.0"

Now I switched to v2 and tried the following versions:

config.vm.provider "virtualbox" do |vb|
   #1
   #vb.network :private_network, ip: "10.11.12.13", :netmask => "255.255.0.0"
   #2
   #vb.network :private_network, ip: "10.11.12.13"
   #3
   #vb.network :hostonly, ip: "10.11.12.13", :netmask => "255.255.0.0"
   #4
   vb.network :hostonly, ip: "10.11.12.13", netmask: "255.255.0.0"
end

But the Result is allways the same: the second networkinterface inside the Ubuntu Precise 64 is not created, so network connections fail. anyone knows a solution different than creating the interface manualy?

Thanks!

Upvotes: 1

Views: 1021

Answers (1)

Emyl
Emyl

Reputation: 10536

Network configuration should be put outside of the provider block:

config.vm.network :private_network, ip: "10.11.12.13"

config.vm.provider "virtualbox" do |vb|
...
end

Upvotes: 1

Related Questions