I thoughts that it might be a good idea to put a list of commands which are used to manage ESXi hosts. This list is certainly not a complete list, but I'd like to list some of those used often or the ones that are good to know for folks starting to learn virtualization technologies or folks who are not comfortable with ESXi CLI management just yet.
There are a variety of commands which are able to to do all you need. Changing network configs, changing time, manage local permissions,
Let's start with the basis. To connect to ESXi host via command line, one need to open SSH session. Note that by default the SSH service is disabled. To enable SSH open the vSphere client and Select your host > Configuration > Security Profile (under software) > Properties.
I'm sure you've seen this screen thousands times. New folks listen…
Note that you can also enable shell access via DCUI (direct connect user interface), via the console.
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 > On the left, Enable ESXi Shell changes to Disable ESXi Shell. On the right, ESXi Shell is Disabled changes to ESXi Shell is Enabled.
As for the SSH client, my preference goes to Putty, but it's not the only one SSH client out there… Just google for “ssh client”. I usually have a portable version of the putty client on a network share or rather on my Dropbox, so I can access it from anywhere. I remember there is also a Firefox extension, so there is many ways actually to get an SSH client onto your desktop/laptop station. I'm a Windows guy (concerning my management stations) so I have SSH client pretty much everywhere.
Let's get back to our commands lists for today's post. But before we do that let's have a look at the sbin directory which tools are available to manage the ESXi
You'll obtain a list of standard Linux tools and also a VMware specific, like the ones for esxcfg, esxtop or esxcfg-vmknic for vmkernel interfaces. For example the escfg-nics whic allows to get information on the nics gives you an output like this:
Ok, let's start start with some basic system commands.
this command gives you access deeper to the available namespace and shows you that there is more behind…
esxcli system shutdown
As you can see the power off or reboot via command line is really at your fingertips. Not difficult, right?
esxcli system version get
Gives you interesting information about patches and release version
Another useful command under the esxcli system might be this one:
Again, the available namespaces are displayed along….
And if we for example, enter the
esxcli storage nfs list
we'll obtain some nice details about our NFS mount and specifics like VAAI acceleration support !!
So that's the start. I'll try to add additional posts to this so we can see further, but you get the point. Type the command to see further options, and if you don't know what's the possibility of a command you can always type -h (help) to get more info on a command…
A small example of getting help:
esxcli storage nfs -h
As you can see, the CLI and VMware is not that difficult and while quite little is enough to learn your way through afterwards, CLI can get complex where you can script PowerCLI scripts to do action, to perform changes on large scale architectures. CLI is very powerful, but learning a bit here and there is the way to go for “non-scripting” folks… -:). Stay tuned for more.
More ESXi CLI commands: