View number of virtual machines on host and location:
# vmware-cmd -l
Start a virtual machine:
# vmware-cmd ubuntu start
Stop a virtual machine:
# vmware-cmd ubuntu stop
View if a virtual machine is running:
# vmware-cmd ubuntu getstate
View how long a virtual machine has been running in seconds:
# vmware-cmd ubuntu getuptime
Reboot the virtual machine:
# vmware-cmd ubuntu reset trysoft
Create a snapshot and quiesce in the process:
# vmware-cmd ubuntu createsnapshot snap1 "first snapshot" 1 1
Revert to a previous snapshot:
# vmware-cmd ubuntu revertsnapshot
Remove snapshots:
# vmware-cmd ubuntu removesnapshots
Friday, December 10, 2010
How to administer the service console's ip address
How to repair the ip address of the service console:
1. View the current state of the vswif interface by typing:
# esxcfg-vswif -l ; ifconfig vswif0
2. Modify the ip address by typing:
# esxcfg-vswif -i 10.1.1.1 -n 255.255.255.0 vswif0
3. Add the vswif interface if needed by typing:
# esxcfg-vswif -a vswif0 -p "Service Console" -i 10.1.1.1 -n 255.255.255.0
4. Verify vswif information by typing:
# cat /etc/sysconfig/network
Note: Esxi uses a vmkernel port so the commands are different.
On esxi, type esxcfg-vmknic and notice the examples at the end
of the output.
1. View the current state of the vswif interface by typing:
# esxcfg-vswif -l ; ifconfig vswif0
2. Modify the ip address by typing:
# esxcfg-vswif -i 10.1.1.1 -n 255.255.255.0 vswif0
3. Add the vswif interface if needed by typing:
# esxcfg-vswif -a vswif0 -p "Service Console" -i 10.1.1.1 -n 255.255.255.0
4. Verify vswif information by typing:
# cat /etc/sysconfig/network
Note: Esxi uses a vmkernel port so the commands are different.
On esxi, type esxcfg-vmknic and notice the examples at the end
of the output.
vcli examples
vcli examples:
Note: All these examples assume that the server has an ip address of 10.1.1.1
To backup and restore esxi settings:
# vicfg-cfgbackup.pl --server 10.1.1.1 -s C:\esxibackup
# vicfg-cfgbackup.pl --server 10.1.1.1 -l C:\esxibackup
To modify and view hostname and dns information:
# vicfg-dns.pl --server 10.1.1.1 --hostname wesker
# vicfg-dns.pl --server 10.1.1.1 --domain example.com
# vicfg-dns.pl --server 10.1.1.1 --dhcp yes
# vicfg-dns.pl --server 10.1.1.1 --dhcp no
# vicfg-dns.pl --server 10.1.1.1 --dns 10.1.1.2,10.1.1.3
# vicfg-dns.pl --server 10.1.1.1 --vnic vmnic0
# vicfg-dns.pl --server 10.1.1.1
To modify and view ntp information:
# vicfg-ntp.pl --server 10.1.1.1 -l
# vicfg-ntp.pl --server 10.1.1.1 -a 10.1.1.2
# vicfg.ntp.pl --server 10.1.1.1 -d 10.1.1.2
# vicfg.ntp.pl --server 10.1.1.1 --start
# vicfg.ntp.pl --server 10.1.1.1 --stop
To modify nfs/nas information:
# vicfg-nas.pl --server 10.1.1.1 --list
# vicfg-nas.pl --server 10.1.1.1 --add nfs1 --nasserver 10.1.1.2 --share /music
# vicfg-nas.pl --server 10.1.1.1 --delete nfs1
Note: All these examples assume that the server has an ip address of 10.1.1.1
To backup and restore esxi settings:
# vicfg-cfgbackup.pl --server 10.1.1.1 -s C:\esxibackup
# vicfg-cfgbackup.pl --server 10.1.1.1 -l C:\esxibackup
To modify and view hostname and dns information:
# vicfg-dns.pl --server 10.1.1.1 --hostname wesker
# vicfg-dns.pl --server 10.1.1.1 --domain example.com
# vicfg-dns.pl --server 10.1.1.1 --dhcp yes
# vicfg-dns.pl --server 10.1.1.1 --dhcp no
# vicfg-dns.pl --server 10.1.1.1 --dns 10.1.1.2,10.1.1.3
# vicfg-dns.pl --server 10.1.1.1 --vnic vmnic0
# vicfg-dns.pl --server 10.1.1.1
To modify and view ntp information:
# vicfg-ntp.pl --server 10.1.1.1 -l
# vicfg-ntp.pl --server 10.1.1.1 -a 10.1.1.2
# vicfg.ntp.pl --server 10.1.1.1 -d 10.1.1.2
# vicfg.ntp.pl --server 10.1.1.1 --start
# vicfg.ntp.pl --server 10.1.1.1 --stop
To modify nfs/nas information:
# vicfg-nas.pl --server 10.1.1.1 --list
# vicfg-nas.pl --server 10.1.1.1 --add nfs1 --nasserver 10.1.1.2 --share /music
# vicfg-nas.pl --server 10.1.1.1 --delete nfs1
Thursday, December 9, 2010
How to add users in esx//esxi
Adding users in esxi:
1. Log in as root
2. Create the /home directory with mkdir /home
3. Create the user with adduser user_name_here
4. When asked, enter the username's password
5. Take a look at the account with the command cat /etc/shadow; cat /etc/passwd
Adding users in esx:
1. Log in as root
2. Create the user with useradd -md /home/user_name
3. Give the user a password with the command passwd user_name
4. Verify the account by loggin in as the user or the su - username command
5. Type the exit command to be root again (if su was used) or log out.
1. Log in as root
2. Create the /home directory with mkdir /home
3. Create the user with adduser user_name_here
4. When asked, enter the username's password
5. Take a look at the account with the command cat /etc/shadow; cat /etc/passwd
Adding users in esx:
1. Log in as root
2. Create the user with useradd -md /home/user_name
3. Give the user a password with the command passwd user_name
4. Verify the account by loggin in as the user or the su - username command
5. Type the exit command to be root again (if su was used) or log out.
How to enable webaccess in esx
What is webAccess:
WebAccess is a feature found in esx only (no esxi) that allows a user to access the virtual machines consoles via a browser. This feature is disabled by default.
To enable this feature, log in as root on the service console and perform the
following steps:
1. service vmware-webAccess start
2. service vmware-webAccess status
3. chkconfig --level 345 vmware-webAccess on
WebAccess is a feature found in esx only (no esxi) that allows a user to access the virtual machines consoles via a browser. This feature is disabled by default.
To enable this feature, log in as root on the service console and perform the
following steps:
1. service vmware-webAccess start
2. service vmware-webAccess status
3. chkconfig --level 345 vmware-webAccess on
How to recover from forgotten root password in esx
Recovery in 5 easy steps:
1. Power on your server
2. When faced with the grub menu, type "a" to stop the automatic boot sequence
3. Add the word "single" to the boot sequence shown and press enter
4. When faced with the recovery prompt, type "passwd" to change your password
5. Type "reboot" after changing your password
Note:
If your server has a grub password, an alternative is to boot from a live
linux cd, mount the /boot partition into /mnt and edit the grub.conf file in the
grub directory.
1. Power on your server
2. When faced with the grub menu, type "a" to stop the automatic boot sequence
3. Add the word "single" to the boot sequence shown and press enter
4. When faced with the recovery prompt, type "passwd" to change your password
5. Type "reboot" after changing your password
Note:
If your server has a grub password, an alternative is to boot from a live
linux cd, mount the /boot partition into /mnt and edit the grub.conf file in the
grub directory.
Friday, November 19, 2010
H.A. Slot Calculation in 4x
Start with the number of esx/esxi hosts. In this example, there are 3 esxi hosts.
You can see that in the "Total hosts in cluster" line. The next line shows you all three hosts are currently running.
Now look at the number of virtual machines running. In this case the number is 6. This is easy to see and notice that you see that value twice (Used slots and Total powered on vms in cluster).
Look at the size of the memory and cpu reservations of all of the machines and document the highest one. If no reservations are present, the defaults are 256mhzs and 0mbs of ram. This has been changed in 5x (nowadays 32mhz and 0mb plus overhead). In this case, notice the 345MB.
Now if you have 3 hosts, each would have 78. The idea here is one of them would go down. That would leave us with 156 (78 x 2). If you subtract 6 (the running vms), that leaves you 150.
Thursday, November 18, 2010
How to increase the memory allocated to the service console
Increasing the memory allocated to the service console in ESX 4X from 300mb to 800mb requires editing of two files. The files are esx.conf in the /etc/vmware directory and grub.conf in the /boot/grub directory. 800mb is the maximum allowed. The swap partition should be changed as well from 600mb (twice the ram allocated to the service console by default) to 1600mb maximum.
# vi /etc/vmware/esx.conf
uppermem=818176
# vi /boot/grub/grub.conf
mem=800
# vi /etc/vmware/esx.conf
uppermem=818176
# vi /boot/grub/grub.conf
mem=800
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
List available network cards
esxcfg-nics -s 100 -d full vmnic2
Set card to full duplex, 100mbits
Set card to full duplex, 100mbits
esxcfg-nics -a vmnic2
Set card to autonegociate
Set card to autonegociate
Dealing with virtual switches:
esxcfg-vswitch -l
list all available virtual switches
list all available virtual switches
esxcfg-vswitch -a vSwitch1
create a new virtual switch
create a new virtual switch
esxcfg-vswitch -A "My VMs" vSwitch1
add a port group to a vswitch
add a port group to a vswitch
esxcfg-vswitch -L vmnic1 vSwitch1
associate a nic to a switch
associate a nic to a switch
esxcfg-vswitch -U vmnic1 vSwitch1
remove a nic from a switch
remove a nic from a switch
esxcfg-vswitch -d vSwitch1
remove a virtual switch
remove a virtual switch
Dealing with routing:
esxcfg-route -l
list the routing table
list the routing table
esxcfg-route 10.28.1.1
set the gateway
set the gateway
esxcfg-route -a default 255.0.0.0 10.28.1.2
add a gateway
add a gateway
Dealing with the nfs server:
esxcfg-nas -l
list nfs mounts
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
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
query the firewall
esxcfg-firewall -e ntpClient
enable ntp service
enable ntp service
esxcfg-firewall -d ntpClient
disable ntp service
disable ntp service
esxcfg-firewall -allowIncoming
open all incoming ports
open all incoming ports
esxcfg-firewall -blockIncoming
block all incoming ports
block all incoming ports
esxcfg-firewall -allowOutgoing
open all outgoing ports
open all outgoing ports
esxcfg-firewall -blockOutgoing
block all outgoing ports
block all outgoing ports
Dealing with storage:
esxcfg-rescan
find newly added storag/rescan hbas
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
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
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
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
Subscribe to:
Posts (Atom)