1

What's the right way to configure multiple network interfaces with Vagrant? Here's the simple Vagrant file I'm testing with:

.

Vagrant.configure("2") do |config|

  config.vm.provider :virtualbox do |vb|
    # vb.gui = true
    vb.memory = 512
    vb.cpus = 1
  end

  config.vm.define "consumer" do |c|
    c.vm.box = "vagrant-centos6.2-x64"
    c.vm.network :private_network, ip: "192.168.100.12"
    c.vm.network :private_network, ip: "172.16.100.12"
    c.vm.hostname = "consumer.XXXXXX.XXX"
  end
end

.

This behaves inconsistently. The 2 private_network interfaces always come up as eth1 and eth2 with distinct MAC's but sometimes both interfaces are assigned the same IP, sometimes neither is assigned an IP address, and sometimes it works correctly.

I'm using CentOS 6 on both the desktop and virtual image and VirtualBox 4.1. Is there a better way to accomplish this? Thanks!

2
  • 1
    Upgrade your virtualbox version as the network drivers have been greatly improved since 4.1 Mar 18, 2014 at 10:51
  • 1
    Upgraded to 4.3. Fixed. My thanks to you both.
    – anon
    Mar 18, 2014 at 23:21

1 Answer 1

3

That configuration looks perfectly valid. Maybe it's the oldish VirtualBox version. Could you try upgrading it to the latest 4.2.x or 4.3.y?

Otherwise, a gist/pastebin of full --debug log of an incorrect Vagrant invocation and the contents of /etc/sysconfig/network-scripts/ifcfg-eth* could help.