VMware Cloud Community
dax2
Contributor
Contributor

How do I find out the IP for a given MAC address in esxi-shell

How do I find out the IP for a given MAC address in esxi-shell ?

esxcli network ip neighbor list
does not list the MAC addresses I need to resolve

Reply
0 Kudos
4 Replies
vmroyale
Immortal
Immortal

What MAC addresses are you trying to resolve?

Brian Atkinson | vExpert | VMTN Moderator | Author of "VCP5-DCV VMware Certified Professional-Data Center Virtualization on vSphere 5.5 Study Guide: VCP-550" | @vmroyale | http://vmroyale.com
Reply
0 Kudos
dax2
Contributor
Contributor

I am logged in to an ESXi host.
I want to find out which other ESXi hosts also have access to the VMFS volumes in /vmfs/volumes/*

for i in $(df -h | grep VMFS | cut -d% -f2)
do
vmkfstools --activehosts "$i" | grep MAC | cut -ds -f3,4
done

gives me a list of MAC-addresses.
Now I need to resolv that list into a list of IP-addresses

Reply
0 Kudos
sparrowangelste
Virtuoso
Virtuoso

Try this: it susing powercli

$IPaddresses = @()

Get-VMHost | Get-VMHostNetworkAdapter -VMKernel | %{
    $row = "" | Select Name, IP, MAC
    $row.Name = $_.VMHost.Name
    $row.IP = $_.IP
    $row.MAC = $_.MAC
    $IPaddresses += $row
}

$IPaddresses | Export-csv "C:\ipreport.csv" -NoTypeInformation -UseCulture

its from this thread

http://communities.vmware.com/thread/335736

then use excel to comapre the macs

--------------------- Sparrowangelstechnology : Vmware lover http://sparrowangelstechnology.blogspot.com
Reply
0 Kudos
dax2
Contributor
Contributor

Thanks for the code - but powershell does not help me here.
I have to do this while logged into an ESXi.

So I can only use commands available in esxi-shell

Reply
0 Kudos