Wednesday, March 31, 2010

VMware Command List

esxcfg There are a new set of command line tools in ESX 3.x which all start with "esxcfg-".

esxcfg-advcfg The esxcfg-advcfg command is interesting as there is not a huge amount of help about this command. However, we can figure out that it is meant to do advanced configuration and we can figure out some settings that can be made. The -g switch is used to "get" settings; the -s switch is used to "set" settings

Ex:
[root@esx1host vmware]# esxcfg-advcfg -g /VMFS3/ZeroedThickVirtualDisks
Value of ZeroedThickVirtualDisks is 1

Usage: esxcfg-advcfg <options> [<adv cfg Path>]
-g--get Get the value of the Config option
-s--set <value> Set the value of the Config option
-d--default Reset Config option to default
-q--quiet Suppress output
-k--set-kernel Set a VMkernel load time option value.
-j--get-kernel Get a VMkernel load time option value.
-h--help Show this message.
-r--restore Restore all advanced options from the configuration file.(FOR INTERNAL USE ONLY).

esxcfg-firewall The service console in ESX 3.x has a firewall enabled by default.

The firewall rules are stored in /etc/vmware/esx.conf, but we don't go editing this file, we use this command to ensure it is locked while we make our edits. If you are very interested in the iptables commands used behind the scenes, then you can inspect the log file /var/log/vmware/esxcfg-firewall.log

Following switch you can use this command.

-e uses this switch for enable to particular services

Ex: [root@esxhost1 root]# esxcfg-firewall -e sshClient

-d

uses this switch for disable to particular services

Ex :root@esxhost1 root]# esxcfg-firewall -d smbClient

-o
use this switch for open the UDP or TCP port

Ex: [root@esxhost1 root]# esxcfg-firewall -o port,protocol,direction,name

esxcfg-module This command is used to view and set options for start-up on the VMkernel modules (drivers). When this command is used with the list option, it produces an output similar to vmkload_mod –list

EX: root@esx1host root]# esxcfg-module –l

[root@esx1host root]# esxcfg-module -s ql2xmaxdepth64 qla2300_707_vmw

esxcfg-rescan This command is used to perform a rescan of a host bus adapter (HBA). Specifically it scans a named vmkernel hba device, i.e. a vmhba. This command does a similar job to vmkfstools -rescan.

EX: [root@esx1host]# esxcfg-rescan vmhba32

esxcfg-upgrade esxcfg-upgrade -h --help
-g --convert-grub
-f --convert-fstab
-r --upgrade-pre-vmkernel
-o --upgrade-post-vmkernel


The -g option may only be used with the -r option.

esxcfg-vswitch This command is one of the most useful commands in the service console. This command allows you to list, add, modify or delete virtual Ethernet switches on an ESX host. The simplest option with this command is the -l option to list the virtual switches and portgroups defined on the host

EX: [root@esx1host root]# esxcfg-vswitch –l

[root@esx1host root]# esxcfg-vswitch -a vSwitch1

esxcfg-vswitch --add vSwitch2

[root@esx1host root]# esxcfg-vswitch --add-pg="Production" vSwitch1

esxcfg-auth Configures the service console user authentication options including NIS, LDAP, Kerberos and Active Directory. In the following command, we are configuring authentication for the Active Directory domain called taupoconsulting.com

Ex: [root@esx1host root]# esxcfg-auth --enablead --addomain=taupoconsulting.com --adddc=dc1.taupoconsulting.com

You can also use this tool to set a password policy for service console user accounts.

[root@esx1host root]# esxcfg-auth --maxpassdays=90 --minpassdays=30 --passwarnage=75


esxcfg-info .

esxcfg-mpath Manages storage multi-pathing just as the vmkmultipath utility did in previous versions of ESX Server. In the example below we are using the -l switch to list the storage and paths.

[root@esx1host tools-isoimages]# esxcfg-mpath –l

esxcfg-resgrp This command can add, remove or modify existing resource groups.

esxcfg-hbadevs The esxcfg-vmhbadevs command is used to list the equivalent Linux device names for the visible disk devices that the VMkernel references using vmhba notation.

EX: [root@esx1host root]# esxcfg-vmhbadevs
vmhba0:0:0 /dev/sda
vmhba0:0:1 /dev/sdb
vmhba0:0:2 /dev/sdc
vmhba0:0:3 /dev/sdd
vmhba2:0:0 /dev/sde
vmhba2:1:0 /dev/sdf

If we use this command with the –m switch, then we only list the LUNs which contain VMFS partitions. Alongside the Linux device name, a long unique hexadecimal value is listed

esxcfg-boot

esxcfg-nas The esxcfg-nas command is used to list, mount and dismount NFS exports for the VMkernel. In the first example we list the NFS datastores which the VMkernel has mounted.

Swtich list esxcfg-nas <options> [<label>]
-a--add Add a new NAS filesystem to /vmfs volumes. Requires --host and --share options.
-o--host <host> Set the host name or ip address for a NAS mount.
-s--share <share> Set the name of the NAS share on the remote system.
-d--delete Unmount and delete a filesystem.
-l--list List the currently mounted NAS file systems.
-r--restore Restore all NAS mounts from the configuration file. (FOR INTERNAL USE ONLY).
-h--help Show this message.

esxcfg-route If we add an IP address to the VMkernel by adding a VMkernel port, then we can fully configure that IP stack by also assigning a default gateway. We can view (no parameters) and set (1st parameter) the VMkernel IP default gateway with the esxcfg-route
command as shown here. In the following example, we view the current VMkernel gateway (.254) and then change it to a new one (.1)

EX: [root@esx1host etc]# esxcfg-route
VMkernel default gateway is 100.100.100.254

[root@esx1host etc]# esxcfg-route 100.100.100.1
VMkernel default gateway set to 100.100.100.1

No comments:

Post a Comment