5 Replies Latest reply on Nov 8, 2019 11:59 AM by Amin Masoudifard

    Static MAC Address Automation

    Shocko Enthusiast

      Guys, I have a use case where I would like assign static MAC addresses to systems. Looking at this is it indicating that MAC addresses are assigned from the DataCentre level ? Ideally I'd like to create a pool of MACS for a cluster to avoid potential overlap.

        • 1. Re: Static MAC Address Automation
          Amin Masoudifard Expert

          Generally, MAC address assigning is handled via two methods:

          1. ESXi host that generates them with prefix scheme of 00:0c:29

          2. vCenter Server that generates with prefix scheme of 00:50:56 to prevent MAC Address duplication problem (that you have mentioned in your question)

          So when you let the vCenter handle this issue, there is no need to worry about it ...

          Please mark my comment as the Correct Answer if this solution resolved your problem
          • 2. Re: Static MAC Address Automation
            Shocko Enthusiast

            But I wish to script creation of VMS with static MACs so i can create DHCP reservations for them. Can I request a MAC from vCentre? I guess I could allow vCentre assign the MAC then grab it from the VM and assign it back to it as static,.

            • 3. Re: Static MAC Address Automation
              scott28tt Guru
              Community WarriorsUser ModeratorsVMware Employees

              Moderator: Moved to PowerCLI

              • 4. Re: Static MAC Address Automation
                LucD Guru
                Community WarriorsUser ModeratorsvExpert

                After you do a New-VM, the vNIC will get a MAC from vCenter.

                Once the VM is created, and before powering it on, you can retrieve the assigned MAC with something like this.
                Then create your DHCP reservation.

                When the VM is powered on, it will get the assigned IP from DHCP

                 

                 

                $mac = Get-NetworkAdapter -VM $vm | Select -ExpandProperty MacAddress

                Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                • 5. Re: Static MAC Address Automation
                  Amin Masoudifard Expert

                  Regardless of assigning methods of MAC address to VMs, you need to execute second part manually: Adding the leased IP address to the reservation list!

                  Please mark my comment as the Correct Answer if this solution resolved your problem