How can I tell if I'm running in a VMWARE virtual machine (from linux)?
Asked Answered
T

5

10

I have a VMWARE ESX server. I have Redhat VMs running on that server. I need a way of programatically testing if I'm running in a VM. Ideally, I'd like to know how to do this from Perl.

Tollmann answered 12/2, 2009 at 11:25 Comment(0)
S
7

See the answer to "Detect virtualized OS from an application?".

Saval answered 12/2, 2009 at 11:53 Comment(0)
Q
4

You shouldn't 100% depend on any method, as they are undocumented features/bugs - they work on some host OSes and some virtualization solutions, but there is no guarantee that they will continue working; indeed, the whole point of virtualization is to be as undistinguishable from real metal as possible. With this in mind, the blue pill red pill (which is mentioned in the accepted answer to this similar question) seems to work ... for now.

Quite answered 12/2, 2009 at 11:26 Comment(0)
K
3

VMWare has a couple of SDK's, including an SDK for Perl.

Kaleidoscope answered 12/2, 2009 at 11:55 Comment(0)
F
2

I think (depending on the version of esx) you can inspect at the MAC address of the NIC. VMs running in VMWare NIC will have a manufacturer string assigned to VMWare, no the physical NIC MAC. (We were trying to spoof the MAC to VM a license server and newer versions won't let you do it.) Also, this won't guarantee you aren't running on a physical box with a NIC spoofed to look like VMWare, but that would be an odd thing to do in most circumstances anyway.

Fruition answered 12/2, 2009 at 12:48 Comment(2)
Virtualbox lets you enter any MAC you wantHydroid
I would assume that you can change it in ESX. It's a very useful feature if you are trying to run licenced apps in a VMHydroid
A
2

Run the following command:

lspci | grep VMware

It should show something like this:

00:0f.0 VGA compatible controller: VMware SVGA II Adapter

00:11.0 PCI bridge: VMware PCI bridge (rev 02)

00:15.0 PCI bridge: VMware PCI Express Root Port (rev 01)

Auriferous answered 26/6, 2013 at 17:28 Comment(1)
I see the VMware VGA controller even for VirtualBox (on Windows with Ubuntu guest).Properly

© 2022 - 2024 — McMap. All rights reserved.