Hello again. I've posted a queston on the Vagrant Community forum as well. 
The post actually has more details and steps that I've taken to try to 
resolve the issue. 

Vagrant Multiple VM's with Unique IP address on public_network using DHCP - 
Vagrant - HashiCorp Discuss 
<https://discuss.hashicorp.com/t/vagrant-multiple-vms-with-unique-ip-address-on-public-network-using-dhcp/36374>

On Tuesday, March 1, 2022 at 7:48:09 AM UTC-5 Michael Ascenzi wrote:

> 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/2940d327-e943-4a66-b9d2-1a5b16aca8c8n%40googlegroups.com.

Reply via email to