收集来自:http://it-john.com/blog/archives/50
|
The esxcfg- Commands |
| esxcfg- |
| There are a new set of command line tools in ESX 3.x which all start with “esxcfg-”. These tools are used to configure each part of the ESX 3.x configuration. For example, esxcfg-firewall is used to manage the service console firewall while the esxcfg-nic is used to manage the physical Ethernet adapters present in the server.Watch out for vicfg- commands also. If you are using the RCLI tools for managing ESX 3i, then the esxcfg- tools are now prefixed with vicfg- although the esxcfg- prefix still works. |
| 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.Here are a few examples of some VMkernel parameters which can be interrogated.[root@esx1host vmware]# esxcfg-advcfg -g /Misc/BlueScreenTimeoutValue of BlueScreenTimeout is 0
[root@esx1host vmware]# esxcfg-advcfg -g /Misc/HostName Value of HostName is esx1.vmlab.net The question is, how much is configurable? To figure out what is configurable, we recommend that you look in the directory /proc/vmware/config which you will find in the service console command line and then you will see the following directories BufferCache Cpu Disk FileSystem Irq LVM Mem Migrate Misc Net NFS Numa Scsi User VMFS3 From these directories and the files within, you can work out the paths to be supplied to the esxcfg-advcfg command as parameters. Alternatively, you could also use the command esxcfg-info -o to list the advanced options. We often see this tool used to make configuration changes relating to storage. For example, below, you can see we are checking to see if we are creating virtual disks in “eager zero” format by default, whether we will discover non-contiguous numbered LUNs, the maximum LUN number addressed,the SCSI conflict retry count and finally the logical volume manager (LVM) setting for resignaturing VMFS volumes. [root@esx1host vmware]# esxcfg-advcfg -g /VMFS3/ZeroedThickVirtualDisks Value of ZeroedThickVirtualDisks is 1 [root@esx1host vmware]# esxcfg-advcfg -g /Disk/SupportSparseLUN Value of SupportSparseLUN is 1 [root@esx1host vmware]# esxcfg-advcfg -g /Disk/MaxLUN Value of MaxLUN is 255 [root@esx1host vmware]# esxcfg-advcfg -g /Scsi/ConflictRetries Value of ConflictRetries is [root@esx1host vmware]# esxcfg-advcfg -g /LVM/EnableResignature Value of EnableResignature is
In this last example, we are again setting a parameter related to storage. This parameter limits the number of outstanding disk request for each VM. This is intended to equalise the disk access between virtual machines. [root@esx1host vmware]# esxcfg-advcfg -s 16 /Disk/SchedNumReqOutstanding When using the esxcfg-advcfg command, remember case sensitivity! 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 network packet filtering found in Red Hat Linux is called iptables. As the management of iptables is not entirely straightforward, the esxcfg-firewall command makes things a load easier. 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.logWe use the esxcfg-firewall command to view and configure the firewall rules. The most popular switch will be the -q switch to query the firewall for its current settings.[root@esxhost1 root]# esxcfg-firewall -q<output>
The -s switch will allow you to enable or disable network services that may traverse the firewall successfully. The list of known services are shown below – very case sensitive!…. nfsClient ftpServer ntpClient dellom nisClient vncServer tmpLicenseClient swISCSIClient CIMHttpsServer sshClient snmpd tmpAAMClient vpxHeartbeats smbClient hpim tmpHostVmdbServer tmpHostdSOAPServer ftpClient sshServer ibmdirector CIMHttpServer telnetClient The -l switch loads the firewall and enables the IP tables. The -u switch unloads the firewall and disables the IP tables. We use the -e switch to enable a particular known service, so if we wanted to enable ssh outbound connections from the service console we would simply enter [root@esxhost1 root]# esxcfg-firewall -e sshClient We use the -d switch to disable a service. In the following example, we prevent outbound connections [root@esxhost1 root]# esxcfg-firewall -d smbClient If we need to open a TCP or UDP port that is not described by a defined friendly name like “sshClient”, then we can explicitly open that port with the -o switch. The service console firewall is bidirectional and so when opening a port you must also specify direction of incoming or outgoing. Equally, we can close an explicit port with the -c switch. [root@esxhost1 root]# esxcfg-firewall -o port,protocol,direction,name In the following example, we are opening a unique port which we are calling “customapp” [root@esxhost1 root]# esxcfg-firewall -o 12345,tcp,out,custom-app The service names such as sshClient and smbClient are defined in the file /etc/vmware/firewall/services.xml .
|
| 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[root@esx1host root]# esxcfg-module -l Module Type Enabled Loaded
vmkapimod vmkapimod true true vmklinux linux true true cciss.o scsi true false tg3.o nic true false qla2300_7xx.o fc true false This command is often used when we want to modify a VMkernel module behaviour, for example, if we wanted to change the queue depth of our fibre-channel host bus adapter. In the following example, we are setting the queue depth for our QLogic HBA to 64; up from it’s default value of 32. [root@esx1host root]# esxcfg-module -s ql2xmaxdepth64 qla2300_707_vmw To do the same with an Emulex HBA, we would use something like [root@esx1host root]# esxcfg-module -s “lpfc0_lun_queue_depth=64″ lpfcdd_7xx
|
| 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.In this example the esxcfg-rescan command is being used to rescan the VMkernel iSCSI software initiator vmhba.[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 |
Where a vmnic is a physical Ethernet adapter. If we wish to view the same information at the service console command line, we would use the esxcfg-vswitch command with the “-l” switch to list the defined virtual switches. [root@esx1host root]# esxcfg-vswitch -l Switch Name Num Ports Used Ports Configured Ports Uplinks vSwitch0 32 4 32 vmnic0 PortGroup Name Internal ID VLAN ID Used Ports Uplinks Service Console portgroup0 0 1 vmnic0 NFS access portgroup1 0 1 vmnic0 If we wanted to add another virtual Ethernet switch, we would use esxcfg-vswitch command with the “-a” switch. Note that the -a is specified in lowercase. Take care to ensure you have specified lowercase because uppercase “A” performs a different function with this command. So, lets add a new virtual switch to our ESX host called vSwitch1 and then list the switches to check our command has worked ok. [root@esx1host root]# esxcfg-vswitch -a vSwitch1 [root@esx1host root]# esxcfg-vswitch -l Switch Name Num Ports Used Ports Configured Ports Uplinks vSwitch0 32 4 32 vmnic0 PortGroup Name Internal ID VLAN ID Used Ports Uplinks Service Console portgroup0 0 1 vmnic0 NFS access portgroup1 0 1 vmnic0 Switch Name Num Ports Used Ports Configured Ports Uplinks vSwitch1 64 0 64 PortGroup Name Internal ID VLAN ID Used Ports Uplinks Notice that the number of ports on the virtual switch is 64 on the newly created switch. The original virtual switch has only 32. This difference arises between creating the switch in the VI Client or the command line. Notice also that the used port count doesn’t immediately make sense. Each VM consumes a port, each vmnic consumes a port and the uplink itself consumes a port. Anyway, if you are like me and you can never remember which case of the letter “a” to use when adding a virtual switch, then use the esxcfg-vswitch command with the –add switch when creating a new switch like this: esxcfg-vswitch –add vSwitch2 which I think is a little clearer to understand. Now if we want to add a portgroup to the new virtual switch we have created, we can use the esxcfg-vswitch -A command. It does not matter whether you are creating a service console port, a VM port group or a VMkernel port when creating a port group; the way we create the connection to the virtual switch always starts out the same in the command line. Only after creating the port group do we then specify if it is to be anything other than a VM port group. In the following commands, we add a new portgroup called “Production” on the virtual switch vSwitch1. [root@esx1host root]# esxcfg-vswitch -A “Production” vSwitch1 [root@esx1host root]# esxcfg-vswitch -l Switch Name Num Ports Used Ports Configured Ports Uplinks vSwitch0 32 4 32 vmnic0 PortGroup Name Internal ID VLAN ID Used Ports Uplinks Service Console portgroup0 0 1 vmnic0 NFS access portgroup1 0 1 vmnic0 Switch Name Num Ports Used Ports Configured Ports Uplinks vSwitch1 64 0 64 PortGroup Name Internal ID VLAN ID Used Ports Uplinks Production portgroup2 0 0 Alternatively you could use the following command to add a port group to a virtual switch. [root@esx1host root]# esxcfg-vswitch –add-pg=”Production” vSwitch1 This alternative switch of using –ad-pg I think is clearer for understanding what the command is doing. The –add-pg option can clearly be seen to add a portgroup to a virtual switch, and again is simpler to understand than just “-A”. The portgroup name in our example is called “Production”, but it can be what you want. We recommend adoption of a standard across all your virtual infrastructure. I have seen some clients align their portgroup names with the IP subnets, so you could have a portgroup called something like “192.168.1.0 subnet”. Although we have now created a new virtual switch and have created a VM port group on it, the virtual switch itself does not have any uplinks. Remember that when we bind a physical network adapter to a virtual switch we are uplinking a vmnic to the switch and the switch then “owns” that adapter, i.e. it is not available to be used by any other virtual switches. We perform the uplink by using the esxcfg-vswitch command with the -L switch for link. [root@esx1host root]# esxcfg-vswitch -L vmnic1 vSwitch1 So in one simple command we have linked the physical network adapter vmnic1 to our new virtual Ethernet switch vSwitch1. If we then realised we had used the wrong physical adapter, we can just as easily unlink with -U. In the next example, we swap the uplinked vmnic1 for an alternative adapter vmnic2 [root@esx1host root]# esxcfg-vswitch -U vmnic1 vSwitch1 [root@esx1host root]# esxcfg-vswitch -L vmnic2 vSwitch1 This changing of vmnic bound to a virtual switch is often required post-installation, as we may select the wrong physical adapter to use for the service console during the install and need to correct our configuration before we can connect to our host with VI client!
As of ESX 3.5, VMware added Cisco Discovery Protocol (CDP) support for virtual switches. We can view CDP information of the current neighbour of the physical NIC. In the VI Client, we can see this by clicking on the
To display the CDP configuration setting for a virtual switch, we use the lowercase b switch, where we will find which of the four CDP modes it is in: disable, listen, advertise or both. [root@esx1host root]# esxcfg-vswitch -b vSwitch0 listen We can change the CDP mode with the -B (uppercase) option. Here we are changing virtual switch called vSwitch0 to support both advertise and listen. [root@esx1host root]# esxcfg-vswitch -B both vSwitch0 [root@esx1host root]# esxcfg-vswitch -b vSwitch0 both
|
| 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[root@esx1host root]# esxcfg-auth –enablead –addomain=taupoconsulting.com –adddc=dc1.taupoconsulting.comYou 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
In the above example, your service console user account password would expire after 90 days, you would get a warning message after 75 and once changed, you would have to keep that password for a minimum period of 30 days.
|
| esxcfg-info |
| Produces an enormous amount of information about the state ESX host, often this tool is the one tool that can tell you what is really going on and not what is in some configuration file. If you run this command with no parameters, then you really need to pipe this to a file for closer examination! Over time, less information will be available in the proc nodes (the /proc/vmware directory structure), so the sooner we can get used to examining the current running configuration of ESX using this command, the better off we will be.In this first example, we will run the command with no switches and pipe the result into a file esxinfo.txt.[root@esx1host root]# esxcfg-info >esxinfo.txtIf you know the area you are looking at, e.g. storage, then we can launch the tool with the appropriate switch. Here are the six switch options:
w hardware r resource s storage n network y system o advanced options If we combine the filtering of the output using the above switches along with a grep filter we can really zoom in on the area we are interested in. An excellent VMware communities post gives an example of using the storage switch whilst looking for Pending reservations on LUNs. We are piping the result of the storage output of esxcfg-info into the input for grep. [root@esx1host]# esxcfg-info -s | grep Pending Check out the post at http://communities.vmware.com/thread/156778?tstart=0
|
| 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 Disk vmhba0:0:0 /dev/cciss/c0d0 (69459MB) has 1 paths and policy of Fixed
Local 2:1.0 vmhba0:0:0 On active preferred
Disk vmhba1:0:0 (0MB) has 1 paths and policy of Most Recently Used FC 10:1.0 210000e08b846a72<->5006016930221397 vmhba1:0:0 On active preferred
Disk vmhba1:0:6 /dev/sda (9216MB) has 1 paths and policy of Most Recently Used FC 10:1.0 210000e08b846a72<->5006016930221397 vmhba1:0:6 On active preferred
Disk vmhba1:0:21 /dev/sdb (10240MB) has 1 paths and policy of Most Recently Used FC 10:1.0 210000e08b846a72<->5006016930221397 vmhba1:0:21 On active preferred
|
| esxcfg-resgrp |
| Used to manage the new ESX feature called resource groups. 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.[root@esx1host root]# esxcfg-vmhbadevsvmhba0:0:0 /dev/sdavmhba0: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. This is the VMFS volume signature assigned by the new logical volume manager (LVM). [root@esx1host root]# esxcfg-vmhbadevs -m vmhba0:0:0:1 /dev/sda1 45407607-fbc43ced-94cb-00145e231ce3 vmhba0:0:2:1 /dev/sdc1 455b08a8-8af7fee3-daa9-00145e231e35 vmhba2:0:0:3 /dev/sde3 4559c75f-831d8f3e-bc81-00145e231e35 You can view these volumes in the directory /vmfs/volumes/
|
| esxcfg-boot |
| Used to configure the GRUB options presented at boot time. One thing to note is that the new esxcfg commands will not run if you boot just into Linux. If you just want to query the boot settings, you can use the -q switch but this must be qualified with the keyword boot or vmkmod.[root@esx1host root]# esxcfg-boot -q boot272 2:;7:;10:; UUID=847199e4-d3c7-11da-8ef8-930e3d734c03 /vmlinuz-2.4.21-37.0.2.ELvmnix /initrd-2.4.21-37.0.2.ELvmnix.img
[root@esx1host root]# esxcfg-boot -q vmkmod vmkapimod vmkapimod vmklinux linux cciss.o scsi tg3.o nic qla2300_7xx.o fc This is also used if you making modifications to VMkernel device drivers defaults. For example, if you were modifying the queue depth for a fibre HBA, you would likely be using esxcfg-module. Then to rebuild the boot image you would enter [root@esx1host root]# esxcfg-boot -m After which, you would do a reboot the host to test that the update to the boot image had worked.
|
| esxcfg-init |
| Should not be run manually! |
| 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.[root@esx1host root]# esxcfg-nas -lNFS01 is /NFS from 100.100.100.253 mountedIn the next example, we add a new VMkernel mount to a remote NFS server. This time we are connecting to the NFS server at IP address 100.100.100.253 and the name of the exported directory is “/Test”. We are labelled this NFS mount “NFS02″.
[root@esx1host etc]# esxcfg-nas -a -o 100.100.100.253 -s /Test NFS02 Connecting to NAS volume: NFS02 NFS02 created and connected. Remember that to create a connection to an NFS datastore, the VMkernel needs to have an IP address, as it is the NFS client. We give the VMkernel an IP address by creating a VMkernel port on a virtual Ethernet switch. We can do this at the command line using the command esxcfg-vmknic The command line options for esxcfg-nas are: 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.[root@esx1host etc]# esxcfg-routeVMkernel 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
|
| esxcfg-vmknic |
In the following example, we list the VMkernel ports, then use esxcfg-vmknic to delete one of them and then list them again. [root@esx1host etc]# esxcfg-vmknic -l Port Group IP Address Netmask Broadcast MAC Address MTU Enabled NFS access 100.100.100.21 255.255.255.0 100.100.100.255 00:50:56:62:ca:f6 1514 true VMotion 100.100.100.121 255.255.255.0 100.100.100.255 00:50:56:6d:7c:7d 1514 true [root@esx1host etc]# esxcfg-vmknic -d VMotion [root@esx1host etc]# esxcfg-vmknic -l Port Group IP Address Netmask Broadcast MAC Address MTU Enabled NFS access 100.100.100.21 255.255.255.0 100.100.100.255 00:50:56:62:ca:f6 1514 true
The command line options are: esxcfg-vmknic <options> <portgroup> -a|–add Add a VMkernel NIC to the system, requires IP parameters and portgroup name. -d|–del Delete VMkernel NIC on given portgroup. -e|–enable Enable the given NIC if disabled. -D|–disable Disable the given NIC if enabled. -l|–list List VMkernel NICs. -i|–ip <X.X.X.X> The IP address for this VMkernel NIC. Setting an IP address requires that the –netmask option be given in same command. -n|–netmask <X.X.X.X> The IP netmask for this VMkernel NIC. Setting the IP netmask requires that the –ip option be given in the same command. -r|–restore Restore VMkernel TCP/IP interfaces from Configuration file (FOR INTERNAL USE ONLY). -h|–help Show this message.
|
| esxcfg-dumppart |
| Used to configure the VMkernel crash dump partition. The old ESX 2.x utility for this function (vmkdump) is still present on an ESX 3 server, but appears just to be for extracting dump files.So far, we have only used this utility to interrogate ESX hosts to determine where the dump partition has been created. Here is an example of viewing the dump partition.# esxcfg-dumppart -lVM Kernel Name Console Name Is Active Is Configured vmhba0:0:0:7 /dev/cciss/c0d0p7 yes yes
Remember that the dump partition does not show up when you run the vdf utility. However it is visible if you run fdisk. In the following example, we are running fdisk to view the partitions. We can see the dump partition as c0d0p7, i.e. partition #7. Notice the Id of that partition is “fc”, the custom partition type for VMkernel dump partitions. # fdisk /dev/cciss/c0d0
Disk /dev/cciss/c0d0: 36.3 GB, 36385505280 bytes 64 heads, 32 sectors/track, 34699 cylinders Units = cylinders of 2048 * 512 = 1048576 bytes Device Boot Start End Blocks Id System The command line options are: esxcfg-dumppart <options> [<partition>] -l|–list List the partitions available for Dump Partitions. WARNING: This will scan all LUNs on the system. -t|–get-active Get the active Dump Partition for this system, returns the internal name of the partition vmhbaX:X:X:X) or ‘none’. -c|–get-config Get the configured Dump Partition for this system, returns the internal name of the partition vmhbaX:X:X:X) or ‘none’. -s|–set Set the Dump Partition for this system and activate it, either vmhbaX:X:X:X or ‘none’ to deactivate the active dump partition. -f|–find Find usable Dump partitions and list in order of preference. -S|–smart-activate Activate the configured dump partition or find the first appropriate partition and use it(same order as -f). -a|–activate Activate the configured dump partition. -d|–deactivate Deactivate the active dump partition. -h|–help Show this message.
|
| esxcfg-linuxnet |
| There is not normally a command that a virtual infrastructure administrator should need. The tool is automatically used when you start an ESX server in troubleshooting mode; i.e. when you start only the service console Linux kernel and don’t start the VMkernel.When you are working in the service console while the VMkernel is loaded, the service console’s network interface is not called eth0, but is called vswif0 instead. This is because the service console network interface is provided via a service console portgroup on a virtual Ethernet switch. If you restart your ESX server without the VMkernel, then standard Linux drivers and network card management is used. Therefore the network interface used in troubleshooting mode is called eth0 – just like any other regular Linux box. This tool is called by starting troubleshooting mode to replicate the IP parameters assigned to vswif0 to eth0.Should you want to investigate this command, the options are:esxcfg-linuxnet –setup
–remove -h –help
The –setup option cannot be combined with the –remove option.
|
| esxcfg-nics |
| This tool can be used to view and configure the speed and duplex settings of the physical network cards in the ESX Server. This tool can replace the mii-tool and modules.conf for network card management.In the following example, we run the list option to view all physical NICs and their properties.[root@esx1host etc]# esxcfg-nics -l
Name PCI Driver Link Speed Duplex Description vmnic2 01:01.00 tg3 Up 1000Mbps Full Broadcom Corporation NetXtreme BCM5703 Gigabit Ethernet vmnic0 01:02.00 tg3 Up 100Mbps Full Broadcom Corporation NC7781 Gigabit Server Adapter (PCI-X, 10,100,1000-T) vmnic1 04:02.00 tg3 Up 1000Mbps Full Broadcom Corporation NC7781 Gigabit Server Adapter (PCI-X, 10,100,1000-T) This command has the following optional parameters: esxcfg-nics <options> [nic] -s|–speed <speed> Set the speed of this NIC to one of 10/100/1000/10000. Requires a NIC parameter. -d|–duplex <duplex> Set the duplex of this NIC to one of ‘full’ or ‘half’. Requires a NIC parameter. -a|–auto Set speed and duplexity automatically. Requires a NIC parameter. -l|–list Print the list of NICs and their settings. -r|–restore Restore the nics configured speed/duplex settings (INTERNAL ONLY) -h|–help Display this message.
|
| esxcfg-swiscsi |
| ESX server 3 supports both hardware and software initiated iSCSI. For hardware iSCSI, we can use host bus adapters which perform the TCP offload and so the vmkernel can just pass SCSI commands to them as normal. The iSCSI hba can then wrap the SCSI command in IP transport and forward them to the iSCSI target.In VI-3, one of the supported iSCSI hardware HBAs is the QLogic 4052. More information about this particular family of adapters can be found at http://support.qlogic.com/support/product_resources.asp?id=964In software iSCSI initiator, the wrapping of SCSI commands in IP is performed by the VMkernel and a regular physical network card is used to communicate with the iSCSI target. The software iSCSI configuration is exposed in the VI Client as a host bus adapter called vmhba40 in ESX 3.0.x and is called vmhba32 in ESX 3.5. We can use this command line tool esxcfg-swiscsi to configure the software iSCSI initiator. The software iSCSI initiator in the VMkernel has a dependency upon the service console, therefore both the service console and VMkernel must have an IP route to the iSCSI target. The esxcfg-swiscsi command is not used in isolation, we use it in a sequence of commands to fully configure iSCSI from the service console command line.1. Add a VMkernel port to a vSwitch that has an uplink and route to iSCSI target
2. Ensure service console IP interface has a route to the same iSCSI target 3. Using either the VI Client security profile or the esxcfg-firewall, open a port in the service console firewall for iSCSI (TCP:3260) 4. In the command line, enable iSCSI with the command esxcfg-swiscsi -e 5. Enable a discovery address with the command vmkiscsi-tool -D -a 10.0.0.99 vmhba32 6. List the targets that were discovered with vmkiscsi-tool -T -l vmhba32 7. Perform a rescan with esxcfg-rescan vmhba32 8. List the iSCSI LUNs with vmkiscsi-tool -L -l vmhba32 If you want to ensure the VI client reflects the changes made at command line, it is best to restart the vmware management service with the command service mgmt-vmware restart The full list of command line options for this command are:
-e, –enable Enable sw iscsi -d, –disable Disable sw iscsi -q, –query Check if sw iscsi is on/off -s, –scan Scan for disk available through sw iscsi interface -k, –kill Try to forcibly remove iscsi sw stack -r, –restore Restore sw iscsi configuration from file (FOR INTERNAL USE ONLY) -h, –help Show this message
|
| esxcfg-vswif |
If we use the esxcfg-vswif tool, we are examining, creating or modifying a service console port. So in the first example here, we are simply listing what ports have been created. # esxcfg-vswif -l Name Port Group IP Address Netmask Broadcast Enabled DHCP So the output is showing the same as the graphical output in VI client. If we wanted to add a 2nd service console port, we could use this command. However, all this command will do is turn a regular portgroup into a service console port and bind an IP address to Linux. So in the following command line example, we create a portgroup first, and then we turn it into a service console port with esxcfg-vswif. # esxcfg-vswitch –add-pg=”Service Console Backup” vSwitch1 # esxcfg-vswif -a -i 10.10.1.31 -n 255.255.0.0 -p “Service Console Backup” vswif1
[2007-11-21 11:29:18 'Vnic' warning] Generated New MAC address, 00:50:56:4d:da:97 for vswif1 Nothing to flush. So now if we run esxcfg-vswif to list the service console ports, we will be able to see the original service console port as well as our new one we just created. We’ve shown you the graphical representation as well from the VI client so you can compare. # esxcfg-vswif -l Name Port Group IP Address Netmask Broadcast Enabled DHCP
A new function was added to esxcfg-vswitch when ESX 3.5 was released at the end of 2007. This version of ESX server was the first to support Ethernet Jumbo Frames. This is where the MTU size is increased beyond the default 1500 bytes. In the following example, we are changing the maximum MTU for vSwitch1. # esxcfg-vswitch -m 9000 vSwitch1
|
