Thursday, November 18, 2010

Just a few VMware ESX commands

The power of the command line interface

ESX 4X Commands to make life easier:

Dealing with physical nics:
esxcfg-nics -l                                                                                                              
List available network cards
esxcfg-nics -s 100 -d full vmnic2                                                                           
Set card to full duplex, 100mbits
esxcfg-nics -a vmnic2                                                                                              
Set card to autonegociate

Dealing with virtual switches:
esxcfg-vswitch -l                                                                                                          
list all available virtual switches
esxcfg-vswitch -a vSwitch1                                                                                       
create a new virtual switch
esxcfg-vswitch -A "My VMs" vSwitch1                                                                  
add a port group to a vswitch
esxcfg-vswitch -L vmnic1 vSwitch1                                                                         
associate a nic to a switch
esxcfg-vswitch -U vmnic1 vSwitch1                                                                         
remove a nic from a switch
esxcfg-vswitch -d vSwitch1                                                                                         
remove a virtual switch

Dealing with routing:
esxcfg-route -l                                                                                                                
list the routing table
esxcfg-route 10.28.1.1                                                                                                  
set the gateway
esxcfg-route -a default 255.0.0.0 10.28.1.2                                                              
add a gateway

Dealing with the nfs server:
esxcfg-nas -l                                                                                                                    
list nfs mounts
esxcfg-nas -a -o 10.28.1.50 -s /test01 nfs01                                                                  
mount /test01 from an nfs server r/w and label the datastore nfs01
esxcfg-nas -a -o 10.28.1.50 -s /test02 nfs02 -y
mount a second nfs share read only
 esxcfg-nas -d nfs01
unmount the nfs01 datastore
Dealing with the firewall:
esxcfg-firewall -q                                                                                                           
query the firewall
esxcfg-firewall -e ntpClient                                                                                          
enable ntp service
esxcfg-firewall -d ntpClient                                                                                          
disable ntp service
esxcfg-firewall -allowIncoming                                                                                   
open all incoming ports
esxcfg-firewall -blockIncoming                                                                                   
block all incoming ports
esxcfg-firewall -allowOutgoing                                                                                   
open all outgoing ports
esxcfg-firewall -blockOutgoing                                                                                   
block all outgoing ports

Dealing with storage:
esxcfg-rescan                                                                                                                   
find newly added storag/rescan hbas

Dealing with the service console:
esxcfg-vswif -i 10.28.1.1 -n 255.255.255.0 vswif0                                                  
set the ip address of the service console
esxcfg-vswif -a vswif0 -p “Service Console” -i 10.28.1.2 -n 255.255.255.0       
add a service console

Dealing with vmkernel ports:
esxcfg-vmknic -a “VM Kernel” -i 10.28.1.10 -n 255.255.255.0                            
add the vmkernel nic and give ip

Dealing with iSCSI:

esxcfg-swiscsi -q

query the software initiator
esxcfg-swiscsi -e
enable the software initiator
esxcfg-swiscsi -d 
disable the software initiator

Dealing with the esxcli command:
esxcli swiscsi nic add -n vmk0 -d vmhba35
bind the vmkernel port to a particular hba
esxcli swiscsi nic list -d vmhba35
list bindings
esxcli nmp psp list
list available multipathing options










                                                 



No comments:

Post a Comment