Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   CentOS (http://www.linux-archive.org/centos/)
-   -   How to detect whether running on VMware? (http://www.linux-archive.org/centos/130794-how-detect-whether-running-vmware.html)

07-24-2008 11:47 AM

How to detect whether running on VMware?
 
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@softins.co.uk - http://www.softins.co.uk
Play: tony@mountifield.org - http://tony.mountifield.org
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Paul Bijnens 07-24-2008 12:03 PM

How to detect whether running on VMware?
 
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



_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Marc-Andre Levesque 07-24-2008 12:08 PM

How to detect whether running on VMware?
 
-----Original Message-----
From: centos-bounces@centos.org [mailto:centos-bounces@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
>Tony

This 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
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

Ned Slider 07-24-2008 12:14 PM

How to detect whether running on VMware?
 
Marc-Andre Levesque wrote:


-----Original Message-----
From: centos-bounces@centos.org [mailto:centos-bounces@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
Tony


This 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


Alternatively, grep the output from dmidecode for VMware:

dmidecode | grep VMware

You'll get output from VMware Server, I've not tested with other VMware
products.


_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos

"Marko A. Jennings" 07-24-2008 01:02 PM

How to detect whether running on VMware?
 
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.
_______________________________________________
CentOS mailing list
CentOS@centos.org
http://lists.centos.org/mailman/listinfo/centos


All times are GMT. The time now is 07:57 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.