In the VMware vSphere Web Client, you can see quite a bit of information about your VMs including information about the guest operating system running. You can see how many network adapters you’ve added and you can see the IP Addresses configured if you have the VMware tools installed. But there is some disconnect between the MAC Address, the IP Address, and the Network Adapter. How do you know which IP Address is assigned to which Network Adapter, and how do you get the MAC Address? Is there a way to get the VMware guest NIC info?
If you refuse to get with the times and you’re a crabby patty that loves the fat C# client…I’m right there with you. Still holding on to 6.0 and getting more depressed every day as the clock ticks ever closer to the EOL support for 6.0 and the forced upgrade to 6.5, thereby relinquishing your grasp on the days of old. I feel your pain, I really do.
Alright, if you’re using vSphere 6.0, you’ll have the option of checking in 2 places: the C# client and/or the web client. Don’t worry, both will leave you with almost what you need.
I can get the MAC Address per network adapter here:
And assuming I have VMware Tools installed on the guest, I can get the IP Addresses here:
But how do I know which MAC goes with which IP?
Of course, you can connect to the guest OS itself to verify this, but where’s the fun in that? Besides, imagine if you needed the information from several VMs, or what if you didn’t have console access/permissions to the VM? Let’s see how we can get this information using PowerCLI.
First, if you haven’t installed PowerCLI, you used to have to download it and install it and it was set up to launch a separate console which loaded the module…but my, how times have changed. Now, in the PowerShell Gallery, a young whippersnapper can simply use a couple of cmdlets to install the module from the Gallery:
I feel like saying something like, “back in my day…” but I’ll refrain. Once you have PowerCLI installed, let’s connect to our vCenter server (or ESXi host):
\\\Enter the Rabbit Hole
Once we’re connected, let’s hit up a VM…preferably a VM with more than one NIC. I’m pretty sure you can connect the dots with only 1 MAC and 1 IP to match…
I have a fantastic example of a VM with 6 NICs. Let’s dive into it with the Get-VM cmdlet.
By default, I’ll only be returned 4 columns formatted as a table. Let’s go farther (just like this Isuzu commercial from 1998) and format as a list to see what else we have for this VM:
Get-VM nameofVM | fl
Okay, that’s a bit more information to work with. I still don’t see the NIC info, but let’s drill down into the guest property and see what we find.
(Get-VM nameofVM).Guest | fl
Hmmm…The “Nics” property looks promising. Let’s continue our journey down the rabbit hole:
(Get-VM nameofVM).Guest.Nics | fl
Virtual gold mine! Hopefully your information isn’t blacked out like mine…but here is where we find the IP Address, MAC Address, and the Virtual Network of each Network Adapter and its status. With fantastic results like this, you’ll finally be able to move your server out of the bathroom and into a data closet in no time…