Does anyone know how a program, script or shell user can best determine whether the machine is running on bare metal or is a VMware guest? Cheers Tony -- Tony Mountifield Work: tony at softins.co.uk - http://www.softins.co.uk Play: tony at mountifield.org - http://tony.mountifield.org
Tony Mountifield wrote:> Does anyone know how a program, script or shell user can best determine > whether the machine is running on bare metal or is a VMware guest? > >This paper show some very interesting tricks: http://handlers.sans.org/tliston/ThwartingVM*Detection*_Liston_Skoudis.pdf One simple (but not really foolproof, and only for VMWare) is testing the MAC address, and look at the OUI bytes; these are assigned to VMWare: 00-05-69 00-0C-29 00-1C-14 00-50-56
Marc-Andre Levesque
2008-Jul-24 12:08 UTC
[CentOS] How to detect whether running on VMware?
-----Original Message----- From: centos-bounces at centos.org [mailto:centos-bounces at centos.org] On Behalf Of Tony Mountifield>Does anyone know how a program, script or shell user can best determine >whether the machine is running on bare metal or is a VMware guest? > >Cheers >TonyThis script does the trick for me on ESX 3 by looking at the (virtual) hardware description. But it probably is not foolproof. if ( `/sbin/lspci | grep -qi vmware` ) || \ ( `grep -qi vmware /proc/scsi/scsi` ); then echo "This is a Virtual Machine." Fi Marc-Andre
On Thu, July 24, 2008 7:47 am, Tony Mountifield wrote:> Does anyone know how a program, script or shell user can best determine > whether the machine is running on bare metal or is a VMware guest?dmidecode | grep -iq " vmware " This returns 0 if it is a VMware system and 1 it it isn't.
Tony Mountifield
2008-Jul-24 13:39 UTC
[CentOS] Re: How to detect whether running on VMware?
In article <g69q3o$f9v$1 at softins.clara.co.uk>, Tony Mountifield <tony at softins.clara.co.uk> wrote:> Does anyone know how a program, script or shell user can best determine > whether the machine is running on bare metal or is a VMware guest?Thanks for the responses. Grepping for VMware in /proc/scsi/scsi or the output from dmidecode look to be the most reliable options. Cheers Tony -- Tony Mountifield Work: tony at softins.co.uk - http://www.softins.co.uk Play: tony at mountifield.org - http://tony.mountifield.org
> Does anyone know how a program, script or shell user can best determine > whether the machine is running on bare metal or is a VMware guest? > ># dmidecode | grep Product Product Name: VMware Virtual Platform
Tony Mountifield wrote on Thu, 24 Jul 2008 11:47:04 +0000 (UTC):> Does anyone know how a program, script or shell user can best determine > whether the machine is running on bare metal or is a VMware guest?AFAIK, VMWare uses vmnet32 drivers for ethernet and possibly others for other devices as well. Kai -- Kai Sch?tzl, Berlin, Germany Get your web at Conactive Internet Services: http://www.conactive.com
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Tony Mountifield wrote: | Does anyone know how a program, script or shell user can best determine | whether the machine is running on bare metal or is a VMware guest? | Obviously from the responses many people have a solution... my question is "Why do you care?". What is it that you would do (or not do) on a vmware guest that you might do on bare metal? - -- Milton Calnek BSc, A/Slt(Ret.) milton at calnek.com 306-717-8737 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with CentOS - http://enigmail.mozdev.org iD8DBQFIiKvKHgnbf2T2QqMRAtn9AKCtBZ4c+8d06WtNALiaXGMKDjAUAACfaMHd Vxm3Gh7osNG0QRc7pG7MsHw=/Mzo -----END PGP SIGNATURE----- -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.