VMware ESX Hacks

 

Sniffing Virtual Machines

tcpdump

TCPDUMP ist nicht per default beim ESX Server dabei, aber auf der ESX Server-CD gibt es im Pfad <CDROM>/RPMS die ganzen Tools.

Einfach tcpdump-xyz.rpm mit

rpm -ihv tcpdump-xyz.rpm

installieren.

Aktivieren von Sniffing

For sniffing all traffic on the vmnic0 (you can substitute this for a bond0, etc.)

# echo "PromiscuousAllowed yes" > /proc/vmware/net/vmnic0/config
# insmod vmxnet_console devName="vmnic0" nameMask="test"

Then bring the device up:
# ifconfig test up

Start the tcpdump
# tcpdump -i test -w <path&filename_of_capture_file>

To read the file:
# tcpdump -r <path&filename_of_capture_file>

Somit sieht man den gesammten Traffic von der VM die am Interface vmnic0 dran hängt.

Promiscuous Mode aktiv nach Reboot

Bei einem Reboot vom ESX Server bleibt die Einstellung des Promiscuous Modes nicht erhalten.

Das folgende am Ende von /etc/rc.local einfügen:

echo "PromiscuousAllowed yes" > /proc/vmware/ net/[vmnic0]/config
insmod vmxnet_console devName="vmnic0" nameMask="test"

Somit bleibt die Einstellung auch nach dem Reboot aktiv.

ESX nur mit einer Netzwerkkarte

Das Ziel ist es die Virtual Machines Netzwerk Interfaces auf die “Service Console” zu binden, somit kann ein ESX mit nur einer Netzwerkkarte betrieben werden. Sie “Service Console” ist sozusagen das Management Interface vom ESX.

Das folgende sind die Schritte um beide Interfaces “zusammenzuführen”:

/etc/modules.conf

Edit /etc/modules.conf und kommentiere folgendes aus:

alias eth0 e100

zu

# alias eth0 e100

vmkpcidivy -i

Mit dem Tool vmxpcidviy -i kann nun das Physische Interface den VM zugeordnet werden:

[root@SRVESX07-LAB root]# vmkpcidivy -i

Checking for existing VMnix Boot Configurations.

The following VMnix kernel images are defined on your system:

Boot image configuration: esx
  Image file: /boot/vmlinuz-2.4.9-vmnix2
  Memory: 192M
  Service Console devices:
    SCSI storage controller: Symbios Logic Inc. (formerly NCR) LSI Logic Fusion MPT 53C1030 (rev 07) (shared)
  VM devices:
    Ethernet controller: BROADCOM Corporation NetXtreme BCM5721 Gigabit Ethernet (rev 11)
    SCSI storage controller: Symbios Logic Inc. (formerly NCR) LSI Logic Fusion MPT 53C1030 (rev 07) (shared)

Type in the name of the boot image configuration you wish to configure
or type "new" to create a new image [esx]: 

Selected configuration was 'esx'.

Configuring your setup.  Enter in the options that you want.  Defaults have
been provided.

Name of this configuration [esx]: 

Now allocating memory to the Service Console.  The memory that is not allocated
to the Service Console will be allocated to the VMs.  Be sure to indicate a
number smaller than you actually have on your system or you may not be able to
run any VMs.

Your system is reporting approximately 2,559 MB of memory.
Note: you cannot allocate more than 800 MB to the Service Console.

If you plan to run 4 virtual machines or fewer, 128 MB should suffice.
Set this to 192 MB for 8 virtual machines, 272 MB for 16 virtual
machines, 384 MB for 32 virtual machines, or 512 MB for more than
32 virtual machines.

Amount of memory (in megs) to allocate to the Service Console [192]:
Enable hyperthreading? (Only works with 8 or less physical processors) [y]: 

Now to divide the SCSI controllers and network adapters.  In this process,
you will select whether to give the previous devices to the Service Console or
the virtual machines that you will be running.  In order to ensure optimal
performance for your virtual machines, we suggest you allocate as many devices
as possible to the virtual machines, leaving only the ones necessary to
configure and maintain the Service Console.

Type 'c' to allocate to the Service Console or 'v' to allocate to the virtual
machines, or 's' to share between both.

Ethernet controller BROADCOM Corporation NetXtreme BCM5721 Gigabit Ethernet (rev 11) running on bus 5 device 0 function 0 (bcm5700.o) [vmnic0]  [c]: v
.
.
.

Wichtig ist das der Kontroller auf “v” (virtual machines) gestellt ist.

/etc/rc.local

Wen der ESX rebootet ist kein Netzwerk Adapter assigned zur Service Console, folgendermassen kann diesm nun beim booten aktiviert werden:

Eintrag am Ende im /etc/rc.local

insmod vmxnet_console devName="vmnic0"
ifup eth0

VM Config

Nun kann für die Virtual Machines im Mgmt-Webinterface das physische Interface den VM zugewiesen werden!

This entry was posted in Software, VMware. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.