Exploring management options for an ESXi server in a home/lab environment.
- It's so fucking rad that ESXi free doesn't provide a web interface. /sarcasm
- Having a dedicated Windows VM for ESXi management is suck.
- Running vSphere Client in Wine/Crossover requires hacks to install and doesn't work correctly.
- How much does it cost to get a license for a lab environment?
- Can we use the DCUI (Direct Console User Interface) without a license? (Answer: YES, via a directly console, over SSH, but we can only do very basic things)
- Can we use the CLI/SDK/API tools? (Answer: PARTIALLY, Without a license it's locked down to read-only)
- Can we SSH to the bare-metal host and use command line tools for manaagement? (Answer: YES, but we have to enable SSH)
TL;DR: Even the cheapest license (vSphere Server Essentials) is expensive for a home lab. This only includes server essentials for 1 user. :/
-
Base Price: USD 495.00
-
Required support: USD 65.00/year
-
vSphere Essentials Kits are for small businesses and combine virtualization for up to three physical servers with centralized management with vCenter for Essentials
-
This kit includes 6 CPU licenses of vSphere Essentials (for 3 servers with up to 2 processors each) and 1 license for vCenter Server Essentials.
- vSphere ESXi Hypervisor (3x)
- vCenter Server Essentials (1x)
- vCenter Operations Manager Foundation (1x)
TL;DR: Without a license, the CLI & API tools are read-only. However, the DCUI is unlocked, even in the free version.
- PowerCLI - vSphere PowerCLI: Windows PowerShell interface for managing vSphere.
- vSphere CLI - vCLI allows you to run commands against VMware ESXi systems over the wire.
- vSphere API - The vSphere API is exposed as a Web service.
- vSphere DCUI(Direct Console User Interface)
vCLI, PowerCLI, and vSphere SDK for Perl are limited to read-only access for the free vSphere Hypervisor edition. To enable full functionality > iof vCLI on a VMware ESXi host, the host must be licensed with vSphere Essentials, vSphere Essential Plus, vSphere Standard, vSphere Advanced, vSphere Enterprise, or vSphere Enterprise Plus.
-- source
TL;DR: We can access the DCUI over SSH without a license, but we have to enable SSH access first. We only perform very basic management functions through DCUI.
DCUI Management:
- Change root password
- Configure NIC Hardware
- COnfigure NIC Vlans
- Configure NIC IP/IPv6
- Configure VLANs
- Configure DNS & DNS Suffixes
Access over SSH:
- Enable SSH access
ssh root@$ESXI_HOST
export TERM=linux
dcui
- Use Fn-F2 to login
- Use Ctrl-c to exit
- Access the ESXi Direct Console User Interface (DCUI) over SSH
- DCUI via SSH
- Viewing ESXi Logs From the DCUI
TL;DR: We can perform remote management via the shell environment on the host, but first we must enable SSH access. Not sure yet if these get locked down when trial ends. I think they don't, because it appears that the free (fat) client uses them.
Enabling from the DCUI:
- Access the direct console of the ESXi host, press F2, and provide credentials when prompted.
- Scroll to Troubleshooting Options, and press Enter.
- Select Enable ESXi Shell and press Enter.
Enabling SSH from the vSphere Client:
- Select the host, click the Configuration tab, and click Security Profile in the Software panel.
- In the Services section, click Properties.
- Select ESXi Shell and click Options.
- Change the ESXi Shell options.
- Click 'Start' button.
- Check 'Start and stop with host'.
The documentation on the internal commands is not readily available, so it takes some searching & testing to figure out how to use them.
Command | Alias | Description |
---|---|---|
/bin/chkconfig [-l] | Shows daemons running on hypervisor. Can also be used for configuration. | |
/bin/dcui | N/A | Provides console screen to ssh session |
/bin/esxcfg-advcfg | N/A | N/A |
/bin/esxcfg-dumppart | ||
/bin/esxcfg-fcoe | ||
/bin/esxcfg-hwiscsi | ||
/bin/esxcfg-info | ||
/bin/esxcfg-init | ||
/bin/esxcfg-ipsec | ||
/bin/esxcfg-mpath | ||
/bin/esxcfg-nics | ||
/bin/esxcfg-route | ||
/bin/esxcfg-module | ||
/bin/esxcfg-nas | ||
/bin/esxcfg-resgrp | ||
/bin/esxcfg-rescan | ||
/bin/esxcfg-scsidevs | ||
/bin/esxcfg-swiscsi | ||
/bin/esxcfg-vmknic | ||
/bin/esxcfg-vswitch | ||
/bin/esxcfg-volume | ||
/bin/esxcli | /bin/esxcli.py | |
/bin/esxhpcli | ||
/bin/esxhpedit | ||
/bin/esxtop | Same as linux top for vmware | |
/bin/esxupdate | ||
/bin/vim-cmd | /bin/hostd | |
/bin/vmkload_mod [-l] | List loaded kernel modules | |
/bin/vsish | Vmware interactive shell | |
/usr/lib/vmware/esxcli |
Command | Description |
---|---|
vim-cmd vmsvc/getallvms | List all VMs registered to this host (This reveals the Vmid needed for other commands) |
vim-cmd vmsvc/get.config $VMID | Get Summary for a Specific VM |
vim-cmd vmsvc/get.guest $VMID | Get Configuration for a Specific VM |
vim-cmd vmsvc/register $VMXPATH | Register a VM |
vim-cmd vmsvc/unregister $VMID | Unregister a VM |
vim-cmd vmsvc/power.getstate $VMID | Get power state of a VM |
vim-cmd vmsvc/power.on $VMID | Power on a VM |
vim-cmd vmsvc/power.off $VMID | Power off a VM (hard) |
vim-cmd vmsvc/power.shutdown 30 | Shutdown a Specific VM (soft) |
vim-cmd vmsvc/power.reboot $VMID | Reboots vmid referenced from getallvms command |
vim-cmd vmsvc/destroy $VMID | Deletes the vmdk and vmx files from disk |
vim-cmd vmsvc/get.snapshot $VMID | List a Specific VM’s Snapshots |
vim-cmd vmsvc/tools.install $VMID | Install VMware Tools for VM with ID |
vim-cmd hostsvc/net/info | Provides information about hypervisor networking |
vim-cmd hostsvc/maintenance_mode_exit | Takes hypervisor out of maintenance mode |
vim-cmd hostsvc/maintenance_mode_enter | Puts hypervisor into maintenance mode |
vim-cmd hostsvc/enable_esx_shell | Enable ESXi Shell |
vim-cmd hostsvc/disable_esx_shell | Disable ESXi Shell |
vim-cmd hostsvc/start_esx_shell | Start ESXi Shell |
vim-cmd hostsvc/enable_ssh | Enable the ssh daemon |
vim-cmd hostsvc/start_ssh | Start ssh daemon |
vim-cmd hostsvc/disable_ssh | Disable ssh daemon |
vim-cmd hostsvc/datastore/rename OldName NewName | Rename a datastore |
vim-cmd hostsvc/advopt/update DCUI.Access string root,william,tuan | control which local users have full admin privileges to the DCUI |
Command | Description |
---|---|
esxcli network ip route ipv4/ipv6 | VMkernel routes |
esxcli network ip interface tag (tag VMkernel traffic types) | |
esxcli storage core path list | Get a list of all storage pathes |
esxcli storage core path list -d naa.600000e00d11000000111a2400000000 | Get storage pathes for a specific drive |
esxcli storage filesystem list | Get a list of all storage devices |
esxcli storage nmp device list | Show Storage Array Type and Path selection policies of disk devices |
esxcli system settings advanced list | Get all |
esxcli system settings advanced set -o /UserVars/SuppressShellWarning -i 1 | Set one, i.e. disable the shell respectively ssh warnings |
esxcli system settings advanced set -o /UserVars/ESXiShellInteractiveTimeOut -i 3600 | shell session will automatically logout based on configured idle time (in seconds) |
esxcli system maintenanceMode set -e true -t 0 | enter maintenance mode |
esxcli system maintenanceMode (maintenance mode) | |
esxcli system snmp (SNMP) |
Command | Description |
---|---|
esxcfg-info | Lists a LOT of information about the esx host |
esxcfg-module -q | Get a list of all enabled kernel modules |
esxcfg-module -g lpfc820 | Get parameters of a kernel modul, i.e. an Emulex FC HBA module |
esxcfg-module -i lpfc820 | Get info of a module with all possible parameters and a description of each |
esxcfg-nics -l | Lists information about NIC's. Can also be used for configuration. |
esxcfg-vswitch -l | Lists information about virtual switching. Can also be used for configuration. |
esxcli vms vm list ( esxcli vm process list) - lists VM and the world id, you can kill, send NMI mask using vm-support command.(esxcli vm process kill ,
vm-support -V, vm-support -x ,vm-support -X - captures screenshot,etc.,
vmdumper vmdumper: [options]
vim-cmd vmsvc/device.getdevices $id|egrep -i "vmdk|compat" vim-cmd vmsvc/get.datastores 35 vim-cmd vmsvc/device.diskaddexisting vim-cmd hostsvc/datastore/summary datastore2 vim-cmd hostsvc/refresh_services vim-cmd vmsvc/message
To find the ip addresses allocated
for vm in vim-cmd vmsvc/getallvms | awk '{print $1}'|grep -v -i vmid
; do
vim-cmd vmsvc/get.summary $vm |grep -i ipAdd
done
References:
- The Architecture of VMware ESXi
- ESXi Commandline Work
- ESXi & SSH - What's Next
- Robert Chase - VMware ESXi SSH CLI Command
- VMware ESXi vim-cmd Command: A Quick Tutorial
- Powerful Hacks With ESXi vim-cmd Command, Together With Shell Commands
- Hidden esxcli Command Output Formats You Probably Don’t Know
- What’s New In ESXCLI 5.1: 82 New esxcli commands
- How to Use vim-cmd to Power on vSphere VMs without Windows or the vSphere Client
- How to Create New User in ESXi With Shell Script
- Run esxcli Command in a Web Browser: Another ESXi Hack
- VMWare Remote SSH with Expect
Some helpful resources.
- A list of free vmware-vsphere toolsl
- VSphereLand - Free Tools
- VMWareArena - 101 Free Tools for VMware Administrators
- pyvmomi - Python SDK for the VMware vSphere API that allows you to manage ESX, ESXi, and vCenter.
- pyvmomi-community-samples - Community contributed samples for the pyVmomi library.
- pyvmomi-tools - Incubator project for additional pyVmomi based tools and libraries as needed by the development community.
- pyvsphere - Python API for interaction with the vSphere Web Services SDK.
- esxi-tools - A collection of Python tools and scripts to automate the management of a remote ESXi host.
- esxi-util - python scripts to operate ESXi server.
- py-vconnector - VMware vSphere Connector Module for Python.
- django-vsphere - django-vsphere is an app for Django to have a centralized dashboard for all your VMWare vSphere ESXi.
- vEMan - Manage ESX servers natively from Linux desktop.
- esxi-simple-web - Basic controls for esxi host in the browser.
- ESXi-PoC-Client - C++ client to communicate with ESXi Web-service and dump virtual machines information.
- pi-control - Control & monitor ESXi hypervisor from raspberry-pi.
- suseviclient - Lightweight tool for ESXi management from Linux box.
- vmmng - Simple, yet effective, VMWare ESXi comand line wrapper written in Ruby.
- RVC - Ruby vSphere Console - Linux console UI for vSphere, built on the RbVmomi bindings to the vSphere API.
Good write up, thanks for sharing.