Change IP Address for VMware ESXI Host from Command Line

We can use the the built in esxcli command to change the IP address for a server

First we need to get the interface name. We can get the info with the following command.

esxcli network ip interface ipv4 get
Name  IPv4 Address   IPv4 Netmas   IPv4 Broadcast  Address Type  DHCP DNS 
----  ------------  -------------  --------------  ------------  -------- 
vmk0  192.168.0.4   255.255.255.0  192.168.0.0     STATIC           false

The text in bold is our interface name.

Set the interface to pull DHCP

The following command will set the interface to use DHCP. If your interface name is different, then you will want to change that.

esxcli network ip interface ipv4 set -i vmk0 -t dhcp

Set a static IP

We can set a static IP address with the following command. Change the IP and Subnet for the appropriate IP address and Subnet.

esxcli network ip interface ipv4 set -i -I IP -N Subnet vmk0 -t static

Changes take affect immediately so you’ll need to re ssh into the server.

http://virtuallystable.com/2019/08/14/how-to-change-the-ip-address-of-an-esxi-host-via-esx-cli/

VMware ESXI “Disk capacity is greater then the amount available in the datastore”

The following error appears to be some sort of bug in the Web Interface for VMware. Work around is to download the vSphere client and make the changes through there.
vsphereclient.vmware.com/vsphereclient/VMware-viclient-all-6.0.0.exe

“The disk capacity specified is greater than the amount available in the datastore. Disk space overcommitment can consume all space in the virtual disk and block the virtual machine. Increase the datastore capacity before proceeding or enter a smaller disk size.”

VMware esxtop, looking for CPU performance issues

http://www.yellow-bricks.com/esxtop/#esxtop-thresholds has some guidance on thresholds for different metrics.

Run esxtop, hit the “c” key to view CPU info and compare the usage with the thresholds.

Here are few from the above link.

Metric Threshold
%RDY 10
%CSTP 3
%MLMTD 0

Note: if your in esxtop you can hit the “f” key and it’ll give you a menu to specify more fields to display.

esxtop not displaying properly and is not interactive

Ran into an issue where esxtop was basically displaying a bunch of CSV data that was hard to make sense of in a terminal.

From reading here https://kb.vmware.com/s/article/2001448

It appears that the issue is that the environment TERM variable is not specified.

echo $TERM

returns nothing.

To fix, specify the terminal to use

TERM=xterm

To get a list of terminals available, run the following

find /usr/share/terminfo -type f

Setup SNMPv3 on ESXI VMware server

SSH into the VMware server

ssh root@vmwareserver

Set the auth and priv types

esxcli system snmp set -a MD5 -x AES128

Generate hashes

The hashes are needed to create the user.  Replace authpass and privhash to the password you want.

esxcli system snmp hash --auth-hash authpass --priv-hash privhash --raw-secret

Create user 

Replace authhash and privhash with the auth and priv hashes returned from the above command.

esxcli system snmp set -e yes -C contact@incredigeek.com -u snmpuser/authhash/privhash/priv

 

Single line Command

Change authpassword and privpassword to your authentication and private passwords.

authpass="authpassword" && privpass="privpassword" && esxcli system snmp set -a MD5 -x AES128 && esxcli system snmp hash --auth-hash ${authpass} --priv-hash ${privpass} --raw-secret && esxcli system snmp set -e yes -C ${contact} -u snmpuser/${authhash}/${privhash}/priv

 

View SNMP Configuration

esxcli system snmp get