--> -->

Locating VMware VMs by IP or MAC Address

In a VMware vSphere environment, you can run a large number of virtual machines (VMs) on ESXi hosts. Sometimes you may need to find an IP address of a certain VM when you know the VM’s name or identify a VM name when you know an IP address. One common situation is when you have remote access to a guest operating system via SSH or RDP and know the IP address, but you don’t know the VM’s name. However, you need to know the VM’s name to find the VM on an ESXi host and edit VM settings, migrate the VM to another ESXi host, or run VM backup on the host level. These operations are performed on the vSphere side and cannot be done in a guest operating system. You may also need to identify one of the MAC addresses of a virtual network adapter used by a VM. This blog post explains how to find a VM’s IP or MAC address and how to identify a VM’s name when you have an IP or MAC address.

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. 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. 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. Click View all N IP addresses to display all of the IP addresses used by the VM. 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. Click here to read how to install VMware Tools on different guest operating systems.

How to find the IP address of a virtual machine in VMware

Checking a MAC Address in vSphere Client

A VM’s MAC address can be used for network diagnostics and other purposes. 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. 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 address checking in VMware network settings

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. 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.

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.

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.

How to find the IP address of a virtual machine in VMware Host Client

Checking a VM MAC Address in VMware Host Client

To check a VM’s MAC address in VMware Host Client, select the VM as you would when checking the IP address. Scroll down the page to the Hardware Configuration section in the web interface. 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 is displayed in VMware Host Client

Note: In this example, I use an ESXi host managed by vCenter Server, but I’m 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.

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

In my case, I connect to the ESXi host managed by vCenter Server with the command:

Connect-VIServer 10.10.10.74 -User root

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 by IP address in PowerCLI

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.

Define the IP address of the VM to be identified:

$vmIP="192.168.17.137"

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])}}|ft

Identifying the name of a VM when only the IP address is known

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 by using the pattern for IP addresses

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.

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

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 if you know only the virtual machine MAC address in PowerCLI

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"; done

How to identify the VM name if you know the virtual machine MAC address in ESXi CLI

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

This blog post covered how to identify VMware IP addresses and VMware MAC addresses if you know a VM’s name and vice versa. 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 NAKIVO Backup & Replication for VMware backup for reliable and affordable VM data protection. In addition to VM backup, NAKIVO Backup & Replication supports physical server backup, database backup, and Microsoft 365 backup. Download the Free Edition of NAKIVO Backup & Replication and install the product in your infrastructure.

Locating VMware VMs by IP or MAC Address
Rate this post