Locating VMware VMs by IP or MAC Address

In a large VMware vSphere infrastructure, you may only know a VM’s IP address and need the name or vice versa. For example, you may have the IP address with remote access to a guest OS via SSH or Remote Desktop Protocol (RDP) but need the name of the VM to locate that VM on an ESXi host for configuration, migration, or backup. You can complete these operations with vSphere but not with a guest OS.

Also, you may need to identify a MAC address of a virtual network adapter that a VM uses. In this blog post, we explain how to find the IP or MAC address of a virtual machine and how to discover a VM’s name when you know the IP or MAC address.

NAKIVO for VMware vSphere Backup

NAKIVO for VMware vSphere Backup

Complete data protection for VMware vSphere VMs and instant recovery options. Secure backup targets onsite, offsite and in the cloud. Anti-ransomware features.

Checking an IP Address in VMware vSphere Client

The most straightforward way to check a VM’s IP address in VMware vSphere is to use VMware vSphere Client.

  1. In a web browser, enter the IP address of your vCenter Server in the address bar, open vSphere Client, and enter your credentials to log in.
  2. Go to Hosts and Clusters, select the needed VM by name and check the Summary tab. The VMware IP addresses of the virtual machine are displayed in the IP addresses section. One VM can have multiple virtual network adapters and multiple IP addresses.
  3. Click View all N IP addresses to display all of the IP addresses used by the VM.
  4. In the screenshot below, you can see one IPv4 and one IPv6 address used by a VMware VM. VMware Tools must be installed on a guest operating system (OS) to view IP addresses in the web interface of VMware vSphere Client. The VM must be powered on.
    How To Find IP Address Of Virtual Machine

Checking a MAC Address in vSphere Client

A VM’s MAC address can be used for network diagnostics and other purposes.

  1. In order to check the MAC address, right-click the VM’s name in the Navigator pane of VMware vSphere Client, and in the context menu, click Edit Settings.
  2. In the Virtual Hardware tab of the Edit Settings window, click the name of the network adapter to check the MAC address of the virtual network adapter used by the VM.VMware vSphere Client MAC

Checking a VM’s IP address in VMware Host Client

If you’re using a standalone ESXi host without VMware vCenter, you cannot use VMware vSphere Client to manage the virtual environment. This occurs when you use ESXi Free Edition on a server. In this situation, you can use VMware Host Client to manage an ESXi host in a web interface.

  1. Enter the IP address of your ESXi host in the address bar of your web browser and enter an ESXi administrator account username and password.
  2. In the Navigator pane, click Virtual Machines and select the VM with the IP address that needs to be identified. As with identifying the VMware IP address of a VM in vSphere Client, the VM must be started and VMware Tools must be installed on the guest operating system.
  3. On the page with the VM information, locate the section with General information and click Networking to expand the pane and view the IP addresses used by the VM.

Checking a VM MAC Address in VMware Host Client

  1. To check a VM’s MAC address in VMware Host Client, select the VM as you would when checking the IP address.
  2. Scroll down the page to the Hardware Configuration section in the web interface.
  3. Click the VM network adapter needed to expand options and find the MAC address of the corresponding virtual network adapter.The VMware Virtual Machine MAC Address

Note: In this example, we use an ESXi host managed by vCenter Server, but we are logged into VMware Host Client. The VMs were created in vCenter.

VM search in VMware vSphere enables you to find a VM by name but not by IP address or MAC address.

Identifying the VM Name by IP Address

You can identify the VM name if you know the IP address by using vSphere PowerCLI.

  1. Connect to an ESXi host or vCenter and enter the username and password for the administrative account:
    Connect-VIServer ESXi_or_vCenter_IP -User root
  2. In our case, we connect to the ESXi host managed by vCenter Server with the command:
    Connect-VIServer 10.10.10.74 -User root
  3. The simplest command to display a VM that has the defined IP address is:
    Get-VM * |where-object{$_.Guest.IPAddress -match “192.168.17.137”}

    Where 192.168.17.137 is the IP address of the VM to be identified.Detecting A VM name

There is another method to identify a VM name if you know the IP address of a VM in PowerCLI. In this case, you should run two commands.

  1. Define the IP address of the VM to be identified:
    $vmIP=”192.168.17.137″
  2. Get information about the VM:
    Get-VM * |where-object{$_.Guest.IPAddress -eq $vmIP}|select Name, VMHost, PowerState,GuestId,@{N=”IP Address”;E={@($_.guest.IPAddress[0])}}|ftIdentifying The Name Of A VM
  3. If you know part of the IP address, you can display all VMs with IP addresses that match the search pattern.
    $vmIP=”192.168.”

    Get-VM * |where-object{$_.Guest.IPAddress -match $vmIP}|select Name, VMHost, PowerState,@{N=”IP Address”;E={@($_.guest.IPAddress[0])}} ,@{N=”OS”;E={$_.Guest.OSFullName}},@{N=”Hostname”;E={$_.Guest.HostName}}|ft
    The Command To Display VM Names
  4. Here is a command to get a list of all VMs on a host or cluster and show IP addresses where it is possible:
    Get-VM | Select Name, @{N=”IP Address”;E={@($_.guest.IPAddress[0])}}

The disadvantage of this method is that sometimes the IP address is only displayed partially.

  • There is also a command to view all VMs in a cluster (the cluster name contains the “cluster” string) and display IP addresses where possible:
    Get-Cluster “*cluster*” | Get-VM | Select Name, Host, @{N=”IP Address”;E={@($_.guest.IPAddress[0])}} 

    Change [0] to [1] if you want to display the second IP address. You can delete these characters from the command to see the difference in the displayed results.

Identifying the VM Name by MAC Address

You can also use VMware PowerCLI to identify a VM name if you know a VM’s MAC address.

  1. Connect to an ESXi host or vCenter in VMware PowerCLI. In my example, I connect to the ESXi host mentioned in the previous example:
    Connect-VIServer 10.10.10.74 -User root
  2. Define the virtual machine MAC address and find the name of this VM:
    $vmMAC=”00:50:56:84:C4:5F”

    Get-VM | Get-NetworkAdapter | Where-Object {$_.MacAddress -eq $vmMAC } | Select-Object Parent,Name,MacAddress
    How To Identify The VM Name
  3. You can connect to the ESXi host via SSH and use the ESXi command line interface) to identify a VM name by its virtual machine MAC address.
    find /vmfs/volumes | grep .vmx$ | while read i; do grep -i “00:50:56:84:C4:5F” “$i” && echo “$i”; doneHow To Identify The VM Name ESXi

Virtual Machine MAC Addresses in VMware Environments

MAC addresses are not assigned randomly. The first half of a MAC address is usually associated with the appropriate hardware or software manufacturer.

MAC addresses starting with 00:50:56 are VMware MAC addresses that belong to VMware virtual machines, as can be seen in my previous examples when we identified MAC addresses of VMware VMs.

There are four assignments for VMware MAC addresses: 00:50:56, 00:0C:29, 00:05:69, 00:1C:14. Let’s look at some common categories of VMware MAC address ranges:

  • 00:50:56 – VMware Workstation, VMware vSphere, VMware ESXi server
  • 00:50:56:80:00:00 – 00:50:56:BF:FF:FF – vCenter, VMware vSphere VMs managed by vCenter
  • 00:0C:29 – Standalone ESXi hosts, VMware Horizon, VMware Workstation
  • 00:05:69 – VMware ESXi, VMware GSX
  • 00:1C:14 – VMware

Organization Unique Identifiers (OUI) are used as prefixes for VMware MAC addresses according to the VMware OUI allocation scheme. VMware vCenter and ESXi hosts use different prefixes for MAC addresses to avoid conflicts of MAC addresses in situations where a host is not connected to vCenter Server but can be connected to vCenter later. If an ESXi host is managed by vCenter, then vCenter generates VMware vSphere MAC addresses for VMware VMs.

When a MAC address to a VM is set manually (in VM settings), the prefix (first three octets) is preserved automatically. The second half of the MAC address can be customized.

If you want to set a MAC address for a VMware VM manually, use this template:

00:50:56:XX:YY:ZZ

  • The recommended hexadecimal value instead of XX is a number between 00 and 3F.
  • The valid numbers for the YY and ZZ fields are in the range between 00 and FF (the full range).

Using these recommendations helps you avoid conflicts between MAC addresses you have set manually with those VMware MAC addresses generated automatically by VMware vCenter and MAC addresses assigned to VMkernel adapters. Note that the maximum value for a VMware MAC address that can be set manually is 00:50:56:3F:FF:FF if the 00:50:56 prefix (OUI) is used. This approach can also help identify manually and automatically assigned VMware MAC addresses. Don’t forget that all MAC addresses in the network must be unique.

vCenter Unique ID calculation

Let’s explore other aspects of identifying a MAC address of VMware vCenter.

As explained above, a MAC address for vCenter is assigned from the range (00:50:56:80:00:00 – 00:50:56:BF:FF:FF) in the 00:50:56:XX:YY:ZZ format.

In this case, the XX value is calculated based on the vCenter unique ID.

XX=80+vCenterID

If you know the MAC address of vCenter, you can calculate the vCenter Server Unique ID (can be 0 to 63).

Let’s look at an example when we have vCenter Server deployed as a VM which network interface has a VMware MAC address:

00:50:56:9B:48:55

Subtract 80 from 9B (hexadecimal). You can use the HEX calculator.

0x9B – 0x80 = 0x1B

Convert the HEX value to a decimal value:

0x1B = 27

vCenter Unique ID is 27 in this case.

VMware MAC addresses for VMs on standalone hosts

Now let’s look at an example of MAC address generation for VMs on a standalone ESXi host to see how VM MAC addresses are generated on a standalone ESXi host and understand the generation principle. The last six characters of the VM universally unique identifier (UUID) are used to fill the three last octets of the VMware MAC address of the VM. First three octets of a VMware MAC address for a VM created on a standalone ESXi host are 00:0C:29.

On the screenshot below, you can see a VM with the parameters:

MAC address: 00:0C:29:B0:3E:1D

VM name: Windows-VM

The MAC address format for a VM created on a standalone ESXi host

Let’s check the VM UUID and compare the last characters of the UUID and VM MAC address.

You can check the UUID of a VM with this command in PowerCLI:

Get-VM Windows-VM | %{(Get-View $_.Id).config.uuid}

In our case the UUID is 564df9a2-261e-869e-5a1d-d118abb03e1d

and the MAC address is 00:0C:29:B0:3E:1D

As you can see, the rule works.

Checking the principle of VMware MAC address generation on a standalone ESXi host

Conclusion

You can check a MAC address and IP address of a VM in the graphical user interface of VMware vSphere Client and VMware Host Client. As an alternative, use the ESXi command line or PowerCLI to detect a MAC address of a VM if you know the VM’s name. You can also use VMware PowerCLI to identify a VM name if you know a VM’s IP or MAC address. Knowing the principles of assigning VMware MAC addresses to virtual machines and other machines in a VMware virtual infrastructure can help you identify VMware-related machines from other devices in the network when checking MAC addresses of connected devices.

Don’t forget to back up your VMs running in VMware vSphere. Use reliable VMware ESXi backup software like NAKIVO Backup & Replication for robust data protection. The solution supports VM backups, physical server backup, database backup, and Microsoft 365 backup.

1 Year of Free Data Protection: NAKIVO Backup & Replication

1 Year of Free Data Protection: NAKIVO Backup & Replication

Deploy in 2 minutes and protect virtual, cloud, physical and SaaS data. Backup, replication, instant recovery options.

People also read