Hello, 

I'm attempting to spin up multiple VM's utilizing Vagrant. However, no 
matter the number of VM's they all share the same MAC address and IP 
address. I need all VM's to be able to communicate with each other over 
sockets, and thus need to have unique IP's. 

I could assign them static addresses, which I'm doing temporarily as a 
short-term fix, but I need the DHCP to assign addresses for the VM's.

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


$veh = 1
$vehCount = 2

$vehList ={}


while $veh <= $vehCount do
  $vehList["veh#{$veh}"] = "525400" + Array.new(6){[*"A".."F", 
*"0".."9"].sample}.join
  $veh+=1
end

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

  $vehList.each do |vehName, macADDR|

    $name = vehName
    $mac = macADDR

    config.vm.define vehName do |vmConfig|

      vmConfig.vm.box = "dcop"
      # dcop.vm.base_mac = nil
      
      vmConfig.vm.network "public_network", bridge: "eno1", :mac => macADDR 
    end
  end
end

Through my reading, I've come across some saying its because its using the 
same MAC address, so i updated the Vagrantfile to generate a random MAC, 
and assigned it to the VM. But even with different MAC they are still 
assigning the same IP for each VM. 

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/hashicorp/vagrant/issues
Discuss: https://discuss.hashicorp.com/c/vagrant/24
--- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vagrant-up+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/03ee26e4-ff9f-47ea-8782-b9c477fb1d8fn%40googlegroups.com.

Reply via email to