Simply  Seth
Simply Seth

Reputation: 3496

Vagrant Virtualbox Override Default Network Interface

I would like to override "Adapter 1" and change it from the default NAT to Bridged.

This is MacOSX using VirtualBox

My feckless attempt is below:

NODE_COUNT = 5
NODE_COUNT.times do |i|
    node_id = "mes00#{i += 1}"
    config.vm.define node_id do |node|

    # $network_interface could either be en0 or en1 depending in which is up
    node.vm.network :public_network,  :type => "dhcp",:bridge =>     $network_interface,:interface => 1
    node.vm.network :private_network, :ip => "192.168.0.1#{i}",:interface => 2
    node.vm.box = "ubuntu/trusty64"
    node.vm.hostname = "#{node_id}"
  end
end

The output shows:

==> mes004: Preparing network interfaces based on configuration...        
mes004: Adapter 1: nat
mes004: Adapter 2: bridged
mes004: Adapter 3: hostonly

Upvotes: 1

Views: 610

Answers (1)

kikitux
kikitux

Reputation: 64

as for vagrant, the first nic always will be nat. is by design.

If you share what issue you face, probably are workarounds for all of them.

Upvotes: 1

Related Questions