Posts

Showing posts with the label MAC Address

Finding VMs with Duplicate MAC Addresses

At one of my customers' sites today, I saw an error message that I've not seen before: VM MAC Conflict.  "Well, that's certainly not good," I thought, as I poked around at the error message.  To my chagrin, I could only find that error message for a single VM in the environment, and that error message wouldn't tell me with which other VM it was conflicting.  So, I could only think of one way to figure out what was going on with this conflict: look at the MAC Address assigned to every NIC on every VM in the environment, and figure out what was causing the conflict.  Easy! No, really, it was easy.  Had I done it by hand, I would certainly have driven myself crazy, but PowerCLI made it nice and easy.  I just used this command: (get-vm | get-networkadapter | ? {$_.MacAddress -eq "<offending MAC Address>").parent Lo-and-behold, it returned 2 VMs.  One was the known VM that had flagged the error and the other was a powered-off VM.  Maybe tha...

Finding a Specific MAC Address in vCenter

One of my customers found that they had an IP conflict on their network, but the network team was unavailable.  They asked me if I could help them track down the address, while waiting for help from the network team.  I don’t have nearly as much visibility into the environment as a network admin, but vCenter is aware of the vast majority of the servers in the environment and it has data about what MAC Address each one is using.  Of course, that data is buried under “Edit Settings” on each VM and, when you have thousands of VMs to look through, doing that process by hand would be a staggering effort.  So, I scripted it. This is a really simple script that takes a single parameter –MacAddress.  That address should be specified in colon separated format (like 00:50:56:00:00:01) and it accepts wildcards (so *00:01 is a fine search query).  The script first searches all VMs for the specified MAC Address, then moves on and searches all of the VMKernel interface...

Finding a VM with a Particular MAC Address

One of my customers was recently troubleshooting a network issue and had tracked it down to a single VMware MAC Address.  They tasked me with finding that VM that had that MAC address assigned, which is not a simple process through the GUI.  Fortunately, it's a very easy problem to solve with a script, and so PowerCLI to the rescue. All that I did with this script was get all of the VMs from vCenter, then loop through each one getting all of their NICs.  I then compared the MAC of that NIC against the MAC that the customer had identified, and we very swiftly had identified the problem VM. $MacOfInterest = "00:50:56:7b:00:00" $allVMs = Get-VM foreach ($thisVM in $allVMs) { foreach ($thisAdapter in ($thisVM | Get-NetworkAdapter)) { if ($thisAdapter.MacAddress -eq $MacOfInterest) { echo $thisVM.name } } }