Assign a unique static MAC address to virtual machine
search cancel

Assign a unique static MAC address to virtual machine

book

Article ID: 421912

calendar_today

Updated On:

Products

VMware vCenter Server

Issue/Introduction

Duplicate IP address usage can result in the same IP address resolving to different MAC addresses as both NICs respond to the ARP request. This article provides best practices for assigning a unique MAC address to a Virtual machine vNIC.

Environment

VMware vCenter Server 7.x
VMware vCenter Server 8.x

Resolution

To assign a unique static MAC address to virtual machine:

  1. Ensure that the virtual machine is powered off.
  2. In the vSphere Client inventory, right-click the virtual machine and click Edit Settings.
  3. Click the Hardware tab and select the virtual network adapter for the virtual machine.
  4. Under MAC Address, click Manual and enter a unique MAC address.
    Execute the following command at a BASH prompt on vCenter Server to verify the MAC  address is unique.

    /opt/vmware/vpostgres/current/bin/psql -h localhost -U postgres -d VCDB -c "select e.name as vm_name, n.mac_address as mac_address, e.id as vm_id, v.file_name as vm_file, h.dns_name as esxi_name, h.ip_address as esxi_ip from vpx_entity e, vpx_vm v, vpx_host h, vpx_nic n where e.id=(select entity_id from vpx_nic where mac_address='00:50:56:xx:yy:zz') and v.id=e.id and v.id=n.entity_id and v.host_id=h.id;"

  5. Click OK.
  6. Restart the VMware vCenter Server service, Stop, Start or Restart Services on vCenter Server 7.x/8.x

    service-control --stop --all && service-control --start --all

Alternatively, force vCenter to generate a new MAC address for the virtual network adapter by configuring the virtual network adapter to use a Manual MAC address and then reconfiguring it to Automatic.

Additional Information

If the virtual machine is in production and cannot be shut down to make the configuration changes:

  1. Verify and record the static IP address from virtual machine for the vNIC experiencing the issue.
  2. Remove that virtual network adapter containing the duplicate MAC address from the virtual machine.
  3. Add a new virtual network adapter for the virtual machine.
  4. Apply the recorded static IP address to the newly installed virtual network adapter.
  5. Check the network settings within the guest operating system and verify the connectivity.