Find vmware guest using the MAC Address on ESX

With traditional networking, using switches arp tables it always was pretty simple to find a server using only the mac address.

However, with VMWare things changed a little. Virtual Switches dont provide the same level of functionality as current physical switches (unless you spend lots of money)

As far as I know basic VMWare switches dont have a command to tell you the arp table and the associated hosts / port.

So what can you do if you get for example an IP address conflict where you only know the mac address of the conflicting host?

Well, I found a superb script which interrogates an ESX host and lists the guest name, alongside the MAC address.

Its as follows – for ease create a shell script and paste the below in.

When you run it you will get output like this:

win2k8server2.vmx
 /vmfs/volumes/49a2845c-2b4514f9-09bc-001f295db10d/win2k8server2/win2k8server2.vmx
displayName = “win2k8server2”
ethernet0.generatedAddress = “00:50:56:97:20:dd”

win2k8server1.vmx
 /vmfs/volumes/49ae5e8c-bb3c9818-e2dd-001d295db10d/win2k8server1/win2k8server1.vmx
displayName = “win2k8server1”
ethernet0.generatedAddress = “00:50:56:97:31:98”

Script as follows

——————————-

#!/bin/bash

for COUNT in $(vmware-cmd -l); do
echo `echo $COUNT|awk -F’/’ ‘{print $6}’`
echo ” “`echo $COUNT`
echo ” “`cat $COUNT|grep “displayName”`
#MAC Address may refer to “Address” instead of “generatedAddress”
echo ” “`cat $COUNT|grep “generatedAddress”`
echo
done

 

————————

You can follow any responses to this entry through the RSS 2.0 feed.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This blog is kept spam free by WP-SpamFree.