Ubuntu – Checking if two virtual machines are running on the same host

Ubuntuvirtual-machinesvmware-esxi

Is there a way to see if several Virtual Machines are running on the same host? Specifically, I have three VMWare VMs (each running a Ubuntu Server 14.04) and I have tried to compare different pieces of information:

  • dmidecode -s system-serial-number gives different results for each VM
  • lspci returns the same output for each VM
  • cat /proc/cpuinfo returns similar values for two of them and one has a completely different output (notably the "model name" line is different)

This doesn't help me to find determine which ones are running on the same host (if any).

Are there any other way to check?

Best Answer

It's not 100%, but there are some tricks you can try with networking...

If you can trace route to each VM, then look for them all to go through the same second-to-last hop. If that's the case, there's a decent chance they're on a common host.

Try pinging from VM to VM and from VM to default gateway. If the VM-to-VM times are the same and ≤ the VM-to-defgw times, then there's a high probability that they're on the same machine. (Look at the minimum time across lots of pings for best results).

If you know more about the actual network topology from backbone -> host -> guest then you may be able to glean additional insight from network tools.

You can also try looking at the MAC addresses on the VMs for some clues.