Sunday, July 12, 2009

How to Change the ESX Host IP Address

Use PUTTY to telnet to server
login as root

To change the IP address, do the following
Delete the current IP setting: esxcfg-vswif –d vswif0
Add the new IP address for interface vswif0:
esxcfg-vswif –a vswif0 -p Service\ Console -i 192.x.x.x -n 255.255.252.0 –b 192.x.x.255
The ‘\’ between service and console is required.

After the change, type in esxcfg-vswif –l to verify that the change was applied

If the default gateway needs to change, edit /etc/sysconfig/network. Use VI or your favorite editor to accomplish this.
Example using VI:
Type vi /etc/sysconfig/network
Press the letter i to put vi into ‘insert’ mode
Use the arrows on the keyboard to navigate to the GATEWAY and make the change.
To save the change, press ESC then colon :, then w then q
ESC :wq
To exist without saving, press ESC, then colon :, then q
ESC :q

Restart networking
Execute /etc/init.d/networking restart

Other tasks
Update the IP address in DNS
Remove and re-add the host to Virtual Center

Thursday, July 9, 2009

How to Start all the VMs on a Host from the Command Line

vmware-cmd -l | while read vmxpath; do vmware-cmd $vmxpath start;done

Wednesday, July 8, 2009

How to remove snapshots for all VMs on a Host

From the ESX console, run the following command

vmware-cmd -l | while read vmxpath; do vmware-cmd $vmxpath removesnapshots;done

This gets a list of the VMS, for each item returned, pass in the path through the variable $vmxpath and run the removesnapshots command.