VMware ESXi

From Dave-Wiki
(Redirected from ESXi)

Summary

ESXi (Elastic Sky X Integrated) is a hypervisor developed by VMware that is used to create and manage virtual machines (VMs) in a virtualized environment. It is part of VMware's vSphere suite of products and is a foundational component for running virtualized workloads in both small and large-scale enterprise data centers.

General

VMDK Commands

Shrink a Thin VMDK

ls –lh *.vmdk
du -h *.vmdk
vmkfstools --punchzero vm.vmdk
du -h *.vmdk

ovftool

You can install this tool on your local machine (e.g., Windows) and use it to remotely move powered-down VMs from one ESXi to another or to your local machine as an .ovf file, etc.

Get Info About A VM

.\ovftool vi://10.144.30.134/plex

Export VM from ESXi to a Local Windows PC

.\ovftool.exe vi://<src-esxi-ip>/<src-vm-name> "C:\Downloads\<ovffile>.ovf"

Import VM from a Local Windows PC to ESXi

.\ovftool.exe -ds=<dest-datastore> -dm=thin -n=<dest-vm-name> --net:"<src-network1>"="<dest-network1>" --net:"<src-network2>"="<dest-network2>" "C:\Downloads\<ovffile>.ovf" vi://<dest-esxi-ip>

Export Directly From ESXi to ESXi

ovftool -ds=<dest-datastore> -dm=thin -n=<dest-vm-name> --net:"<src-network>"="<dest-network>" vi://<src-esxi-ip>/<src-vm-name> vi://<dest-esxi-ip>

SNMP

Enable SNMP on an ESXi Host

esxcli system snmp get
esxcli system snmp set --communities public,eastnoc,westnoc
esxcli system snmp set --enable true

Active Directory

Unjoin a Domain

/opt/likewise/bin/domainjoin-cli query
sso-config.sh -get_identity_sources
sso-config.sh -delete_identity_source -i lambnet.us

SSL

ESXi Host

SSH into the ESXi Host.

In the directory /etc/vmware/ssl, back up the rui.crt and rui.key files.

Replace the contents of rui.crt with your new certificate and rui.key with your new private key.

Restart the management server by executing these two commands:

/etc/init.d/hostd restart
/etc/init.d/vpxa restart

vCenter Server

SCP your .crt, .key, and ca.crt files to the VCSA server.

SSH into the VCSA shell.

Execute /usr/lib/vmware-vmca/bin/certificate-manager

Choose 1. Replace Machine SSL certificate with Custom Certificate

Provide valid SSO and VC privileged user credential, as requested.

Choose 2. Import custom certificate(s) and key(s) to replace existing Machine SSL certificate

Follow the on-screen instructions to provide paths to the files you uploaded:

   Please provide valid custom certificate for Machine SSL.
   File : /root/vm.crt
   Please provide valid custom key for Machine SSL.
   File : /root/vm.key
   Please provide the signing certificate of the Machine SSL certificate
   File : /root/lambnet-ca-ec.crt

WebGUI services will restart (this will take a few minutes, but will not impact any running VMs).