0% found this document useful (0 votes)
521 views144 pages

Vsphere Esxi Vcenter Server 50 Command Line Interface Solutions and Examples Guide

This document supports the version of each product listed and supports all subsequent versions until the document is replaced by a new edition. VMware products are covered by one or more patents listed at VMware is a registered trademark or trademark of VMware, Inc. All other marks and names mentioned herein may be trademarks of their respective companies.

Uploaded by

Andrew Scrivner
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
521 views144 pages

Vsphere Esxi Vcenter Server 50 Command Line Interface Solutions and Examples Guide

This document supports the version of each product listed and supports all subsequent versions until the document is replaced by a new edition. VMware products are covered by one or more patents listed at VMware is a registered trademark or trademark of VMware, Inc. All other marks and names mentioned herein may be trademarks of their respective companies.

Uploaded by

Andrew Scrivner
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

vSphere Command-Line Interface Concepts and Examples

ESXi 5.0 vCenter Server 5.0

This document supports the version of each product listed and supports all subsequent versions until the document is replaced by a new edition. To check for more recent editions of this document, see [Link]

EN-000489-00

vSphere Command-Line Interface Concepts and Examples

You can find the most up-to-date technical documentation on the VMware Web site at: [Link] The VMware Web site also provides the latest product updates. If you have comments about this documentation, submit your feedback to: docfeedback@[Link]

Copyright 20082011 VMware, Inc. All rights reserved. This product is protected by U.S. and international copyright and intellectual property laws. VMware products are covered by one or more patents listed at [Link] VMware is a registered trademark or trademark of VMware, Inc. in the United States and/or other jurisdictions. All other marks and names mentioned herein may be trademarks of their respective companies.

VMware, Inc. 3401 Hillview Ave. Palo Alto, CA 94304 [Link]

VMware, Inc.

Contents

AboutThisBook

1 vSphereCLICommandOverviews 11
Introduction 11 Documentation 12 CommandLineHelp 12 ListofAvailableCommands 12 SupportedPlatformsforCommands 14 [Link] CommandswithanesxcfgPrefix 16 UsingESXCLIOutput 17 ConnectionOptions 17 vCLIandLockdownMode 18

16

2 ManagingHosts 21
Stopping,Rebooting,andExaminingHostswithvicfghostops 21 EnteringandExitingMaintenanceModewithvicfghostops 22 BackingUpConfigurationInformationwithvicfgcfgbackup 22 BackupTasks 23 BackingUpConfigurationData 23 RestoringConfigurationData 23 UsingvicfgcfgbackupfromvMA 23 ManagingVMkernelModules 24 ManagingModuleswithesxclisystemmodule 24 ManagingModuleswithvicfgmodule 24 UsingvicfgauthconfigforActiveDirectoryConfiguration 25 UpdatingHosts 26

3 ManagingFiles 27
IntroductiontoVirtualMachineFileManagement 27 ManagingtheVirtualMachineFileSystemwithvmkfstools 28 UpgradingVMFS3VolumestoVMFS5 29 ManagingVMFSVolumes 29 ManagingDuplicateVMFSDatastores 29 MountingDatastoreswithExistingSignatures 29 MountingandUnmountingwithESXCLI 29 MountingandUnmountingwithvicfgvolume 30 ResignaturingVMFSCopies 30 ResignaturingaVMFSCopywithESXCLI 31 ResignaturingaVMFSCopywithvicfgvolume 31 DetachingDevicesandRemovingaLUN 32 WorkingwithPermanentDeviceLoss 32 UsingvifstoManipulateFilesonRemoteESXiHosts 33

VMware, Inc.

vSphere Command-Line Interface Concepts and Examples

4 ManagingStorage 37
IntroductiontoStorage 37 HowVirtualMachinesAccessStorage 38 Datastores 39 StorageDeviceNaming 39 ExaminingLUNs 40 TargetandDeviceRepresentation 40 ExaminingLUNswithesxclistoragecore 40 ExaminingLUNswithvicfgscsidevs 41 ManagingPaths 42 MultipathingwithLocalStorageandFCSANs 42 ListingPathInformation 43 ListingPathInformationwithESXCLI 43 ListingPathInformationwithvicfgmpath 44 ChangingtheStateofaPath 44 ChangingPathStatewithESXCLI 45 ChangingPathStatewithvicfgmpath 45 ManagingPathPolicies 45 ChangingPathPolicies 46 ChangingPathPolicieswithESXCLI 46 ChangingPathPolicieswithvicfgmpath 47 SettingPolicyDetailsforDevicesthatUseRoundRobin 47 ManagingNFS/NASDatastores 48 CapabilitiesSupportedbyNFS/NAS 48 AddingandDeletingNASFileSystems 48 ManagingNASFileSystemswithESXCLI 48 ManagingNASFileSystemswithvicfgnas 49 MigratingVirtualMachineswithsvmotion 49 StoragevMotionUses 50 StoragevMotionRequirementsandLimitations 50 RunningsvmotioninInteractiveMode 50 RunningsvmotioninNoninteractiveMode 51 ConfiguringFCoEAdapters 51 ScanningStorageAdapters 52

5 ManagingiSCSIStorage 53
iSCSIStorageOverview 53 DiscoverySessions 54 DiscoveryTargetNames 55 ProtectinganiSCSISAN 55 ProtectingTransmittedData 55 SecuringiSCSIPorts 56 SettingiSCSICHAP 56 CommandSyntaxforesxcliiscsiandvicfgiscsi 57 esxcliiscsiCommandSyntax 57 KeytoesxcliiscsiShortOptions 58 vicfgiscsiCommandSyntax 59 iSCSIStorageSetupwithESXCLI 62 SettingUpSoftwareiSCSIwithESXCLI 62 SettingUpDependentHardwareiSCSIwithESXCLI 64 SettingUpIndependentHardwareiSCSIwithESXCLI 66

VMware, Inc.

Contents

iSCSIStorageSetupwithvicfgiscsi 67 SettingUpSoftwareiSCSIwithvicfgiscsi 67 SettingUpDependentHardwareiSCSIwithvicfgiscsi 69 SettingUpIndependentHardwareiSCSIwithvicfgiscsi 70 ListingandSettingiSCSIOptions 71 ListingiSCSIOptionswithESXCLI 71 SettingMTUwithESXCLI 71 ListingandSettingiSCSIOptionswithvicfgiscsi 72 ListingandSettingiSCSIParameters 72 ListingandSettingiSCSIParameterswithESXCLI 72 ReturningParameterstoDefaultInheritance 74 ListingandSettingiSCSIParameterswithvicfgiscsi 74 ReturningParameterstoDefaultInheritance 75 EnablingiSCSIAuthentication 76 EnablingiSCSIAuthenticationwithESXCLI 76 EnablingiSCSIAuthenticationwithvicfgiscsi 77 SettingUpPortsforiSCSIMultipathing 77 ManagingiSCSISessions 78 IntroductiontoiSCSISessionManagement 78 ListingiSCSISessions 79 LoggingintoiSCSISessions 79 RemovingiSCSISessions 79

6 ManagingThirdPartyStorageArrays 81
ManagingNMPwithesxclistoragenmp 81 DeviceManagementwithesxclistoragenmpdevice 82 esxclistoragenmpdevicelist 82 esxclistoragenmpdeviceset 82 ListingPathswithesxclistoragenmppath 82 ManagingPathSelectionPolicyPluginswithesxclistoragenmppsp 82 RetrievingPSPInformation 83 SettingConfigurationParametersforThirdPartyExtensions 83 FixedPathSelectionPolicyOperations 83 RetrievingthePreferredPath 83 \SettingthePreferredPath 84 CustomizingRoundRobinSetup 84 RetrievingPathSelectionSettings 84 SpecifyingConditionsforPathChanges 85 ManagingSATPs 85 RetrievingInformationAboutSATPs 85 AddingSATPRules 85 RemovingSATPRules 86 RetrievingandSettingSATPConfigurationParameters 87 PathClaimingwithesxclistoragecoreclaiming 87 UsingtheReclaimTroubleshootingCommand 88 UnclaimingPathsorSetsofPaths 88 ManagingClaimRules 89 AddingClaimRules 89 ConvertingESX3.5LUNMaskstoClaimRuleFormat 91 RemovingClaimRules 92 ListingClaimRules 92 LoadingClaimRules 92 MovingClaimRules 92 RunningPathClaimingRules 93

VMware, Inc.

vSphere Command-Line Interface Concepts and Examples

7 ManagingUsers 95
UsersandGroupsinthevSphereEnvironment 95 vicfguserCommandSyntax 95 ManagingUserswithvicfguser 96 ManagingGroupswithvicfguser 98

8 ManagingVirtualMachines 101
vmwarecmdOverview 101 ConnectionOptionsforvmwarecmd 102 GeneralOptionsforvmwarecmd 102 FormatforSpecifyingVirtualMachines 102 ListingandRegisteringVirtualMachines 102 RetrievingVirtualMachineAttributes 103 ManagingVirtualMachineSnapshotswithvmwarecmd 104 TakingVirtualMachineSnapshots 104 RevertingandRemovingSnapshots 105 PoweringVirtualMachinesOnandOff 105 ConnectingandDisconnectingVirtualDevices 106 WorkingwiththeAnswerVMAPI 107 ForciblyStoppingVirtualMachineswithEXCLI 107

9 ManagingvSphereNetworking 109
IntroductiontovSphereNetworking 109 NetworkingUsingvSphereStandardSwitches 110 NetworkingUsingvSphereDistributedSwitches 111 RetrievingBasicNetworkingInformation 111 SettingUpvSphereNetworkingwithvSphereStandardSwitches 112 SettingUpVirtualSwitchesandAssociatingaSwitchwithaNetworkInterface 112 RetrievingInformationAboutVirtualSwitches 113 RetrievingInformationaboutVirtualSwitcheswithESXCLI 113 RetrievingInformationaboutVirtualSwitcheswithvicfgvswitch 113 AddingandDeletingVirtualSwitches 113 AddingandDeletingVirtualSwitcheswithESXCLI 113 AddingandDeletingVirtualSwitcheswithvicfgvswitch 114 SettingSwitchAttributeswithesxclinetworkvswitchstandard 114 SettingSwitchAttributeswithvicfgvswitch 114 Checking,Adding,andRemovingPortGroups 115 ManagingPortGroupswithESXCLI 115 ManagingPortGroupswithvicfgvswitch 115 ManagingUplinksandPortGroups 115 ConnectingandDisconnectingUplinkAdaptersandPortGroupswithESXCLI 115 ConnectingandDisconnectingUplinksandPortGroupswithvicfgvswitch 116 SettingthePortGroupVLANID 116 SettingthePortGroupVLANIDwithESXCLI 116 SettingthePortGroupVLANIDwithvicfgvswitch 116 ManagingUplinkAdapters 117 ManagingUplinkAdapterswithesxclinetworknic 117 SpecifyingMultipleUplinkswithESXCLI 118 ManagingUplinkAdapterswithvicfgnics 118 LinkingandUnlinkingUplinkAdapterswithESXCLI 119 LinkingandUnlinkingUplinkAdapterswithvicfgvswitch 119

VMware, Inc.

Contents

AddingandModifyingVMkernelNetworkInterfaces 119 ManagingVMkernelNetworkInterfaceswithESXCLI 120 ManagingVMkernelNetworkInterfaceswithvicfgvmknic 121 SettingUpvSphereNetworkingwithvSphereDistributedSwitch 122 ManagingStandardNetworkingServicesinthevSphereEnvironment 123 SettingtheDNSConfiguration 123 SettingtheDNSConfigurationwithESXCLI 123 SettingtheDNSConfigurationwithvicfgdns 124 AddingandStartinganNTPServer 125 ManagingtheIPGateway 126 UsingvicfgipsecforSecureNetworking 126 UsingIPsecwithESXi 127 ManagingSecurityAssociationswithvicfgipsec 128 ManagingSecurityPolicieswithvicfgipsec 129 UsingesxclinetworkfirewallforESXiFirewallManagement 130

10 MonitoringESXiHosts 131
UsingresxtopforPerformanceMonitoring 131 ManagingDiagnosticPartitions 131 DiagnosticPartitionCreation 132 DiagnosticPartitionManagement 132 ManagingCoreDumps 132 ManagingLocalCoreDumpswithESXCLI 132 ManagingCoreDumpswithESXiDumpCollector 133 ManagingCoreDumpswithvicfgdumppart 133 ConfiguringESXiSyslogServices 134 ManagingESXiSNMPAgentswithvicfgsnmp 135 ConfiguringSNMPCommunities 136 ConfiguringtheSNMPAgenttoSendTraps 136 ConfiguringtheSNMPAgentforPolling 137 ESX,ESXi,andVirtualMachineLogs 137

Index 139

VMware, Inc.

Contents

VMware, Inc.

About This Book

ThevSphereCommandLineInterfaceConceptsandExamplesdocumentationexplainshowtousetheVMware vSphereCommandLineInterface(vCLI)andincludescommandoverviewsandexamples.

Intended Audience
ThisbookisforexperiencedWindowsorLinuxsystemadministratorswhoarefamiliarwithvSphere administrationtasksanddatacenteroperationsandknowhowtousecommandsinscripts.

VMware Technical Publications Glossary


[Link] oftermsastheyareusedinVMwaretechnicaldocumentation,goto[Link]

Document Feedback
[Link],sendyour feedbacktodocfeedback@[Link].

Related Documentation
ThevSphereCommandLineInterfaceReference,availableinthevSphereDocumentationCenter,includes referenceinformationforvicfg-commandsandESXCLIcommands. GettingStartedwithvSphereCommandLineInterfacesincludesinformationaboutavailableCLIs,enablingthe ESXiShell,[Link] commandhierarchies. CommandLineManagementofvSphere5.0forServiceConsoleUsersisforcustomerswhocurrentlyusethe ESX ServiceConsole. ThevSphereSDKforPerldocumentationexplainshowyoucanusethevSphereSDKforPerlandrelated [Link],a ProgrammingGuide,andareferencetothevSphereSDKforPerlUtilityApplications. BackgroundinformationforthetasksdiscussedinthismanualisavailableinthevSpheredocumentationset. ThevSpheredocumentationconsistsofthecombinedvCenterServerandESXidocumentationandincludes informationaboutmanagingstorage,networkingvirtualmachines,andmore.

Technical Support and Education Resources


[Link] ofthisbookandotherbooks,goto[Link]

VMware, Inc.

vSphere Command-Line Interface Concepts and Examples

Online and Telephone Support


Touseonlinesupporttosubmittechnicalsupportrequests,viewyourproductandcontractinformation,and registeryourproducts,goto[Link] Customerswithappropriatesupportcontractsshouldusetelephonesupportforthefastestresponseon [Link][Link]

Support Offerings
TofindouthowVMwaresupportofferingscanhelpmeetyourbusinessneeds,goto [Link]

VMware Professional Services


VMwareEducationServicescoursesofferextensivehandsonlabs,casestudyexamples,andcoursematerials [Link],intheclassroom,andlive [Link] andimplementationbestpractices,VMwareConsultingServicesprovides offeringsto helpyouassess,plan,build,[Link] educationclasses,certificationprograms,andconsultingservices,goto[Link]

10

VMware, Inc.

vSphere CLI Command Overviews

Thischapterintroducesthecommandset,presentssupportedcommandsfordifferentversionsofvSphere, listsconnectionoptions,anddiscussesvCLIandlockdownmode. Thischapterincludesthefollowingtopics:


Introductiononpage 11 ListofAvailableCommandsonpage 12 SupportedPlatformsforCommandsonpage 14 [Link] 16 CommandswithanesxcfgPrefixonpage 16 UsingESXCLIOutputonpage 17 ConnectionOptionsonpage 17 vCLIandLockdownModeonpage 18

Introduction
ThevSphereCLIcommandset,availablesinceESX/ESXi3.5,allowsyoutoperformvSphereconfiguration tasksusingavCLIpackageinstalledonsupportedplatforms,[Link] commandsets. Table 1-1. Components of the vSphere CLI Command Set
vCLI Commands ESXCLIcommands Description ComprehensivesetofcommandsformanagingmostaspectsofvSphere.InvSphere5.0,this [Link],ESXCLIcommandswillreplaceothercommands inthevCLIset. [Link] commandsforasaferenvironment. vicfg- commands SetofcommandsformanyaspectsofvSphere.InvSphere5.0,onlyminorchangesweremade [Link],thesecommandswillbereplacedbyESXCLIcommands. Asetofesxcfg-commandsthatpreciselymirrorsthevicfg-commandsisalsoincludedin thevCLIpackage. Othercommands (vmware-cmd,vifs, vmkfstools) [Link] scheduledtobereplacedbyESXCLIcommands.

[Link] [Link](vMA)toan [Link] vCLIcommandswithconnectionoptionssuchasthetargethost,user,andpasswordoraconfigurationfile. SeeConnectionOptionsonpage 17.


VMware, Inc. 11

vSphere Command-Line Interface Concepts and Examples

Documentation
GettingStartedwithvSphereCommandLineInterfacesincludesinformationaboutavailableCLIs,enablingthe ESXiShell,[Link] hierarchiesforESXCLI. ReferenceinformationforvCLIcommandsisavailableonthevCLIdocumentationpage [Link]

vSphereCommandLineInterfaceReferenceisareferencetovicfg-andrelatedvCLIcommandsand [Link] help. AreferencetoesxtopandresxtopisincludedintheResourceManagementdocumentation.

Command-Line Help
Availablecommandlinehelpdiffersforthedifferentcommands.
Command set vicfgcommands Available Command-Line Help Run<vicfg-cmd> --helpforanoverviewofeachoptions. RunPod2Htmlwithavicfgcommandasinputandpipetheoutputtoafileformoredetailed helpinformation. pod2html [Link] > [Link] ThisoutputcorrespondstotheinformationavailableinthevSphereCommandLineInterface Reference. ESXCLIcommands Run--helpatanylevelofthehierarchyforinformationaboutbothcommandsand namespacesavailablefromthatlevel.

List of Available Commands


Table 12listsallESX/ESXi4.1vCLIcommandsinalphabeticalorderandthecorrespondingESXCLIcommand [Link] vSphere5.0. Table 1-2. vCLI and ESXCLI Commands
vCLI 4.1 Command esxcli vCLI 5.0 Command esxcli(newsyntax) Comment [Link] [Link]-command isnowperformedwithESXCLI. [Link] batchmode. SeeUsingresxtopforPerformanceMonitoringonpage [Link] ResourceManagementdocumentationforadetailedreference. Movesavirtualmachinesconfigurationfile,and,optionally,itsdisks,while thevirtualmachineisrunning. SeeMigratingVirtualMachineswithsvmotiononpage 49. Performsadvancedconfiguration. [Link] typicallyinplaceforspecificworkaroundsordebugging. UsethiscommandasinstructedbyVMware. vicfg-authconfig vicfg-authconfig(No ESXCLIequivalent). vicfg-cfgbackup(No ESXCLIequivalent), Cannotrunagainsta vCenterServersystem. RemotelyconfiguresActiveDirectorysettingsforanESXihost. SeeUsingvicfgauthconfigforActiveDirectoryConfigurationonpage 25. BacksuptheconfigurationdataofanESXisystemandrestorespreviously savedconfigurationdata. SeeBackingUpConfigurationInformationwithvicfgcfgbackupon page 22.
VMware, Inc.

resxtop

resxtop(NoESXCLI equivalent) Supportedonlyon Linux.

svmotion

svmotion(NoESXCLI equivalent) Mustrunagainsta vCenterServersystem.

vicfg-advcfg

esxcli system settings advanced

vicfg-cfgbackup

12

Chapter 1 vSphere CLI Command Overviews

Table 1-2. vCLI and ESXCLI Commands (Continued)


vCLI 4.1 Command vicfg-dns vicfg-dumppart vCLI 5.0 Command esxcli network ip dns esxcli system coredump Comment SpecifiesanESXihostsDNS(DomainNameServer)[Link] SettingtheDNSConfigurationonpage 123. Setsboththepartition(esxcli system coredump partition)andthe network(esxcli system coredump network)[Link] thiscommandtosetupESXiDumpCollector. ManagingDiagnosticPartitionsonpage 131. vicfg-hostops vicfg-hostops(No ESXCLIequivalent) Manageshosts. Stopping,Rebooting,andExaminingHostswithvicfghostopsonpage 21. EnteringandExitingMaintenanceModewithvicfghostopsonpage 22. vicfg-ipsec vicfg-ipsec(No ESXCLIequivalent) SetsupIPsec(InternetProtocolSecurity),whichsecuresIPcommunications comingfromandarrivingatESXihosts.ESXihostssupportIPsecusingIPv6. SeeUsingvicfgipsecforSecureNetworkingonpage 126. vicfg-iscsi esxcli iscsi ManageshardwareandsoftwareiSCSIstorage. SeeManagingiSCSIStorageonpage 53. vicfg-module esxcli system module [Link] document,orasinstructedbyVMware. SeeManagingVMkernelModulesonpage 24. vicfg-mpath vicfg-mpath35 vicfg-nas vicfg-nics vicfg-ntp vicfg-rescan vicfg-route vicfg-scsidevs vicfg-snmp esxcli storage core path esxcli storage nfs esxcli network nic vicfg-ntp(NoESXCLI equivalent) esxcli storage adapter rescan vicfg-route (No ESXCLIequivalent) esxcli storage core adapter vicfg-snmp(No ESXCLIequivalent) Configuresstoragearrays. ManagingPathsonpage 42. ManagesNAS/[Link]/NASDatastoreson page 48. [Link] onpage 117. DefinestheNTP(NetworkTimeProtocol)[Link] NTPServeronpage 125. [Link] page 52. [Link] page 126. [Link] 40. [Link] onpage [Link] thevSphereMonitoringandPerformancedocumentation. NewoptionsaddedinvCLI5.0. vicfg-syslog esxcli system syslog SpecifieslogsettingsforESXihostsincludinglocalstoragepoliciesandserver [Link] Servicesonpage 134. ThevCenterServerandHostManagementdocumentationexplainshowtosetup systemlogsusingthevSphereClient. vicfg-user vicfg-user(No ESXCLIequivalent) Creates,modifies,deletes,andlistslocaldirectaccessusersandgroupsof [Link] 95. ThevSphereSecuritydocumentationdiscussessecurityimplicationsofuser managementandcustomroles. vicfg-vmknic vicfg-volume esxcli network interface. esxcli storage filesystem volume esxcli network vswitch Adds,deletes,[Link] ModifyingVMkernelNetworkInterfacesonpage 119. SupportsresignaturingthecopyofaVMFSvolume,andmountingand [Link] page 29. [Link] SettingUpVirtualSwitchesandAssociatingaSwitchwithaNetwork Interfaceonpage 112.

vicfg-vswitch

VMware, Inc.

13

vSphere Command-Line Interface Concepts and Examples

Table 1-2. vCLI and ESXCLI Commands (Continued)


vCLI 4.1 Command vifs vCLI 5.0 Command vifs(NoESXCLI equivalent) Runesxcli software vibagainstESXi5.0. Runvihostupdate againstESX/ESXi4.x. Runvihostupdate35 againstESX/ESXi3.5. vmkfstools vmkfstools(No ESXCLIequivalent) vmware-cmd(No ESXCLIequivalent) Createsandmanipulatesvirtualdisks,filesystems,logicalvolumes,and [Link] FileSystemwithvmkfstoolsonpage 28. [Link],forexample, creatingasnapshot,poweringthevirtualmachineonoroff,andgetting [Link] page 101. Comment Performsfilesystemoperationssuchasretrievinganduploadingfilesonthe [Link] vmkfstoolsonpage 28. UpdatesESXihoststoadifferentversionofthesamemajorrelease. YoucannotrunvihostupdateagainstESXi5.0hosts. SeeManagingVMkernelModulesonpage 24.

vihostupdate vihostupdate35

vmware-cmd

Supported Platforms for Commands


[Link] meansthatyoucanconnecttoavCenterServersystemanduse--vihosttospecifytheESXihosttorunthe [Link],whichyoucanrunagainstvCenterServersystems,but notagainstESXisystems. ThefollowingcommandsmusthaveanESXisystem,notavCenterServersystemtarget.

vicfg-snmp vifs vicfg-user vicfg-cfgbackup vihostupdate vmkfstools vicfg-ipsec resxtop

YoucannotrunthevihostupdatecommandagainstanESXi5.0system. Youcannotrunthevihostupdateandvicfg-mpathcommandsthatareinavCLI4.0orlaterinstallation againstESX/[Link],runvihostupdate35andvicfg-mpath35,includedin [Link],againstthosesystems.vihostupdate35issupportedforESXi,butnotforESX. Youcannotrunvicfg-syslog --setserverorvicfg-syslog --setportwithanESXi5.0target. [Link]/ESXi3.5systems,youcanuseonlytheoptions supportedbythosesystems. SeetheVMwareInfrastructureRemoteCommandLineInterfaceInstallationandReferenceGuideforESX/ESXi3.5 [Link],selectResources>Documentationfromthe [Link] supportedagainsthostsrunningESX/ESXi3.5Update2orlatereventhoughtheywerenotsupportedinRCLI version3.5. [Link]--helpforinformationaboutoptionsupportwithESX/ESXi3.5Update 2,or seetheVMwareknowledgebasearticleat[Link]

14

VMware, Inc.

Chapter 1 vSphere CLI Command Overviews

Table [Link] [Link],however,[Link] targetESX/ESXi3.5Update2hosts. Table 1-3. Platform Support for vCLI 5.x Commands
Command esxcli resxtop svmotion vicfg-advcfg vicfg-authconfig vicfg-cfgbackup vicfg-dns vicfg-dumppart vicfg-hostops vicfg-ipsec vicfg-iscsi vicfg-module vicfg-mpath vicfg-nas vicfg-nics vicfg-ntp vicfg-rescan vicfg-route vicfg-scsidevs vicfg-snmp vicfg-syslog vicfg-user vicfg-vmhbadevs vicfg-vmknic vicfg-volume vicfg-vswitch vifs vihostupdate ESXi 5.0 Yes Yes(from Linux) No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes VC 5.0 Yes Yes(from Linux) Yes Yes Yes No Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes No Nofor5.0 target No ESXi 4.x Yes Yes(from Linux) No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes ESX 4.x Yes Yes(from Linux) No Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes VC 4.x No Yes(from Linux) Yes Yes Yes No Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No ESXi 3.5 U2+ No Yes(from Linux) No Yes No Yes Yes Yes No No No Yes ESX 3.5 U2+ No Yes(from Linux) No Yes No No Yes Yes No No No Yes

Usevicfg-mpath35instead. Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes No Yes Yes Use vihostupdate35 instead Yes Yes Yes Yes Yes Yes Yes Yes Yes No Yes No Yes Yes Yes No Yes Yes No

[Link]-scsidevsinstead. Yes Yes Yes Yes Yes Yes Yes No Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes Yes No No

Useesxcli software vibinstead. Yes Yes No No No Yes No No

vmkfstools vmware-cmd vicfg-mpath35 vihostupdate35

Yes Yes No No

Yes Yes No No

No Yes No No

Yes Yes Yes No

VMware, Inc.

15

vSphere Command-Line Interface Concepts and Examples

Running ESXCLI Commands Against ESXi 4.x Hosts


WhenyourunanESXCLIvCLIcommand,youmustknowthecommandssupportedonthetargethost specifiedwith--serverorasavMAtarget.

[Link],[Link]. IfyouruncommandsagainstESXi5.0hosts,ESXCLI5.0commandsaresupported.

VMwarepartnersmightdevelopcustomESXCLIcommandsthatyoucanrunonhostswherethepartnerVIB hasbeeninstalled. Runesxcli --server <target> --[Link] downintothenamespacesforadditionalhelp. [Link] notruncommandswith--serverpointingtoavCenterServersystemevenifyouinstallvCLI5.0.

Commands with an esxcfg Prefix


FormanyofthevCLIcommands,youmighthaveusedscriptswithcorrespondingserviceconsolecommands [Link]/[Link] versionsofESXi,acopyofeachvicfg-commandthatusesanesxcfg-prefixisincludedinthevCLIpackage. [Link] theesxcfgprefixareavailablemainlyforcompatibilityreasonsandmightbecomeobsolete. vCLIesxcfg-commandsareequivalenttovicfg-commands,butnotcompletelyequivalenttothe deprecatedesxcfg- serviceconsolecommands. Table 14listsallvCLIcommandsforwhichavCLIcommandwithanesxcfgprefixisavailable. Table 1-4. Commands with an esxcfg Prefix
Command with vicfg prefix vicfg-advcfg vicfg-cfgbackup vicfg-dns vicfg-dumppart vicfg-module vicfg-mpath vicfg-nas vicfg-nics vicfg-ntp vicfg-rescan vicfg-route vicfg-scsidevs vicfg-snmp vicfg-syslog vicfg-vmknic vicfg-volume vicfg-vswitch Command with esxcfg prefix esxcfg-advcfg esxcfg-cfgbackup esxcfg-dns esxcfg-dumppart esxcfg-module esxcfg-mpath esxcfg-nas esxcfg-nics esxcfg-ntp esxcfg-rescan esxcfg-route esxcfg-scsidevs esxcfg-snmp esxcfg-syslog esxcfg-vmknic esxcfg-volume esxcfg-vswitch

16

VMware, Inc.

Chapter 1 vSphere CLI Command Overviews

Using ESXCLI Output


[Link] the--formatterdispatcheroptionandsendtheresultingoutputasinputtoaparser. The--formatteroptionssupportsthreevalues,csv,xml,andkeyvalueandisusedbeforeanynamespace.
esxcli --formatter=csv storage filesystem list

ListsallfilesysteminformationinCSVformat. Youcanpipetheoutputtoafile.
esxcli --formatter=keyvalue storage filesystem list > [Link]

IMPORTANTAlwaysuseaformatterforconsistentoutput.

Connection Options
Table [Link] use<conn_options>toindicatethepositionofconnectionoptions. Forexample,esxcli <conn_options> filesystem nfs listmeansthatyoucoulduseaconfiguration file,asessionfile,orjustspecifyatargetserverandrespondwithausernameandpasswordwhenprompted. Thetableincludesoptionsforuseonthecommandlineandvariablesforuseinconfigurationfiles. IMPORTANTForconnections,vCLIsupportsonlytheIPv4protocol,[Link],however, configureIPv6onthetargethostwithseveralofthenetworkingcommands. SeetheGettingStartedwithvSphereCommandLineInterfacesdocumentationforadditionalinformationand examples. Table 1-5. vCLI Connection Options
Option and Environment Variable --cacertsfile <certsfile> -t <certs_file> VI_CACERTFILE=<cert_file_path> --config <cfg_file_full_path> VI_CONFIG=<cfg_file_full_path> --credstore <credstore> Description ESXCLIcommandsonly. UsedtospecifytheCA(CertificateAuthority)certificatefile,inPEMformat, toverifytheidentityofthevCenterServersystemorESXisystemtorunthe [Link],forexample,topreventmaninthemiddleattack. Usestheconfigurationfileatthespecifiedlocation. Specifyapaththatisreadablefromthecurrentdirectory. [Link] <HOME>/.vmware/credstore/[Link] <APPDATA>/VMware/credstore/[Link]. CommandsforsettingupthecredentialstoreareincludedinthevSphere SDKforPerl,[Link] ProgrammingGuideexplainshowtomanagethecredentialstore. [Link].

--encoding <encoding> VI_ENCODING=<encoding>

cp936(SimplifiedChinese) shftjis(Japanese) cp850(GermanandFrench).

Youcanuse--encodingtospecifytheencodingvCLIshouldmaptowhenit isrunonaforeignlanguagesystem. --passthroughauth VI_PASSTHROUGHAUTH Ifyouspecifythisoption,thesystemusestheMicrosoftWindowsSecurity SupportProviderInterface(SSPI)[Link] [Link] detaileddiscussionofSSPI. ThisoptionissupportedonlyifyouarerunningvCLIonaWindowssystem andareconnectingtoavCenterServersystem.

VMware, Inc.

17

vSphere Command-Line Interface Concepts and Examples

Table 1-5. vCLI Connection Options (Continued)


Option and Environment Variable --passthroughauthpackage <package> VI_PASSTHROUGHAUTHPACKAGE= <package> Description Usethisoptionwith--passthroughauthtospecifyadomainlevel [Link],SSPIusesthe Negotiateprotocol,whichmeansthatclientandservertrytonegotiatea protocolthatbothsupport. IfthevCenterServersystemtowhichyouareconnectingisconfiguredtouse aspecificprotocol,youcanspecifythatprotocolusingthisoption. ThisoptionissupportedonlyifyouarerunningvCLIonaWindowssystem andconnectingtoavCenterServersystem. --password <passwd> VI_PASSWORD=<passwd> Usesthespecifiedpassword(usedwith--username)tologintotheserver.

If--serverspecifiesavCenterServersystem,theusernameand [Link] system,youneednoadditionalauthenticationtoruncommandsonthe ESXihoststhatservermanages. If--serverspecifiesanESXihost,theusernameandpasswordapplyto thatserver.

Usetheemptystring(' 'onLinuxand onWindows)toindicateno password. Ifyoudonotspecifyausernameandpasswordonthecommandline,the systempromptsyouanddoesnotechoyourinputtothescreen. --portnumber <number> VI_PORTNUMBER=<number> --protocol <HTTP|HTTPS> VI_PROTOCOL=<HTTP|HTTPS> --savesessionfile <file> VI_SAVESESSIONFILE=<file> --server <server> VI_SERVER=<server> Usesthespecifiedporttoconnecttothesystemspecifiedby--server. Defaultis443. Usesthespecifiedprotocoltoconnecttothesystemspecifiedby--server. DefaultisHTTPS. Savesasessiontothespecifiedfile.Thesessionexpiresifitisnotusedfor30 minutes. [Link]. If--serverpointstoavCenterServersystem,youusethe--vihostoption [Link] issupportedforvCenterServerifthe--vihostoptionisdefined. [Link] /sdk/webService. [Link] mustbeunexpired. ConnectstothespecifiedvSphereWebServicesSDKURL. Usesthespecifiedusername.

--servicepath <path> VI_SERVICEPATH=<path> --sessionfile <file> VI_SESSIONFILE=<file> --url <url> VI_URL=<url> --username <u_name> VI_USERNAME=<u_name>

If--serverspecifiesavCenterServersystem,theusernameand [Link] system,youneednoadditionalauthenticationtoruncommandsonthe ESXihoststhatservermanages. If--serverspecifiesanESXisystem,theusernameandpasswordapply tothatsystem.

Ifyoudonotspecifyausernameandpasswordonthecommandline,the systempromptsyouanddoesnotechoyourinputtothescreen. --vihost <host> -h <host WhenyourunavSphereCLIcommandwiththe--serveroptionpointing toavCenterServersystem,use--vihosttospecifytheESXihosttorunthe commandagainst. NOTE:[Link],the optionisincludedintheindividualcommandoptionlist.

18

VMware, Inc.

Chapter 1 vSphere CLI Command Overviews

vCLI and Lockdown Mode


Foradditionalsecurity,anadministratorcanplaceoneormorehostsmanagedbyavCenterServersystemin [Link].

UsersthatwereloggedintotheESXiShellbeforelockdownmodewasenabledremainloggedinandcan runcommands,however,thoseuserscannotdisablelockdownmode. Nootherusers,includingtherootusers,[Link] accesstheshellfromthedirectconsoleorbyusingaremoteshell.

Youcandisablelockdownmodeasfollows.

TheadministratoruseronthevCenterServersystemcandisablelockdownmodeforhostsitmanages fromthevCenterServersystem. [Link] directconsoleisdisabled,[Link] thehostisnotmanagedbyavCenterServersystemorifthehostisunreachable,youmustreinstallESXi.

TomakechangestoESXisystemsinlockdownmode,youmustgothroughavCenterServersystemthat managestheESXisystemastheuservpxuser. esxcli --server MyVC --vihost MyESXi storage filesystem list ThecommandpromptsforthevCenterServersystemusernameandpassword. [Link] commandscannotrunagainstvCenterServersystemsandarethereforenotavailableinlockdownmode:

vicfg-snmp vifs vicfg-user vicfg-cfgbackup vihostupdate vmkfstools vicfg-ipsec

IfyouhaveproblemsrunningacommandonanESXihostdirectly(withoutspecifyingavCenterServer target),checkwhetherlockdownmodeisenabledonthathost. ThevSphereSecuritydocumentationdiscusseslockdownmodeindetail.

VMware, Inc.

19

vSphere Command-Line Interface Concepts and Examples

20

VMware, Inc.

Managing Hosts

HostmanagementcommandscanstopandrebootESXihosts,backupconfigurationinformation,andmanage [Link] domainorexitfromadomain. Thechapterincludesthefollowingtopics:


Stopping,Rebooting,andExaminingHostswithvicfghostopsonpage 21 EnteringandExitingMaintenanceModewithvicfghostopsonpage 22 BackingUpConfigurationInformationwithvicfgcfgbackuponpage 22 ManagingVMkernelModulesonpage 24 UsingvicfgauthconfigforActiveDirectoryConfigurationonpage 25 UpdatingHostsonpage 26

ForinformationonupdatingESXi5.0hostswiththeesxcli softwarecommandandonchangingthehost acceptanceleveltomatchthelevelofaVIBthatyoumightwanttouseforanupdate,seethevSphereUpgrade documentation.

Stopping, Rebooting, and Examining Hosts with vicfg-hostops


YoucanshutdownorrebootanESXihostusingthevSphereClientorthevicfg-hostopsvCLIcommand. NoequivalentESXCLIcommandiscurrentlyavailable. ShuttingdownamanagedhostdisconnectsitfromthevCenterServersystem,butdoesnotremovethehost [Link] optionslistedinConnectionOptionsonpage 17inplaceof<conn_options>.

[Link]-hostopswith--operationshutdown.

Ifthehostisinmaintenancemode,runthecommandwithoutthe--forceoption.
vicfg-hostops <conn_options> --operation shutdown

Ifthehostisnotinmaintenancemode,use--forcetoshutdownthehostandallrunningvirtual machines.
vicfg-hostops <conn_options> --operation shutdown --force

[Link],specify--clusteror --datacenter.
vicfg-hostops <conn_options> --operation shutdown --cluster <my_cluster> vicfg-hostops <conn_options> --operation shutdown --datacenter <my_datacenter>

Youcanrebootasinglehostorallhostsinadatacenterorcluster.

[Link]-hostopswith--operationreboot.

VMware, Inc.

21

vSphere Command-Line Interface Concepts and Examples

Ifthehostisinmaintenancemode,runthecommandwithoutthe--forceoption.
vicfg-hostops <conn_options> --operation reboot

Ifthehostisnotinmaintenancemode,use--forcetoshutdownthehostandallrunningvirtual machines.
vicfg-hostops <conn_options> --operation reboot --force

[Link]--clusteror--datacentertorebootallhostsina clusterordatacenter.
vicfg-hostops <conn_options> --operation reboot --cluster <my_cluster> vicfg-hostops <conn_options> --operation reboot --datacenter <my_datacenter>

Youcandisplayinformationaboutahostbyrunningvicfg-hostopswith--operationinfo.
vicfg-hostops <conn_options> --operation info

Thecommandreturnsthehostname,manufacturer,model,processortype,CPUcores,memorycapacity,and [Link] mode.

Entering and Exiting Maintenance Mode with vicfg-hostops


Youplaceahostinmaintenancemodetoserviceit,forexample,[Link] leavesmaintenancemodeonlyastheresultofauserrequest. vicfg-hostopssuspendsvirtualmachinesbydefault,orpowersoffthevirtualmachineifyourun vicfg-hostops --action poweroff. [Link]. ThehostisinastateofEnteringMaintenanceModeuntilallrunningvirtualmachinesaresuspendedor [Link],youcannotpoweronvirtualmachinesonitormigrate virtualmachinestoit. Whenyourunthevicfg-hostopsvCLIcommand,youcanspecifyoneoftheoptionslistedinConnection Optionsonpage 17inplaceof<conn_options>. To enter maintenance mode 1 2 Runvicfg-hostops <conn_options> --operation entertoentermaintenancemode. Runvicfg-hostops <conn_options> --operation infotocheckwhetherthehostisinmaintenance modeorintheEnteringMaintenanceModestate.

Afterallvirtualmachinesonthehosthavebeensuspendedormigrated,thehostentersmaintenancemode. Youcannotdeployorpoweronavirtualmachineonhostsinmaintenancemode. Youcanputallhostsinaclusterordatacenterinmaintenancemodebyusingthe--clusteror--datacenter [Link] problem. Youcanlaterrunvicfg-hostops <conn_options> --operation exittoexitmaintenancemode.

Backing Up Configuration Information with vicfg-cfgbackup


AfteryouconfigureanESXihost,[Link] configurationafteryouchangetheconfigurationorupgradetheESXiimage. [Link] [Link].

22

VMware, Inc.

Chapter 2 Managing Hosts

Backup Tasks
Duringaconfigurationbackup,[Link] [Link](ESXi Embedded)orperformarepairoperation(ESXiInstallable). Youcanbackupandrestoreconfigurationinformationasfollows. 1 2 3 Backuptheconfigurationbyusingthevicfg-cfgbackupcommand. RuntheRecoveryCDorrepairoperation Restoretheconfigurationbyusingthevicfg-cfgbackupcommand.

Whenyourestoreaconfiguration,youmustmakesurethatallvirtualmachinesonthehostarestopped.

Backing Up Configuration Data


Youcanbackupconfigurationdatabyrunningvicfg-cfgbackupwiththe-soption.
vicfg-cfgbackup <conn_options> -s /tmp/ESXi_181842_backup.txt

Forthebackupfilename,includethenumberofthebuildthatisrunningonthehostthatyouarebackingup. IfyouarerunningvCLIonvMA,[Link] locallybecausevirtualappliancesarestoredinthe/vmfs/volumes/<datastore>directoryonthehost, whichisseparatefromtheESXiimageandconfigurationfiles.

Restoring Configuration Data


Ifyouhavecreatedabackup,[Link] data,thenumberofthebuildrunningonthehostmustbethesameasthenumberofthebuildthatwas [Link],includethe-f (force)option. To restore ESXi configuration data 1 2 3 Poweroffallvirtualmachinesthatarerunningonthehostthatyouwanttorestore. LogintoahostonwhichvCLIisinstalled,orlogintovMA. Runvicfg-cfgbackupwiththe-lflagtoloadthehostconfigurationfromthespecifiedbackupfile. SpecifyoneoftheoptionslistedinConnectionOptionsonpage 17inplaceof<conn_options>.

Ifyourunthefollowingcommand,youarepromptedforconfirmation.
vicfg-cfgbackup <conn_options> -l /tmp/ESXi_181842_backup.tgz

Ifyourunthefollowingcommand,youarenotpromptedforconfirmation.
vicfg-cfgbackup <conn_options> -l /tmp/ESXi_181842_backup.tgz -q

Torestorethehosttofactorysettings,runvicfg-cfgbackupwiththe-roption:
vicfg-cfgbackup <conn_options> -r

Using vicfg-cfgbackup from vMA


Tobackupahostconfiguration,[Link] runonthetargethost(thehostthatyouarebackinguporrestoring),oronaremotehost. Torestoreahostconfiguration,youmustrunvicfg-cfgbackup fromavMAinstancerunningonaremote [Link],whichmeansallvirtualmachines(includingvMA)mustbe suspendedonthetargethost. Forexample,abackupoperationfortwoESXihosts(host1andhost2)withvMAdeployedonbothhostsworks asfollows:

Tobackuponeofthehostsconfiguration(host1orhost2),runvicfg-cfgbackupfromthevMA [Link]--serveroptiontospecifythehostforwhichyou [Link].


23

VMware, Inc.

vSphere Command-Line Interface Concepts and Examples

Torestorethehost1configuration,[Link] the--serveroptiontopointtohost1torestoretheconfigurationtothathost. Torestorethehost2configuration,[Link] the--serveroptiontopointtohost2torestoretheconfigurationtothathost.

Managing VMkernel Modules


Theesxcli system moduleandvicfg-modulecommandssupportsettingandretrievingVMkernelmodule options. vicfg-moduleandesxcli system modulecommandsareimplementationsofthedeprecated [Link]-module [Link]-moduleandesxcli system modulearecommonlyusedwhenVMwareTechnicalSupport, aKnowledgeBasearticle,orVMwaredocumentationinstructyoutodoso.

Managing Modules with esxcli system module


[Link] [Link] Optionsonpage 17inplaceof<conn_options>. To examine, enable, and set NetQueue VMkernel modules 1 ListinformationabouttheNetQueuemodule.
esxcli <conn_options> system module list -module=s2io

Thesystemreturnsthename,type,value,anddescriptionofthemodule. 2 (Optional)Listallenabledorloadedmodules.
esxcli <conn_options> system module list --enabled=true esxcli <conn_options> system module list --loaded=true

EnabletheNetQueuemodel.
esxcli <conn_options> system module set --module=s2io --enabled=true

Settheparameter.
esxcli system module parameters set --module s2io --parameter-string="rx_ring_num=8"

VerifythattheNetQueuemoduleisconfigured.
esxcli <conn_options> system module parameters list --module=s2io

Managing Modules with vicfg-module


[Link] [Link] Optionsonpage 17inplaceof<conn_options>. To examine and set NetQueue VMkernel modules 1 Runvicfg-module --listtolistthemodulesonthehost.
vicfg-module <conn_options> --list

Runvicfg-module --set-optionswithconnectionoptions,theoptionstringtobepassedtoamodule, [Link]:


vicfg-module <conn_options> --set-options 'rx_ring_num=8' s2io

ConfiguresasupportednetworkinterfacetouseNetQueue.

24

VMware, Inc.

Chapter 2 Managing Hosts

Toretrievetheoptionstringthatisconfiguredtobepassedtoamodulewhenthemoduleisloaded,run vicfg-module --[Link] module.


vicfg-module <conn_options> --get-options s2io

VerifiesthattheNetQueuemoduleisconfigured.

Using vicfg-authconfig for Active Directory Configuration


[Link] servicesandforremoteaccessthroughthevSphereWebServicesSDK,vSphereClient,PowerCLI,and [Link],asdiscussedinthevCenter ServerandHostManagementdocumentation,orusevicfg-autconfig. [Link] supportedandactiveauthenticationmechanisms,listthecurrentdomain,andjoinorpartfromanActive [Link],youmustpreparethehost. IMPORTANTAllhoststhatjoinActiveDirectorymustalsobemanagedbyanNTPServertoavoidissueswith clockskewsandKerberostickets. To prepare ESXi hosts for Active Directory Integration 1 MakesuretheESXisystemandtheActiveDirectoryserverareusingthesametimezonebyconfiguring ESXiandADtousesameNTPserver. TheESXisystemstimezoneisalwayssettoUTC. 2 ConfiguretheESXisystemsDNStobeintheActiveDirectorydomain.

[Link]-authconfigto configureActiveDirectorysettingsmusthavetheappropriateActiveDirectorypermissions,andmusthave [Link] vCenterServersystem,specifyingthehostwith--vihost. To set up Active Directory 1 2 3 4 InstalltheESXihost,asexplainedinthevSphereInstallationandSetupdocumentation. InstallWindowsActiveDirectoryonaWindowsServerthatrunsWindows2000,Windows2003,or [Link]. SynchronizetimebetweentheESXisystemandWindowsActiveDirectory(AD). TestthattheWindowsADServercanpingtheESXihostbyusingthehostname.
ping <ESX_hostname>

Runvicfg-authcofigtoaddthehosttotheActiveDirectorydomain.
vicfg-authconfig --server=<ESXi Server IP Address> --username=<ESXi Server Admin Username> --password=<ESXi Server Admin User's Password> --authscheme AD --joindomain <AD Domain Name> --adusername=<Active Directory Administrator User Name> --adpassword=<Active Directory Administrator User's Password>

Thesystempromptsforusernamesandpasswordsifyoudonotspecifythemonthecommandline. Passwordsarenotechoedtothescreen. 6 7 CheckthataSuccessfully Joined <Domain Name>messageappears. VerifytheESXihostisintheintendedWindowsADdomain.


vicfg-authconfig --server [Link] --authscheme AD -c

YouarepromptedforausernameandpasswordfortheESXisystem.

VMware, Inc.

25

vSphere Command-Line Interface Concepts and Examples

Updating Hosts
Whenyouaddcustomdriversorpatchestoahost,theprocessiscalledanupdate.

UpdateESXi4.0andESXi4.1hostswiththevihostupdatecommand,asdiscussedinthevSphere CommandLineInterfaceInstallationandReferenceGuideincludedinthevSphere4.1documentationset. UpdateESXi5.0hostswithesxcli software vibcommandsdiscussedinthevSphereUpgrade [Link] commandagainstanESXi5.0host.

26

VMware, Inc.

Managing Files

[Link] (VirtualMachineFileSystem)[Link]. NOTESeeManagingStorageonpage 37forinformationaboutstoragemanipulationcommands. Thischapterincludesthefollowingtopics:


IntroductiontoVirtualMachineFileManagementonpage 27 ManagingtheVirtualMachineFileSystemwithvmkfstoolsonpage 28 UpgradingVMFS3VolumestoVMFS5onpage 29 ManagingVMFSVolumesonpage 29 DetachingDevicesandRemovingaLUNonpage 32 WorkingwithPermanentDeviceLossonpage 33 UsingvifstoManipulateFilesonRemoteESXiHostsonpage 33

Introduction to Virtual Machine File Management


YoucanusethevSphereClientorvCLItoaccessdifferenttypesofstoragedevicesthatyourESXihost discoversandtodeploydatastoresonthosedevices. NOTEDatastoresarelogicalcontainers,analogoustofilesystems,thathidespecificsofeachstoragedevice [Link], virtualmachinetemplates,[Link] manualusesthetermdatastoreandVMFS(orNFS)volumetorefertothesamelogicalcontaineronthe physicaldevice. Dependingonthetypeofstorageyouuse,datastorescanbebackedbythefollowingfilesystemformats:

VirtualMachineFileSystem(VMFS).Highperformancefilesystemthatisoptimizedforstoringvirtual [Link], [Link],your virtualmachinecanhavedirectaccesstorawdevicesanduseamappingfile(RDM)asaproxy. YoumanageVMFSandRDMswiththevSphereClientorthevmkfstoolsutility.

NetworkFileSystem(NFS).FilesystemonaNASstoragedevice.ESXisupportsNFSversion3over TCP/[Link],mountthevolume,and useitforanystorageneeds. YoumanageNASstoragedeviceswiththeesxcli storage nfscommand.

VMware, Inc.

27

vSphere Command-Line Interface Concepts and Examples

Figure 3-1. Virtual Machines Accessing Different Types of Storage


Host requires TCP/IP connectivity virtual machine virtual machine virtual machine virtual machine virtual machine

local ethernet SCSI bre channel HBA SAN iSCSI hardware initiator LAN software initiator ethernet NIC LAN ethernet NIC LAN

VMFS

Key
physical disk

datastore VMFS fibre array VMFS iSCSI array NFS NAS appliance

virtual disk

Managing the Virtual Machine File System with vmkfstools


[Link] [Link],encapsulatedinasetoffiles,occupiesaseparatesingle [Link],VMFSpreservestheinternalfilesystem semantics. Inaddition,youcanusetheVMFSdatastorestostoreotherfiles,suchasvirtualmachinetemplatesandISO [Link], includingdatabases,ERP,andCRM,[Link]. YouusethevmkfstoolsvCLItocreateandmanipulatevirtualdisks,filesystems,logicalvolumes,and [Link] system(VMFS)onaphysicalpartitionofadiskandtomanipulatefiles,suchasvirtualdisks,storedon [Link](RDMs). IMPORTANTThevmkfstoolsvCLIsupportsmostbutnotalloftheoptionsthatthevmkfstoolsESXiShell commandsupports.SeeVMwareKnowledgeBasearticle1008194. Youcannotrunvmkfstoolswith--serverpointingtoavCenterServersystem. ThevSphereStoragedocumentationincludesacompletereferencetothevmkfstoolscommandthatyoucan [Link] oftheconnectionoptionslistedinConnectionOptionsonpage 17inplaceof<conn_options>. ThefollowingoptionssupportedbythevmkfstoolsESXiShellcommandarenotsupportedbythe vmkfstoolsvCLIcommand.

--breaklock -B --chainConsistent -e --eagerzero -k --fix -x --lock -L --migratevirtualdisk -M --parseimage -Y --punchzero -K --snapshotdisk -I --verbose -v

28

VMware, Inc.

Chapter 3 Managing Files

Upgrading VMFS3 Volumes to VMFS5


vSphere5.0supportsVMFS5volumes,[Link] fromVMFS3toVMFS5byusingthevSphereClient,thevmkfstoolsESXiShellcommand,ortheesxcli storage vmfs [Link]. IMPORTANTYoucannotupgradeVMFS3volumestoVMFS5withthevmkfstoolscommandincludedin vSphereCLI.

Managing VMFS Volumes


Differentcommandsareavailableforlisting,mounting,andunmountingVMFSvolumesandforlisting, mounting,andunmountingVMFSsnapshotvolumes.

ManagingVMFSvolumes esxcli storage filesystem listshowsallvolumes,mountedandunmounted,thatareresolved, thatis,thatarenotsnapshotvolumes. esxcli storage filesystem [Link] forsnapshotvolumesorresolvedvolumes.

Managingsnapshotvolumes esxcli storage vmfs snapshotcommandscanbeusedforlisting,mounting,andresignaturing [Link] 29andResignaturing VMFSCopiesonpage 30.

Managing Duplicate VMFS Datastores


[Link] theLUNisreplicatedorwhenasnapshotismade,theresultingLUNcopyisidentical,byteforbyte,tothe [Link],iftheoriginalLUNcontainsaVMFSdatastorewithUUIDX,theLUNcopyappears tocontainanidenticalVMFSdatastore,oraVMFSdatastorecopy,withthesameUUIDX. ESXihostscandeterminewhetheraLUNcontainstheVMFSdatastorecopy,andeithermountthedatastore copywithitsoriginalUUIDorchangetheUUIDtoresignaturethedatastore. WhenaLUNcontainsaVMFSdatastorecopy,youcanmountthedatastorewiththeexistingsignatureor [Link].

Mounting Datastores with Existing Signatures


[Link] example,youcanmaintainsynchronizedcopiesofvirtualmachinesatasecondarysiteaspartofadisaster [Link],youcanmountthedatastorecopyandpoweron thevirtualmachinesatthesecondarysite. IMPORTANTYoucanmountaVMFSdatastoreonlyifitdoesnotconflictwithanalreadymountedVMFS datastorethathasthesameUUID. WhenyoumounttheVMFSdatastore,ESXiallowsbothreadandwriteoperationstothedatastorethatresides [Link] systemreboots. Youcanmountadatastorewithvicfg-volume(seeTomountadatastorewithvicfgvolumeonpage 30)or withESXCLI(seeTomountadatastorewithESXCLIonpage 30).

VMware, Inc.

29

vSphere Command-Line Interface Concepts and Examples

Mounting and Unmounting with ESXCLI


Theesxcli storage [Link] specifywhethertopersistthemountedvolumesacrossrebootsbyusingthe--no-persistoption. Usetheesxcli storage filesystemcommandtolistmountedvolumes,mountnewvolumes,and [Link] 17inplace of<conn_options>. To mount a datastore with ESXCLI 1 Listallvolumesthathavebeendetectedassnapshots.
esxcli <conn_options> storage filesystem list

Runesxcli storage filesystem mountwiththevolumelabelorvolumeUUID. Bydefault,thevolumeismountedpersistently,use--no-persisttomountpersistently.


esxcli <conn_options> storage filesystem volume mount --volume-label=<label>|--volume-uuid=<VMFS-UUID>

Thiscommandfailsiftheoriginalcopyisonline. Youcanlaterrunesxcli storage filesystem volume unmounttounmountthesnapshotvolume.


esxcli <conn_options> storage filesystem volume unmount --volume-label=<label>|--volume-uuid=<VMFS-UUID>

Mounting and Unmounting with vicfg-volume


Usethevicfg-volumecommandtolistmountedvolumes,mountnewvolumes,andunmountavolume. SpecifyoneoftheconnectionoptionslistedinConnectionOptionsonpage 17inplaceof<conn_options>. To mount a datastore with vicfg-volume 1 Listallvolumesthathavebeendetectedassnapshotsorreplicas.
vicfg-volume <conn_options> --list

Runvicfg-volume --persistent-mount withtheVMFSUUIDorlabelasanargumenttomounta volume.


vicfg-volume <conn_options> --persistent-mount <VMFS-UUID|label>

Thiscommandfailsiftheoriginalcopyisonline. Youcanlaterrunvicfg-volume --unmounttounmountthesnapshotorreplicavolume.


vicfg-volume <conn_options> --unmount <VMFS-UUID|label>

Thevicfg-volumecommandsupportsresignaturingasnapshotvolumeandmountingandunmountingthe [Link] volumesandoriginalvolumes.

Resignaturing VMFS Copies


[Link] copy,theESXihostassignsanewUUIDandanewlabeltothecopy,andmountsthecopyasadatastore [Link],unmountthe datastorebeforeresignaturing. Thedefaultformatofthenewlabelassignedtothedatastoreissnap-<snapID>-<oldLabel>,where <snapID>isanintegerand<oldLabel>isthelabeloftheoriginaldatastore. Whenyouperformdatastoreresignaturing,considerthefollowingpoints:

Datastoreresignaturingisirreversible. TheLUNcopythatcontainstheVMFSdatastorethatyouresignatureisnolongertreatedasaLUNcopy.

30

VMware, Inc.

Chapter 3 Managing Files

Aspanneddatastorecanberesignaturedonlyifallitsextentsareonline. [Link],youcanresumeitlater. YoucanmountthenewVMFSdatastorewithoutariskofitsUUIDconflictingwithUUIDsofanyother datastore,suchasanancestororchildinahierarchyofLUNsnapshots.

YoucanresignatureaVMFScopywithESXCLI(seeResignaturingaVMFSCopywithESXCLIonpage 31) orwithvicfg-volumeseeResignaturingaVMFSCopywithvicfgvolumeonpage 31.

Resignaturing a VMFS Copy with ESXCLI


Theesxcli storage vmfs [Link] theconnectionoptionslistedinConnectionOptionsonpage 17inplaceof<conn_options>. To resignature a VMFS copy with ESXCLI 1 Listunresolvedsnapshotsorreplicavolumes.
esxcli <conn_options> storage vmfs snapshot list

(Optional)Unmountthecopy.
esxcli <conn_options> storage filesystem unmount

Runtheresignaturecommand.
esxcli <conn_options> storage vmfs snapshot resignature --volume-label=<label>|--volume-uuid=<id>

Thecommandreturnstothepromptorsignalsanerror. Afterresignaturing,youmighthavetodothefollowing:

Iftheresignatureddatastorecontainsvirtualmachines,updatereferencestotheoriginalVMFSdatastore inthevirtualmachinefiles,[Link],.vmdk,.vmsd,[Link]. Topoweronvirtualmachines,registerthemwiththevCenterServersystem.

Resignaturing a VMFS Copy with vicfg-volume


Youcanusevicfg-volumetomount,unmount,andresignatureVMFSvolumes. To resignature a VMFS copy with vicfg-volume 1 2 Makesurethecopyisnotmounted. Runvicfg-volumewiththeresignatureoption.
vicfg-volume <conn_options> --resignature <VMFS-UUID|label>

Thecommandreturnstothepromptorsignalsanerror.

VMware, Inc.

31

vSphere Command-Line Interface Concepts and Examples

Detaching Devices and Removing a LUN


BeforeyoucanremoveaLUN,youmustdetachthecorrespondingdevicebyusingthevSphereClientorthe esxcli storage core device [Link] [Link],thepathstateisnotsettodead. To detach a device and remove a LUN 1 Migratevirtualmachinesfromthedeviceyouplantodetach. Forinformationonmigratingvirtualmachines,seethevCenterServerandHostManagement documentation. 2 [Link] page 29. Iftheunmountfails,[Link],youwillgetanerrorinstep4when youattempttodetachadevicewithaVMFSpartitionstillinuse. 3 Iftheunmountfailed,checkwhetherthedeviceisinuse.
esxcli storage core device world list -d <device>

IfaVMFSvolumeisusingthedeviceindirectly,[Link] machineusesthedeviceasanRDM,[Link] isusingtherawdevice,theinformationisdisplayed. 4 Detachthestoragedevice.


esxcli storage core device set -d [Link]... --state=off

[Link] [Link] [Link]. ESXimaintainsthepersistentinformationaboutthedevicesofflinestateevenifthedeviceis [Link] storage core device detached remove -d naa.12. 5 (Optional)Totroubleshootthedetachoperation,listalldevicesthatweredetachedmanually.
esxcli storage core device detached list

Performarescan.
esxcli <conn_options> storage core adapter rescan

Whenyouhavecompletedstoragereconfiguration,youcanreattachthestoragedevice,mountthedatastore, andrestartthevirtualmachines. To reattach the device 1 (Optional)Checkthatthedeviceisdetached.


esxcli storage core device detached list

Attachthedevice.
esxcli storage core device set -d [Link] --state=on

[Link] page 29.

32

VMware, Inc.

Chapter 3 Managing Files

Working with Permanent Device Loss


WithearlierESX/ESXireleases,anAPD(AllPathsDown)eventresultswhentheLUNbecomesunavailable. Theeventisdifficultforadministratorsbecausetheydonothaveenoughinformationaboutthestateofthe LUNtoknowwhichcorrectiveactionisappropriate. InESXi5.0,theESXihostcandeterminewhetherthecauseofanAllPathsDown(APD)eventistemporary,or [Link] codesindicatingthattheLUNisnolongeravailableorthatasevere,unrecoverablehardwareproblemexist [Link] devicelossscenario. IMPORTANTDonotplanforAPD/PDLevents,forexample,whenyouwanttoupgradeyourhardware. Instead,performanorderlyremovalofLUNsfromyourESXiserver,whichisdescribedinDetachingDevices andRemovingaLUNonpage 32,performtheoperation,andaddtheLUNback. To Remove a PDL LUN HowyouremoveaPDLLUNdependsonwhetheritwasinuse.

IftheLUNthatgoesintoPDLisnotinusebyanyuserprocessorbytheVMkernel,theLUNdisappears byitselfafteraPDL. IftheLUNwasinusewhenitenteredPLD,deletetheLUNmanuallybyfollowingtheprocessdescribed inDetachingDevicesandRemovingaLUNonpage 32.

To Reattach a PDL LUN 1 2 ReturntheLUNtoworkingorder. Removeanyusersofthedevice. [Link] [Link] beingdiscovered. 3 Performarescantogetthedevicebackinworkingorder.

Using vifs to Manipulate Files on Remote ESXi Hosts


Inmostcases,[Link], youmighthavetoviewandmanipulatefilesonremoteESXihostsdirectly. CAUTIONIfyoumanipulatefilesdirectly,[Link] vSphereClientoroneoftheothervCLIcommandstomanipulatevirtualmachineconfigurationfilesand virtualdisks. Thevifscommandperformscommonoperationssuchascopy,remove,get,andputonESXifilesand [Link]. SomesimilaritiesbetweenvifsandDOSorUNIX/Linuxfilesystemmanagementutilitiesexist,butthereare [Link],vifsdoesnotsupportwildcardcharactersorcurrentdirectoriesand,asa result,[Link]. Insteadofusingthevifscommand,youcanbrowsedatastorecontentsandhostfilesbyusingaWebbrowser. Connecttothefollowinglocation:
[Link] [Link]

[Link]:
[Link] [Link]

VMware, Inc.

33

vSphere Command-Line Interface Concepts and Examples

TheESXihostpromptsforausernameandpassword. [Link] operationsareavailableforeachgroup,[Link] forvSphere4.xandvSphere5.0.


vSphere 4.x Host [Link] filesuniquenameidentifier. Specifyhostlocationsbyusingthe /host/<path>syntax. Temp The/tmpdirectoryandfilesinthatdirectory. Specifytemplocationsbyusingthe /tmp/dir/subdirsyntax. Datastores vSphere 5.0 [Link] filesuniquenameidentifier. Specifyhostlocationsbyusingthe /host/<path>syntax. Youcannotlistsubdirectoriesof/host. Notsupported.

[Link]:

Datastoreprefixstyle:'[ds_name] relative_path'.Forexample: '[myStorage1] testvms/VM1/[Link]'(Linux) or "[myStorage1] testvms/VM1/[Link]" (Windows)

URLstyle:/folder/dir/subdir/file?dsName=<name>.Forexample: '/folder/testvms/VM1/[Link]?dsName=myStorage1' (Linux) "/folder/testvms/VM1/[Link]?dsName=myStorage1" (Windows) Thetwoexamplepathsrefertoavirtualmachineconfigurationfileforthevirtualmachine VM1inthetestvms/VM1directoryofthemyStorage1datastore.

Toavoidproblemswithdirectorynamesthatusespecialcharactersorspaces,enclosethepathinquotesfor bothoperatingsystems. Whenyourunvifs,youcanspecifytheoperationnameandargumentandoneofthestandardconnection [Link],symboliclinks,orwrapperscriptstosimplifytheinvocationsyntax. IMPORTANTTheconceptsofworkingdirectoryandlastdirectoryorfileoperatedonarenotsupportedwith vifs. Options vifscommandspecificoptionsallowyoutoretrieveanduploadfilesfromtheremotehostandperforma [Link] [Link].
Command --copy -c <source> <target> Description Copiesafileinadatastoretoanotherlocation [Link]<source>mustbearemote sourcepath,the<target>aremotetarget pathordirectory. The--forceoptionreplacesexisting destinationfiles. --dir -D <remote_dir> --force -F --get -g <remote_path> <local_path> Liststhecontentsofadatastoredirectory. [Link] --moveand--copy. DownloadsafilefromtheESXihosttothe [Link] operationusesHTTP GET. ListsthedatacenterpathsavailableonanESXi system. Datastore Temp Datastore Temp Datastore Host Target Datastore Temp Syntax copy src_file_path dst_directory_path [force] copy src_file_path dst_file_path [force]

dir datastore_directory_path copy src_file_path dst_file_path [force] get src_dstore_file_path dst_local_file_path get src_d store_dir_path dst_local_file_path

--listdc -C

Datastore Host

34

VMware, Inc.

Chapter 3 Managing Files

Command --listds -S

Description ListsthedatastorenamesontheESXisystem. Whenmultipledatacentersareavailable,use the--dc (-Z)argumenttospecifythename ofthedatacenterfromwhichyouwanttolist thedatastore. [Link] operationfailsiftheparentdirectoryof dst_datastore_file_pathdoesnotexist. Movesafileinadatastoretoanotherlocation [Link]<source>mustbearemote sourcepath,the<target>aremotetarget pathordirectory. The--forceoptionreplacesexisting destinationfiles.

Target Datastore Host

Syntax vifs --listds

--mkdir -M <remote_dir> --move -m <source> <target>

Datastore Temp Datastore Temp

mkdir dst_directory_path

move src_file_path dst_directory_path [force] move src_file_path dst_file_path [force]

--put -p <local_path> <remote_path>

Uploadsafilefromthemachineonwhichyou [Link] HTTP PUT. Thiscommandcanreplaceexistinghostfiles butcannotcreatenewfiles.

Datastore Host Temp

put src_local_file_path dst_file_path put src_local_file_path dst_directory_path rm dst_file_path rmdir dst_directory_path

--rm -r <remote_path> --rmdir -R <remote_dir>

Deletesadatastorefile. [Link] failsifthedirectoryisnotempty.

Datastore Temp Datastore Temp

[Link] listedinConnectionOptionsonpage 17inplaceof<conn_options>.

Listthecurrentdatastores.
vifs <conn_options> --listds.

[Link]:
osdc-cx700-02 osdc-cx700-03 osdc-cx700-02 osdc-cx700-03 osdc-cx700-04 osdc-cx700-05

Youcanuseeachnamethathasbeenreturnedtorefertodatastorepathsbyusingsquarebracketnotation, asfollows:
'[my_datastore] dir/subdir/file'

Listthecontentsofonedirectoryinthedatastore.
vifs <conn_options> --dir '[osdc-cx700-02] winxpPro-sp2'

[Link],thecommandliststhecontentsofavirtual machinedirectory.
Content Listing _________________ [Link] [Link] ... [Link] ... [Link] [Link] [Link] ...

VMware, Inc.

35

vSphere Command-Line Interface Concepts and Examples

Listthecontentsofoneofthedatastores.
vifs <conn_options> --dir '[osdc-cx700-02]'

Thecommandliststhecompletecontentsofthedatastore. [Link] ConnectionOptionsonpage 17inplaceof<conn_options>. To manage files and directories on the remote ESXi system 1 Createadirectoryinthedatastore.
vifs <conn_options> --mkdir '[osdc-cx700-03] vcli_test'

Youmustspecifytheprecisepath;thereisnoconceptofarelativepath. 2 Placeafilethatisonthesystemfromwhichyouarerunningthecommandsintothenewlycreated directory.


vifs <conn_options> --put /tmp/test_doc '[osdc-cx700-03] vcli_test/test_doc'

Moveafileintoavirtualmachinedirectory.
vifs <conn_options> --move '[osdc-cx700-03] vcli_test/test_doc' '[osdc-cx700-03] winxpPro-sp2/test_doc

Amessageindicatessuccessorfailure. 4 RetrieveoneofthefilesfromtheremoteESXisystem. Thefollowingexampleretrievesalogfileforanalysis.


vifs <conn_options> --get '[osdc-cx700-03] winxpPro-sp2/[Link]' ~user1/[Link]

Cleanupbyremovingthefileanddirectoryyoucreatedearlier.
vifs <conn_options> --rm '[osdc-cx700-03] vcli_test/test_doc' vifs <conn_options> --rmdir '[osdc-cx700-03] vcli_test'

36

VMware, Inc.

Managing Storage

Avirtualmachineusesavirtualdisktostoreitsoperatingsystem,programfiles,andotherdataassociated [Link],orasetoffiles,thatcanbecopied,moved,archived, andbackedup. Tostorevirtualdiskfilesandmanipulatethefiles,[Link] storagespaceonavarietyofphysicalstoragesystems,localornetworked,thatahostusestostorevirtual machinedisks. Thischapterincludesthefollowingtopics:


IntroductiontoStorageonpage 37 ExaminingLUNsonpage 40 ManagingPathsonpage 42 ManagingPathPoliciesonpage 45 ManagingNFS/NASDatastoresonpage 48 MigratingVirtualMachineswithsvmotiononpage 50 ConfiguringFCoEAdaptersonpage 51 ScanningStorageAdaptersonpage 52

Chapter 5,ManagingiSCSIStorage,onpage [Link] 6,Managing ThirdPartyStorageArrays,onpage 81explainshowtomanagethePluggableStorageArchitecture, includingPathSelectionPlugin(PSP)andStorageArrayTypePlugin(SATP)configuration. ForinformationonmaskingandunmaskingpathswithESXCLI,seethevSphereStoragedocumentation.

Introduction to Storage
FibreChannelSANarrays,iSCSISANarrays,andNASarraysarewidelyusedstoragetechnologiessupported [Link] [Link] storageresourcesandprovidesmoreflexibilityinprovisioningthemtovirtualmachines.

VMware, Inc.

37

vSphere Command-Line Interface Concepts and Examples

Figure 4-1. vSphere Datacenter Physical Topology


vCenter Server vSphere Client Web access terminal

server group 1

server group 2

server group 3

virtual machines VM VM VM VM VM VM fibre channel switch fabric / IP network

ESX/ESXi

fibre channel storage array

iSCSI storage array

NAS storage array

How Virtual Machines Access Storage


[Link] typeofstoragedevicethatyourhostuses,thevirtualdiskalwaysappearstothevirtualmachineasamounted [Link],youcanrunoperatingsystemsthatarenotcertifiedforspecificstorageequipment, suchasSAN,inthevirtualmachine. Whenavirtualmachinecommunicateswithitsvirtualdiskstoredonadatastore,itissuesSCSIcommands. Becausedatastorescanexistonvarioustypesofphysicalstorage,thesecommandsareencapsulatedintoother forms,dependingontheprotocolthattheESXihostusestoconnecttoastoragedevice. Figure 42depictsfivevirtualmachinesthatusedifferenttypesofstoragetoillustratethedifferencesbetween eachtype. Figure 4-2. Virtual Machines Accessing Different Types of Storage
Host requires TCP/IP connectivity virtual machine virtual machine virtual machine virtual machine virtual machine

local ethernet SCSI bre channel HBA SAN iSCSI hardware initiator LAN software initiator ethernet NIC LAN ethernet NIC LAN

VMFS

Key
physical disk

datastore VMFS fibre array VMFS iSCSI array NFS NAS appliance

virtual disk

38

VMware, Inc.

Chapter 4 Managing Storage

YoucanusevCLIcommandstomanagethevirtualmachinefilesystemandstoragedevices.

[Link],modify,andmanageVMFSvirtualdisksandrawdevicemappings. SeeManagingtheVirtualMachineFileSystemwithvmkfstoolsonpage 28foranintroductionandthe vSphereStoragedocumentationforadetailedreference. [Link].

[Link] storage coreorvicfg-scsidevscommandstodisplayavailableLUNsand [Link] 40. [Link] storage coreorvicfg-mpathcommandstolistinformationabout [Link] [Link] [Link] 45. [Link] storage coreorvicfg-rescanadapter rescantoperformarescan [Link] page 52.

[Link].

[Link] storage [Link] ManagingNFS/NASDatastoresonpage 48. [Link] iscsiorvicfg-iscsitomanagebothhardwareandsoftwareiSCSI. SeeManagingiSCSIStorageonpage 53.

Datastores
ESXihostsusestoragespaceonavarietyofphysicalstoragesystems,includinginternalandexternaldevices [Link] [Link],analogoustoafilesystemonalogicalvolume,where [Link] productandprovideauniformmodelforstoringvirtualmachinefiles. Dependingonthetypeofstorageyouuse,datastorescanbebackedbythefollowingfilesystemformats:

VirtualMachineFileSystem(VMFS).Highperformancefilesystemoptimizedforstoringvirtual [Link], includingFibreChannelandiSCSISANequipment. AsanalternativetousingtheVMFSdatastore,yourvirtualmachinecanhavedirectaccesstorawdevices anduseamappingfile(RDM)[Link] vmkfstoolsonpage 28.

NetworkFileSystem(NFS).FilesystemonaNASstoragedevice.ESXisupportsNFSversion3over TCP/[Link],mountthevolume,and useitforanystorageneeds.

Storage Device Naming


Eachstoragedevice,orLUN,isidentifiedbyseveralnames.

[Link], forexample,[Link]. [Link] [Link] [Link]. [Link].

Theruntimenameofthefirstpathtothedeviceisapathidentifierandnotareliableidentifierforthedevice. Runtimenamesarecreatedbythehost,[Link] vmhba#:C#:T#:L#.YoucanviewtheruntimenameusingthevSphereClient.

VMware, Inc.

39

vSphere Command-Line Interface Concepts and Examples

Examining LUNs
ALUN(LogicalUnitNumber)isanidentifierforadiskvolumeinastoragearraytarget.

Target and Device Representation


IntheESXicontext,[Link] [Link] SCSIvolumepresentedtothehostfromastoragetarget. [Link] [Link],especiallyiSCSIvendors,presentmultipletargets withoneLUNeach. Figure 4-3. Target and LUN Representations
target LUN LUN LUN target LUN target LUN target LUN

storage array

storage array

InFigure 43,[Link],thehostseesonetarget,butthat [Link],the hostseesthreedifferenttargets,eachhavingoneLUN.

Examining LUNs with esxcli storage core


Useesxcli storage [Link]/[Link], [Link]/ESXi3.5systems,thecorrespondingcommandisvicfg-vmhbadevs. [Link] ConnectionOptionsonpage 17inplaceof<conn_options>.

Listalllogicaldevicesknownonthissystemwithdetailedinformation.
esxcli <conn_options> storage core device list

[Link] name(UUID),devicetype,displayname,[Link]--deviceoptiontoonly listinformationaboutaspecificdevice.


naa.5000c50006ee9cc7 Display Name: Local SEAGATE Disk (naa.5000c50006ee9cc7) Has Settable Display Name: true Size: 286102 Device Type: Direct-Access Multipath Plugin: NMP Devfs Path: /vmfs/devices/disks/naa.5000c50006ee9cc7 Vendor: SEAGATE Model: ST3300555SS Revision: T211 SCSI Level: 5 Is Pseudo: false Status: on Is RDM Capable: true Is Local: true Is Removable: false Is SSD: false Thin Provisioning Status: unknown Attached Filters: VAAI Status: unknown VAAI Plugin Name: Other UIDs: vml.02000000005000c50006ee9cc7535433333030 [Link][Link]T0:L0
40 VMware, Inc.

Chapter 4 Managing Storage

... Attached Filters: VAAI Status: unsupported VAAI Plugin Name: Other UIDs: vml.0005000000766d686261303a303a30

Listaspecificlogicaldevicewithitsdetailedinformation.
esxcli <conn_options> storage core device list -d [Link][Link]T1:L0

Listalldeviceuniqueidentifiers.
esxcli <conn_options> storage core device list

ThecommandliststheprimaryUIDforeachdevice([Link])andanyotherUIDs foreachUID(VMLname).Youcanspecify--devicetoonlylistinformationforaspecificdevice.

PrintmappingsforVMFSvolumestothecorrespondingpartition,pathtothatpartition,VMFSUUID, extentnumber,andvolumenames.
esxcli <conn_option> storage filesystem list

PrintHBAdeviceswithidentifyinginformation.
esxcli <conn_options> storage core adapter list

ThereturnvalueincludesadapterandUIDinformation.

PrintamappingbetweenHBAsandthedevicesitprovidespathsto.
esxcli <conn_options> storage core path list

Examining LUNs with vicfg-scsidevs


Usevicfg-scsidevstodisplayinformationaboutavailableLUNsonESX/ESXi [Link]/ESXi3.5 systems,thecorrespondingcommandisvicfg-vmhbadevs. IMPORTANTYoucanrunvicfg-scsidevs--queryandvicfg-scsidevs --vmfsagainstESX/ESXiversion [Link]/ESXiversion4.0andlater. [Link] ConnectionOptionsonpage 17inplaceof<conn_options>.

Listalllogicaldevicesknownonthissystemwithdetailedinformation.
vicfg-scsidevs <conn_options> --list

[Link] name(UUID),devicetype,displayname,[Link]--deviceoptiontoonly [Link];theactual listingmightincludemultipledevicesandthepreciseformatdiffersbetweenreleases.


[Link][Link]T1:L0 Device Type: cdrom Size: 0 MB Display Name: Local HL-DT-ST ([Link][Link]T1:L0) Plugin: NMP Console Device: /vmfs/devices/cdrom/[Link][Link]T1:L0 Devfs Path: /vmfs/devices/cdrom/[Link][Link]T1:L0 Vendor: SONY Model: DVD-ROM GDRXX8XX Revis: 3.00 SCSI Level: 5 Is Pseudo: Status: Is RDM Capable: Is Removable: Other Names: vml.000N000000XXXdXXXXXXXXaXXXaXX VAAI Status: nnnn naa.60060... Device Type: disk Size: 614400 MB Display Name: DGC Fibre Channel Disk (naa.60060...) ...

VMware, Inc.

41

vSphere Command-Line Interface Concepts and Examples

Listalllogicaldeviceswithabbreviatedinformation.
vicfg-scsidevs <conn_options> --compact-list

TheinformationincludesthedeviceID,devicetype,size,plugin,anddevicedisplayname.

Listalldeviceuniqueidentifiers.
vicfg-scsidevs <conn_options> --uids

ThecommandliststheprimaryUIDforeachdevice([Link])andanyotherUIDs foreachUID(VMLname).Youcanspecify--devicetoonlylistinformationforaspecificdevice.

Listaspecificlogicaldevicewithitsdetailedinformation.
vicfg-scsidevs <conn_options> -l -d [Link][Link]T1:L0

PrintmappingsforVMFSvolumestothecorrespondingpartition,pathtothatpartition,VMFSuuid, extentnumber,andvolumenames.
vicfg-scsidevs <conn_options> --vmfs

PrintHBAdeviceswithidentifyinginformation.
vicfg-scsidevs <conn_options> --hbas

ThereturnvalueincludestheadapterID,driverID,adapterUID,PCI,vendor,andmodel.

PrintamappingbetweenHBAsandthedevicesitprovidespathsto.
vicfg-scsidevs <conn_options> --hba-device-list

Managing Paths
TomaintainaconstantconnectionbetweenanESXihostanditsstorage,[Link] multipathingyoucanusemorethanonephysicalpathfortransferringdatabetweentheESXihostandthe externalstoragedevice. IncaseoffailureofanelementintheSANnetwork,suchasanHBA,switch,orcable,theESXihostcanfail [Link],multipathingalsooffersloadbalancing,whichredistributes I/Oloadsbetweenmultiplepathstoreduceoreliminatepotentialbottlenecks. ThestoragearchitectureinvSphere4.0andlatersupportsaspecialVMkernellayer,PluggableStorage Architecture(PSA).ThePSAisanopenmodularframeworkthatcoordinatesthesimultaneousoperationof multiplemultipathingplugins(MPPs).[Link] ThirdPartyStorageArraysonpage [Link] vSpherebydefault.

Multipathing with Local Storage and FC SANs


Inasimplemultipathinglocalstoragetopology,[Link] [Link] oneoftheconnectionelementsbetweentheESXihostandthelocalstoragesystemfails. TosupportpathswitchingwithFCSAN,theESXihosttypicallyhastwoHBAsavailablefromwhichthe [Link],thesetupcanincludeoneHBAand twostorageprocessorssothattheHBAcanuseadifferentpathtoreachthediskarray. InFigure 44,[Link],ifHBA1orthelink betweenHBA1andtheswitchfails,HBA2takesoverandprovidestheconnectionbetweentheserverandthe [Link].

42

VMware, Inc.

Chapter 4 Managing Storage

Figure 4-4. FC Multipathing


Host 1 Host 2

HBA2

HBA1

HBA3

HBA4

switch

switch

SP1

SP2

storage array

IfSP1orthelinkbetweenSP1andtheswitchbreaks,SP2takesoverandprovidestheconnectionbetweenthe [Link] failover. Afteryouhavesetupyourhardwaretosupportmultipathing,youcanusethevSphereClientorvCLI [Link].

Listpathinformationwithvicfg-mpathoresxcli storage core [Link] onpage 43. Changepathstatewithvicfg-mpathoresxcli storage core [Link] onpage 45. [Link]-mpathforESX/[Link]-mpath35 forESX/ESXi3.5.

[Link] page 47. [Link]. Manipulatetherulesthatmatchpathstomultipathingpluginstonewlydiscovereddeviceswithesxcli [Link] 89. [Link] 89. [Link] 52.

Listing Path Information


YoucanlistpathinformationwithESXCLIorwithvicfg-mpath.

Listing Path Information with ESXCLI


Youcanrunesxcli storage core pathtodisplayinformationaboutFibreChanneloriSCSILUNs. IMPORTANTUseindustrystandarddevicenames,[Link]. DonotuseVMLLUNnamesunlessdevicenamesarenotavailable. NamesofvirtualmachineHBAsarenotguaranteedtobevalidacrossreboots.

VMware, Inc.

43

vSphere Command-Line Interface Concepts and Examples

Youcandisplayinformationaboutpathsbyrunningesxcli storage core [Link] listedinConnectionOptionsonpage 17inplaceof<conn_options>.

Listalldeviceswiththeircorrespondingpaths,stateofthepath,adaptertype,andotherinformation.
esxcli <conn_options> storage core path list

Limitthedisplaytoonlyaspecifiedpathordevice.
esxcli <conn_options> storage core path list --path <path> esxcli <conn_options> storage core path list --device <device>

[Link] path.
esxcli <conn_options> storage core path stats get esxcli <conn_options> storage core path stats get --path <path

Listdetailedinformationforthepathsforthedevicespecifiedwith--device.
esxcli <conn_options> storage core path list -d <[Link]>

Listalladapters.
esxcli <conn_options> storage core adapter list

Rescanalladapters.
esxcli <conn_options> storage core adapter rescan

Listing Path Information with vicfg-mpath


Youcanrunvicfg-mpathtolistinformationaboutFibreChanneloriSCSILUNs. IMPORTANTUseindustrystandarddevicenames,[Link]. DonotuseVMLLUNnamesunlessdevicenamesarenotavailable. NamesofvirtualmachineHBAsarenotguaranteedtobevalidacrossreboots. [Link] oneoftheoptionslistedinConnectionOptionsonpage 17inplaceof<conn_options>.

Listalldeviceswiththeircorrespondingpaths,stateofthepath,adaptertype,andotherinformation.
vicfg-mpath <conn_options> --list-paths

Displayashortlistingofallpaths.
vicfg-mpath <conn_options> --list-compact

Listallpathswithadapteranddevicemappings.
vicfg-mpath <conn_options> --list-map

ListpathsanddetailedinformationbyspecifyingthepathUID(longpath).ThepathUIDisthefirstitem inthevicfg-mpath --listdisplay.


vicfg-mpath <conn_options> --list -P sas.5001c231c79c4a00-sas.1221000001000000-naa.5000c5000289c61b

Listpathsanddetailedinformationbyspecifyingthepathruntimename.
vicfg-mpath <conn_options> -l -P vmh[Link]T0:L0

Thereturninformationincludestheruntimename,device,devicedisplayname,adapter,adapter identifier,targetidentifier,plugin,state,transport,andadapterandtargettransportdetails.

Listdetailedinformationforthepathsforthedevicespecifiedwith--device.
vicfg-mpath <conn_options> -l -d [Link][Link]T1:L0 vicfg-mpath <conn_options> --list --device naa.60060...

44

VMware, Inc.

Chapter 4 Managing Storage

Changing the State of a Path


YoucanchangethestateofapathwithESXCLIorwithvicfg-mpath.

Changing Path State with ESXCLI


Youcantemporarilydisablepathsformaintenanceorotherreasons,andenablethepathwhenyouneedit [Link] page 17inplaceof<conn_options>. Ifyouarechangingapathsstate,thechangeoperationfailsifI/Oisactivewhenthepathsettingischanged. [Link]/Ooperationbeforethechangetakeseffect. To disable a path with ESXCLI 1 (Optional)Listalldevicesandcorrespondingpaths.
esxcli <conn_options> storage core path list

Thedisplayincludesinformationabouteachpathsstate. 2 SetthestateofaLUNpathtooff.
esxcli <conn_options> storage core path set --state off --path vmh[Link]T1:L0

Whenyouareready,setthepathstatetoactiveagain.
esxcli <conn_options> storage core path set --state active --path vmh[Link]T1:L0

Changing Path State with vicfg-mpath


[Link] page 17inplaceof<conn_options>. Ifyouarechangingapathsstate,thechangeoperationfailsifI/Oisactivewhenthepathsettingischanged. [Link]/Ooperationbeforethechangetakeseffect. To disable a path with vicfg-mpath 1 (Optional)Listalldevicesandcorrespondingpaths.
vicfg-mpath <conn_options> --list-paths

Thedisplayincludesinformationabouteachpathsstate. 2 SetthestateofaLUNpathtooff.
vicfg-mpath <conn_options> --state off --path vmh[Link]T1:L0

Whenyouareready,setthepathstatetoactiveagain.
vicfg-mpath <conn_options> --state active --path vmh[Link]T1:L0

Managing Path Policies


ForeachstoragedevicemanagedbyNMP(notPowerPath),[Link] haveathirdpartyPSPinstalledonyourhost,[Link] aresupportedbydefault.

VMware, Inc.

45

vSphere Command-Line Interface Concepts and Examples

Table 4-1. Supported Path Policies


Policy VMW_PSP_FIXED Description Thehostusesthedesignatedpreferredpath,[Link],thehost [Link] particularpreferredpath,specifyitthroughthevSphereClientorbyusingesxcli storage nmp psp fixed deviceconfig [Link] 46. ThedefaultpolicyforactiveactivestoragedevicesisVMW_PSP_FIXED. Important:VMwaredoesnotrecommendyouuseVMW_PSP_FIXEDfordevicesthathavethe VMW_SATP_ALUAstoragearraytypepolicyassignedtothem. VMW_PSP_MRU [Link],the [Link] [Link] isthedefaultpolicyforactivepassivestoragedevices. Thehostusesanautomaticpathselectionalgorithmthatrotatesthroughallactivepaths whenconnectingtoactivepassivearrays,orthroughallavailablepathswhenconnectingto [Link] [Link]/Orequestsacross [Link]/Opersecond,megabytes persecond,orresponsetimes. VMW_PSP_RRisthedefaultforanumberofarraysandcanbeusedwithbothactiveactiveand activepassivearraystoimplementloadbalancingacrosspathsfordifferentLUNs.

VMW_PSP_RR

Thetypeofarrayandthepathpolicydeterminethebehaviorofthehost. Table 4-2. Path Policy Effects


Policy MostRecentlyUsed Fixed Active/Active Array Administratoractionisrequiredtofail backafterpathfailure. VMkernelresumesusingthepreferred pathwhenconnectivityisrestored. Active/Passive Array Administratoractionisrequiredtofailback afterpathfailure. VMkernelattemptstoresumebyusingthe [Link] thrashingorfailurewhenanotherSPnow ownstheLUN. Nextpathinroundrobinschedulingis selected.

RoundRobin

Nofailback.

Changing Path Policies


YoucanchangepathpolicieswithESXCLIorwithvicfg-mpath.

Changing Path Policies with ESXCLI


[Link] page 17inplaceof<conn_options>. To change the path policy with ESXCLI 1 [Link].
esxcli <conn_options> storage nmp device list

Retrievethelistofpathselectionpoliciesonthesystemtoseewhichvaluesarevalidforthe--pspoption whenyousetthepathpolicy.
esxcli storage core plugin registration list --plugin-class="PSP"

Setthepathpolicyusingesxcli.
esxcli <conn_options> storage nmp device set --device [Link] --psp VMW_PSP_RR

SeeTable 41,SupportedPathPolicies,onpage 46.

46

VMware, Inc.

Chapter 4 Managing Storage

(Optional)IfyouspecifiedtheVMW_PSP_FIXEDpolicy,youmustmakesurethepreferredpathisset correctly. a Checkwhichpathisthepreferredpathforadevice.


esxcli <conn_options> storage nmp psp fixed deviceconfig get --device [Link]

Ifnecessary,changethepreferredpath.
esxcli <conn_options> storage nmp psp fixed deviceconfig set --device [Link] --path vmh[Link]T5:L3

Thecommandsetsthepreferredpathtovmh[Link]T5:[Link]--defaultto clearthepreferredpathselection.

Changing Path Policies with vicfg-mpath


[Link] onpage 17inplaceof<conn_options>. To change the path policy with vicfg-mpath 1 Listallmultipathingpluginsloadedintothesystem.
vicfg-mpath <conn_options> --list-plugins

Ataminimum,thiscommandreturnsNMP(NativeMultipathingPlugin)andMASK_PATH.IfotherMPP pluginshavebeenloaded,theyarelistedaswell. 2 SetthepathpolicybyusingESXCLI.


esxcli <conn_options> nmp device set --device [Link] --psp VMW_PSP_RR

SeeTable 41,SupportedPathPolicies,onpage 46. 3 (Optional)IfyouspecifiedtheVMW_PSP_FIXEDpolicy,youmustmakesurethepreferredpathisset correctly. a Firstcheckwhichpathisthepreferredpathforadevice.


esxcli <conn_options> storage nmp psp fixed deviceconfig get -d [Link]

Ifnecessary,changethepreferredpath.
esxcli <conn_options> storage nmp psp fixed deviceconfig set --device [Link] --path vmh[Link]T5:L3

Thecommandsetsthepreferredpathtovmh[Link]T5:L3

Setting Policy Details for Devices that Use Round Robin


[Link],ESXihostscanalsouse [Link],administratorscanspecifythat [Link] [Link] robin. Youcanuseesxcli nmp roundrobintoretrieveandsetroundrobinpathoptionsonadevicecontrolledby [Link] 17inplaceof <conn_options>. [Link] [Link]/[Link].

VMware, Inc.

47

vSphere Command-Line Interface Concepts and Examples

To view and manipulate round robin path selection settings with ESXCLI 1 RetrievepathselectionsettingsforadevicethatisusingtheroundrobinPSP.
esxcli <conn_options> storage nmp psp roundrobin deviceconfig get --device [Link]

[Link],andwhetherunoptimizedpaths shouldbeincluded.

Use--bytesor--iopstospecifywhenthepathshouldchange,asinthefollowingexamples:
esxcli <conn_options> storage nmp psp roundrobin deviceconfig set --type "bytes" -B 12345 --device [Link]

Setsthedevicespecifiedby--devicetoswitchtothenextpatheachtime12345byteshavebeensent alongthecurrentpath.
esxcli <conn_options> storage nmp psp roundrobin deviceconfig set --type=iops --iops 4200 --device [Link]

Setsthedevicespecifiedby--devicetoswitchafter4200I/Ooperationshavebeenperformedona path.

UseuseanotospecifythattheroundrobinPSPshouldincludepathsintheactive,unoptimizedstate intheroundrobinset(1)orthatthePSPshoulduseactive,unoptimizedpathsonlyifnoactive optimizedpathsareavailable(0).Ifyoudonotincludethisoption,thePSPincludesonlyactive optimizedpathsintheroundrobinpathset.

Managing NFS/NAS Datastores


ESXihostscanaccessadesignatedNFSvolumelocatedonaNAS(NetworkAttachedStorage)server,can mountthevolume,[Link] machinesinthesamewaythatyouuseVMFSdatastores.

Capabilities Supported by NFS/NAS


ESXihostssupportthefollowingsharedstoragecapabilitiesonNFSvolumes:

VMwarevMotion VMwareDRSandVMwareHA ISOimages,whicharepresentedasCDROMstovirtualmachines Virtualmachinesnapshots

NASstoresvirtualmachinefilesonremotefileserversthatareaccessedoverastandardTCP/[Link] NFSclientbuiltintotheESXisystemusesNFSversion3tocommunicatewithNAS/[Link] connectivity,thehostrequiresastandardnetworkadapter. InadditiontostoringvirtualdisksonNFSdatastores,youcanalsouseNFSasacentralrepositoryforISO images,virtualmachinetemplates,andsoon. TouseNFSasasharedrepository,youcreateadirectoryontheNFSserverandthenmountthedirectoryasa [Link],youcanconnectthevirtualmachinesCDROM devicetoanISOfileonthedatastoreandinstallaguestoperatingsystemfromtheISOfile.

Adding and Deleting NAS File Systems


Youcanlist,add,anddeleteaNASfilesystemwithESXCLIorwithvicfg-nas.

Managing NAS File Systems with ESXCLI


YoucanuseESXCLIasavCLIcommandwithconnectionoptions(seeConnectionOptionsonpage 17)or intheESXishell.

48

VMware, Inc.

Chapter 4 Managing Storage

To manage a NAS file system 1 ListallknownNASfilesystems.


esxcli <conn_options> storage nfs list

ForeachNASfilesystem,thecommandliststhemountname,sharename,andhostnameandwhether thefilesystemismounted. IfnoNASfilesystemsareavailable,thesystemdoesnotreturnaNASfilesystemandreturnstothe commandprompt. 2 [Link]--host,thevolumetousefor themountwith--volume-name,andthesharenameontheremotesystemtouseforthisNASmount pointwith--share.


esxcli <conn_options> storage nfs add --host=[Link] --share=/<mount_dir> --volume-name=nfsstore-dir42

ThiscommandaddsanentrytotheknownNASfilesystemlistandsuppliesthesharenameofthenew [Link],sharename,andvolumenameforthenewNASfile system. 3 AddasecondNASfilesystemwithreadonlyaccess.


esxcli <conn_options> storage nfs add --host=[Link] --share=/home --volume-name=FileServerHome2 --readonly

DeleteoneoftheNASfilesystems.
esxcli <conn_options> storage nfs remove --volume-name=FileServerHome2

ThiscommandunmountstheNASfilesystemandremovesitfromthelistofknownfilesystems.

Managing NAS File Systems with vicfg-nas


[Link] 17. To manage a NAS file system 1 ListallknownNASfilesystems.
vicfg-nas <conn_options> -l

ForeachNASfilesystem,thecommandliststhemountname,sharename,andhostnameandwhether [Link],thesystemreturnsthefollowingmessage:
No NAS datastore found

AddanewNASfilesystemtotheESXihost.
vicfg-nas <conn_options --add nfsstore-dir42

--nasserver [Link] -s /<mount_dir>

ThiscommandaddsanentrytotheknownNASfilesystemlistandsuppliesthesharenameofthenew [Link]. 3 AddasecondNASfilesystemwithreadonlyaccess.


vicfg-nas <conn_options> -a -y --n esx42nas2 -s /home FileServerHome2

DeleteoneoftheNASfilesystems.
vicfg-nas <conn_options> -d FileServerHome1

ThiscommandunmountstheNASfilesystemandremovesitfromthelistofknownfilesystems.

VMware, Inc.

49

vSphere Command-Line Interface Concepts and Examples

Migrating Virtual Machines with svmotion


StoragevMotionmovesavirtualmachinesconfigurationfile,and,optionally,itsdisks,whilethevirtual [Link] command. IMPORTANTNoESXCLIcommandforStoragevMotionisavailable. Youcanplacethevirtualmachineandallofitsdisksinasinglelocation,orchooseseparatelocationsforthe [Link] hostduringamigrationwithsvmotion.

Storage vMotion Uses


StoragevMotionhasseveralusesinadministeringyourvSphereenvironment.

UpgradeESXiwithoutvirtualmachinedowntimeinsituationswherevirtualmachinedisksmustbe movedtosharedstoragetoallowmigrationwithvMotion. [Link] machinesoffastoragedevicetoallowmaintenanceorreconfigurationofthestoragedevicewithout virtualmachinedowntime. [Link] virtualdiskstodifferentstoragevolumestobalancecapacityorimproveperformance.

Storage vMotion Requirements and Limitations


YoucanmigratevirtualmachinediskswithStoragevMotionifthevirtualmachineanditshostmeetthe followingresourceandconfigurationrequirements:

ForESXi5.0hosts,[Link],you cannotmigratevirtualmachinesthathavesnapshots. Virtualmachinedisksmustbeinpersistentmodeorberawdevicemappings(RDMs).Forphysicaland virtualcompatibilitymodeRDMs,[Link] RDMs,youcanusethevSphereClienttoconverttothickprovisionedorthinprovisioneddisksduring [Link] performthisconversion. ThehostonwhichthevirtualmachineisrunningmusthavealicensethatincludesStoragevMotion. ESX/[Link]/ESXi4.0andlaterhostsdonot requirevMotionconfigurationtoperformmigrationwithStoragevMotion. Thehostthevirtualmachineisrunningonmusthaveaccesstoboththesourceandtargetdatastores. AparticularhostcanbeinvolvedinuptofourmigrationswithvMotionorStoragevMotionatonetime. SeeLimitsonSimultaneousMigrationsinthevCenterServerandHostManagementdocumentationfor details.

IfyouusethevSphereClientformigrationwithsvmotion,thesystemperformsseveralcompatibilitychecks. ThesechecksarenotsupportedbythesvmotionvCLIcommand.

Running svmotion in Interactive Mode


[Link] theinformationitneedstocompletethestoragemigration.
svmotion <conn_options> --interactive

Whenyouuse--interactive,allotheroptionsareignored. IMPORTANTWhenrespondingtotheprompts,usequotesaroundinputstringswithspecialcharacters.
50 VMware, Inc.

Chapter 4 Managing Storage

Running svmotion in Noninteractive Mode


IMPORTANTWhenyourunsvmotion,--servermustpointtoavCenterServersystem. Innoninteractivemode,thesvmotioncommandusesthefollowingsyntax:
svmotion [standard vCLI options] --datacenter=<datacenter_name> --vm <VM config datastore path>:<new datastore> [--disks <virtual disk datastore path>:<new datastore>, <virtual disk datastore path>:<new datastore>]

Squarebracketsindicateoptionalelements,notdatastores. [Link],allvirtualdisksarerelocatedto [Link] [Link] 51. [Link]--disksoptionrequiresthe [Link] configurationfileanddiskfileonpage 51. To determine the path to the virtual machine configuration file and disk file 1 Runvmware-cmd -ltolistallvirtualmachineconfigurationfiles(VMXfiles).
vmware-cmd -H <vc_server> -U <login_user> -P <login_password> -h <esx_host> -l

ChoosetheVMXfileforthevirtualmachineofinterest. Bydefault,[Link].

(Optional)UsevifstoverifythatyouareusingthecorrectVMDKfile.

To relocate a virtual machines storage (including disks) 1 2 Determinethepathtothevirtualmachineconfigurationfile. Runsvmotion:


svmotion --url=[Link] --datacenter=DC1 --vm=[storage1] myvm/[Link]:new_datastore

[Link]. To relocate a virtual machines configuration file, but leave virtual disks 1 2 Determinethepathtothevirtualdiskfilesandthevirtualmachineconfigurationfile. Runsvmotion,forexample:
svmotion <conn_options> --datacenter='My DC' --vm='[old_datastore] myvm/[Link]:new_datastore' --disks='[old_datastore] myvm/myvm_1.vmdk:old_datastore, [old_datastore] myvm/myvm_2.vmdk: old_datastore'

Thiscommandrelocatesthevirtualmachinesconfigurationfiletonew_datastore,butleavesthetwodisks (myvm_1.vmdkandmyvm_2.vmdk)inold_datastore.[Link] [Link].

Configuring FCoE Adapters


ESXicanuseFibreChanneloverEthernet(FCoE)adapterstoaccessFibreChannelstorage. [Link],yourhostdoesnot needspecialFibreChannellinkstoconnecttoFibreChannelstorage,butcanuse10GbitlosslessEthernetto deliverFibreChanneltraffic.
VMware, Inc. 51

vSphere Command-Line Interface Concepts and Examples

TouseFCoE,[Link] categories,hardwareFCoEadaptersandsoftwareFCoEadapters.

[Link] ConvergedNetworkAdapters(CNAs)thatcontainnetworkandFibreChannelfunctionalitiesonthe [Link],[Link] thevSphereClient,thenetworkingcomponentappearsasastandardnetworkadapter(vmnic)andthe FibreChannelcomponentasaFCoEadapter(vmhba).YoudonothavetoconfigureahardwareFCoE adaptertobeabletouseit. [Link] [Link] hardwareFCoEadapter,thesoftwareadaptermustbeactivated.

Scanning Storage Adapters


[Link] vSphereClient,thevicfg-rescanvCLIcommand,ortheesxcli storage core adapter rescan command.

esxcli storage core adapter rescansupportsthefollowingadditionaloptions:


-a|--allor-A|--adapter=<string>Scanalladaptersoraspecifiedadapter. -S|--skip-claimSkipclaimingofnewdevicesbytheappropriatemultipathplugin. -F|--skip-fs-scanSkipfilesystemscan -t|--[Link](all)or foradded,deleted,orupdatedadapters(add,delete,update)

vicfg-rescansupportsonlyasimplerescanoperationonaspecifiedadapter.

To rescan a storage adapter with vicfg-rescan Runvicfg-rescan,specifyingtheadaptername.


vicfg-rescan <conn_options> vmhba1

Thecommandreturnsanindicationofsuccessorfailure,butnodetailedinformation. To rescan a storage adapter with ESXCLI Thefollowingcommandscansaspecificadapterandskipsthefilesystemscanthatisperformedbydefault.


esxcli <conn_options> storage core adapter rescan --adapter=vmhba33 --skip-claim

Thecommandreturnsanindicationofsuccessorfailure,butnodetailedinformation.

52

VMware, Inc.

53

Managing iSCSI Storage

[Link] Client,commandsintheesxcliiscsinamespace,orthevicfg-iscsicommandtoconfigureboth hardwareandsoftwareiSCSIstorageforyourESXisystem. Thischapterincludesthefollowingtopics:


iSCSIStorageOverviewonpage 53 ProtectinganiSCSISANonpage 55 CommandSyntaxforesxcliiscsiandvicfgiscsionpage 57 iSCSIStorageSetupwithESXCLIonpage 62 iSCSIStorageSetupwithvicfgiscsionpage 67 ListingandSettingiSCSIOptionsonpage 71 ListingandSettingiSCSIParametersonpage 72 EnablingiSCSIAuthenticationonpage 76 SettingUpPortsforiSCSIMultipathingonpage 77 ManagingiSCSISessionsonpage 78

SeethevSphereStoragedocumentationforadditionalinformation.

iSCSI Storage Overview


WithiSCSI,SCSIstoragecommandsthatyourvirtualmachineissuestoitsvirtualdiskareconvertedinto TCP/IPprotocolpacketsandtransmittedtoaremotedevice,ortarget,[Link] thevirtualmachine,thedeviceappearsasalocallyattachedSCSIdrive. Toaccessremotetargets,[Link] [Link]:

[Link] [Link] whilecommunicatingwiththenetworkadapter. [Link] adaptersarebrokenintotwotypes.

[Link] interfaces. [Link] interfaces.

SeethevSphereStoragedocumentationfordetailsonsetupandfailoverscenarios.

VMware, Inc.

53

vSphere Command-Line Interface Concepts and Examples

YoumustconfigureiSCSIinitiatorsforthehosttoaccessanddisplayiSCSIstoragedevices. Figure 51depictshoststhatusedifferenttypesofiSCSIinitiators.


ThehostontheleftusesanindependenthardwareiSCSIadaptertoconnecttotheiSCSIstoragesystem. ThehostontherightusessoftwareiSCSI.

[Link] [Link] datastoresforyourstorageneeds. Figure 5-1. iSCSI Storage


hardware iSCSI host 1 software adapter HBA2 HBA1 NIC2 NIC1 software iSCSI host 2

IP network

SP

iSCSI storage

Discovery Sessions
[Link] [Link].

[Link] iSCSIstorageserver,[Link],theiSCSIstorageserver [Link] iscsi adapter discovery sendtargetorvicfg-iscsicommands. [Link],theESXihostusestheIP addressesordomainnamesandiSCSItargetnames(IQNorEUIformatnames)tocommunicatewiththe [Link] iscsi adapter discovery statictargetor vicfg-iscsicommands.

Foreithercase,yousetuptargetdiscoveryaddressessothattheinitiatorcandeterminewhichstorage [Link] [Link],alltargetsassociatedwithanIPaddressorhostnameandtheiSCSIname [Link],youmustspecifytheIPaddressorhostnameandtheiSCSInameofthe [Link].

54

VMware, Inc.

Chapter 5 Managing iSCSI Storage

Discovery Target Names


ThetargetnameiseitheranIQNnameoranEUIname.

TheIQNnameusesthefollowingformat:
[Link]-mm.{reversed domain name}:id_string

Forexample:[Link]:[Link] [Link] canchangethatdefaultIQNname.

TheEUInameisdescribedinIETFrfc3720asfollows: TheIEEERegistrationAuthorityprovidesaserviceforassigninggloballyuniqueidentifiers[EUI].The [Link],FibreChannel definesamethodofencodingitintoaWorldWideName. Theformatiseui.followedbyanEUI64identifier(16ASCIIencodedhexadecimaldigits). Forexample:


Type EUI-64 identifier (ASCII-encoded hexadecimal) +--++--------------+ | || | eui.02004567A425678D

TheIEEEEUI64iSCSInameformatcanbeusedwhenamanufacturerisregisteredwiththeIEEE RegistrationAuthorityandusesEUI64formattedworldwideuniquenamesforitsproducts. CheckintheUIofthestoragearraywhetheranarrayusesanIQNnameoranEUIname.

Protecting an iSCSI SAN


[Link] setupyournetwork,youhelpsafeguardyouriSCSIstorage.

Protecting Transmitted Data


[Link] iSCSIadapternortheESXihostiSCSIinitiatorencryptsthedatathatittransmitstoandfromthetargets, [Link] attackersfromeasilyseeingiSCSIdata. AllowingyourvirtualmachinestosharevirtualswitchesandVLANswithyouriSCSIconfiguration [Link] listentoiSCSItransmissions,makesurethatnoneofyourvirtualmachinescanseetheiSCSIstoragenetwork. ProtectyoursystembygivingtheiSCSISANadedicatedvirtualswitch.

IfyouuseanindependenthardwareiSCSIadapter,makesurethattheiSCSIadapterandESXiphysical [Link] sharingaswitch. Ifyouusedependenthardwareorsoftwareiscsiadapter,whichusesESXinetworking,configureiSCSI storagethroughadifferentvirtualswitchthantheoneusedbyyourvirtualmachines.

[Link] iSCSIconfigurationonaseparateVLANensuresthatnodevicesotherthantheiSCSIadaptercansee [Link],networkcongestionfromothersourcescannot interferewithiSCSItraffic.

VMware, Inc.

55

vSphere Command-Line Interface Concepts and Examples

Securing iSCSI Ports


WhenyouruniSCSIdevices,[Link] measurereducesthechancesthatanintrudercanbreakintotheESXihostthroughspareportsandgaincontrol [Link],runningiSCSIdoesnotpresentanadditionalsecurityrisksattheESXihostendof theconnection. [Link] vulnerabilitiesexistintheiSCSIdevicesoftware,yourdatacanbeatriskthroughnofaultoftheESXisystem. Tolowerthisrisk,installallsecuritypatchesthatyourstorageequipmentmanufacturerprovidesandlimitthe devicesconnectedtotheiSCSInetwork.

Setting iSCSI CHAP


[Link] HandshakeAuthenticationProtocol(CHAP),whichVMwarerecommendsforyourSANimplementation. TheESXihostandtheiSCSIstoragesystemmusthaveCHAPenabledandmusthavecommoncredentials. DuringiSCSIlogin,theiSCSIstoragesystemexchangesitscredentialswiththeESXisystemandchecksthem. YoucansetupiSCSIauthenticationbyusingthevSphereClient,asdiscussedinthevSphereStorage documentationorbyusingtheesxclicommand,discussedinEnablingiSCSIAuthenticationonpage 76. TouseCHAPauthentication,youmustenableCHAPonboththeinitiatorsideandthestoragesystemside. Afterauthenticationisenabled,itappliesfortargetstowhichnoconnectionhasbeenestablished,butdoesnot [Link],thenewvolumesto whichyouaddaconnectionareexposedandcanbeused. ForsoftwareiSCSIanddependenthardwareiSCSI,ESXihostssupportperdiscoveryandpertargetCHAP [Link],ESXihostssupportonlyonesetofCHAPcredentialsper [Link]. WhenyouconfigureindependenthardwareiSCSIinitiators,ensurethattheCHAPconfigurationmatches [Link],[Link] enabled,youmustsetuptheCHAPauthenticationcredentialsontheESXihosttomatchthecredentialson theiSCSIstorage. Supported CHAP Levels TosetCHAPlevelswithesxcli iscsi adapter setauthorvicfg-iscsi,specifyoneofthevaluesin Table 51for<level>.OnlytwolevelsaresupportedforindependenthardwareiSCSI. MutualCHAPissupportedforsoftwareiSCSIandfordependenthardwareiSCSI,butnotforindependent hardwareiSCSI. IMPORTANTEnsurethatCHAPissettochapRequiredbeforeyousetmutualCHAP,andusecompatible [Link] risks. Table 5-1. Supported Levels for CHAP
Level chapProhibited Description [Link] authenticationisenabled,specify chapProhibitedtodisableit. HostusesanonCHAPconnection,butallowsa CHAPconnectionasfallback. HostusesCHAPiftheCHAPconnection succeeds,butusesnonCHAPconnectionsas fallback. HostrequiressuccessfulCHAPauthentication. TheconnectionfailsifCHAPnegotiationfails. vSphere Client text DonotuseCHAP Supported SoftwareiSCSI DependenthardwareiSCSI IndependenthardwareiSCSI DonotuseCHAPunless requiredbytarget UseCHAPunless prohibitedbytarget SoftwareiSCSI DependenthardwareiSCSI SoftwareiSCSI DependenthardwareiSCSI IndependenthardwareiSCSI UseCHAP SoftwareiSCSI DependenthardwareiSCSI

chapDiscouraged

chapPreferred

chapRequired

56

VMware, Inc.

Chapter 5 Managing iSCSI Storage

Returning Authentication to Default Inheritance ThevaluesofiSCSIauthenticationsettingsassociatedwithadynamicdiscoveryaddressorastaticdiscovery [Link],the [Link],theparentistheadapterordiscoveryaddress.

IfyouusethevSphereClienttomodifyauthenticationsettings,youmustdeselecttheInheritfromParent checkboxbeforeyoucanmakeachangetothediscoveryaddressordiscoverytarget. Ifyouusevicfg-iscsi,thevalueyousetoverridestheinheritedvalue. Ifyouuseesxcli iscsicommands,[Link] attheselevels:


esxcli iscsi adapter auth chap [get|set] esxcli iscsi adapter discovery sendtarget auth chap [get|set] esxcli iscsi adapter target portal auth chap [get|set]

Inheritanceisrelevantonlyifyouwanttoreturnadynamicdiscoveryaddressorastaticdiscoverytargetto [Link],useoneofthefollowingcommands:

Dynamicdiscovery:esxcli iscsi adapter discovery sendtarget auth chap set --inherit Staticdiscovery:esxcli iscsi adapter target portal auth chap set --inherit.

NOTEYoucansettargetlevelCHAPauthenticationpropertiestobeinheritedfromthesendtargetleveland [Link] adapterlevelpropertiesisnotsupported.

Command Syntax for esxcli iscsi and vicfg-iscsi


InvSphere5.0,youcanmanageiSCSIstoragebyusingeitheresxcli iscsicommandsorvicfg-iscsi [Link] 57and vicfgiscsiCommandSyntaxonpage 59provideanoverview.

esxcli iscsi Command Syntax


Theesxcli [Link] [Link] commandsandnamespaces. Table 5-2. esxcli iscsi Command Overview
adapter[get|list|set] auth discovery [rediscover] chap[set|get] sendtarget [add|list|remove] auth param[get|set] statictarget [add|list|remove] statusget target[list] portal[list] auth param[get|set] capabilitiesget firmware[get|set] param[get|set] chap[get|set] chap[get|set]

VMware, Inc.

57

vSphere Command-Line Interface Concepts and Examples

Table 5-2. esxcli iscsi Command Overview


networkportal [add|list|remove] physicalnetworkportal [list] session[add|list|remove] ibftboot[get|import] logicalnetworkportallist pluginlist software[get|set] ipconfig[get|set] param[get|set] connectionlist

Key to esxcli iscsi Short Options


[Link],the associatedfulloptiondependsonthecommand. Table 5-3. Short Options for iSCSI ESXCLI Command Options
Lower-case Option a c d f g i k l m n o p s v Option --address, alias --cid --direction --file, force --gateway --ip --key --level --method --nic --option --plugin --isid, subnet, switch --value S --state, secret M N --module --authname, --name I --inherit D --default Upper-case Option A Option --adapter Number 1 2 Option --dns1 --dns2

58

VMware, Inc.

Chapter 5 Managing iSCSI Storage

vicfg-iscsi Command Syntax


vicfg-iscsisupportsacomprehensivesetofoptions,listedinTable 54. Table 5-4. Options for vicfg-iscsi
Option Suboptions Description

-A --authentication -c <level> -m <auth_method> -b -v <ma_username> -x <ma_password> [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name>]] <adapter_name> --level <level> --method <auth_method> --mutual --mchap_username <ma_username> --mchap_password <ma_password> [--ip <stor_ip_addr|stor_hostname> [:<portnum>] [--name <iscsi_name>]] <adapter_name> -A --authentication -c <level> -m <auth_method> -u <auth_u_name> -w <a_password> [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name>]] <adapter_name> --level <level> --method <auth_method> --chap_password <auth_u_name> --chap_username <chap_password> [--ip <stor_ip_addr|stor_hostname> [:<portnum>] [--name <iscsi_name>]] <adapter_name> -A --authentication -l <adapter_name> --list <adapter_name> -D --discovery -a -i <stor_ip_addr|stor_hostname[:<portnum>] <adapter_name> --add --ip <stor_ip_addr|stor_hostname> [:<portnum>] <adapter_name> -D --discovery -l <adapter_name> --list <adapter_name> -D --discovery -r -i <stor_ip_addr|stor_hostname>[:<portnum>] <adapter_name> --remove --ip <stor_ip_addr|stor_hostname> [:<portnum>] <adapter_name> -H -l [<adapter_name>] --list [<adapter_name>] -L --lun -l <adapter_name> --list <adapter_name> ListsLUNinformation. ListsalliSCSIadaptersora specifiedadapter. Removesadynamicdiscovery address. Listsdynamicdiscovery addresses. Addsadynamicdiscovery address. Listssupportedauthentication methods. Enablesauthenticationusingthe specifiedoptions. Enablesmutualauthentication. Youmustenableauthentication beforeyoucanenablemutual authentication.

VMware, Inc.

59

vSphere Command-Line Interface Concepts and Examples

Table 5-4. Options for vicfg-iscsi (Continued)


Option -L --lun -l -t <target_ID> <adapter_name> --list --target_id <target_id> <adapter_name> -N --network (Independent hardware iSCSI only) -l <adapter_name> --list <adapter_name> -N --network (Independent hardware iSCSI only) -i <ip_addr> <adapter_name> --ip <ip_addr> <vmhba> -N --network (Independent hardware iSCSI only) -s <subnet_mask> <adapter_name> --subnetmask <subnet_mask> <adapter_name> -N --network (Independent hardware iSCSI only) -g <default_gateway> <adapter_name> --gateway <default_gateway> <adapter_name> -N --network (Independent hardware iSCSI only) -i <ip_addr> -s <subnet mask> -g <default_gateway> <adapter_name> --ip <ip_addr> --subnetmask <subnet_mask> --gateway <default_gateway> <adapter_name> -p --pnp (Independent hardware iSCSI only) -l <adapter_name> --list <adapter_name> -p --pnp (Independent hardware iSCSI only) -M <mtu_size> <adapter_name> --mtu <mtu-size> <adapter_name> -I --iscsiname -a <alias_name> <adapter_name> --alias <alias_name> <adapter_name> -I --iscsiname -n <iscsi_name> <adapter_name> --name <iscsi_name> <adapter_name> -I --iscsiname -l <adapter_name> --list <adapter_name> -M --mtu -p -M <mtu_size> <adapter_name> --pnp --mtu <mtu-size> <adapter_name> -S --static -l <adapter_name> --list <adapter_name> -S --static -r -i <stor_ip_addr|stor_hostname> [:<portnum>] -n <target_name> <adapter_name> --remove --ip <stor_ip_addr|stor_hostname> [:<portnum>] -name <target_name> <adapter_name> Removesastaticdiscovery address. Listsstaticdiscoveryaddresses. [Link] --pnpoption. ListsiSCSIinitiatoroptions. SetstheiSCSIinitiatorname. SetstheiSCSIinitiatoralias. Setsphysicalnetworkportal options. Listsphysicalnetworkportal options. SetstheIPaddress,subnetmask, anddefaultgatewayinone command. SetstheHBAgatewayto default_gateway. SetstheHBAnetworkmaskto subnet_mask. SetstheHBAIPv4addressto ip_addr. Listsnetworkproperties. ListsLUNinformationfora specifictarget. Suboptions Description

60

VMware, Inc.

Chapter 5 Managing iSCSI Storage

Table 5-4. Options for vicfg-iscsi (Continued)


Option Suboptions Description

-S --static -a -i <stor_ip_addr|stor_hostname> [:<portnum>] -n <target_name> <adapter_name> --add --ip <stor_ip_addr|stor_hostname> [:<portnum>] -name <target_name> <adapter_name> -P --phba -l <adapter_name> --list <adapter_name> -T --target -l <adapter_name> --list <adapter_name> -W parameter -l [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name]] <adapter_name> --list [--ip <stor_ip_addr|stor_hostname> [:<portnum>] [--name <iscsi_name]] <adapter_name> -W parameter -l -k [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name]] <adapter_name> --list --detail [--ip <stor_ip_addr|stor_hostname> [:<portnum>] [--name <iscsi_name]] <adapter_name> -W parameter -W -j <name>=<value> -i <stor_ip_addr|stor_hostname> [:port_num>] [-n <iscsi_name>]] <adapter_name> --parameter --set <name>=<value> --ip <stor_ip_addr|stor_hostname> [:port_num>] [--name <iscsi_name>]] <adapter_name> -W parameter -W -o <param_name> -i <stor_ip_addr|stor_hostname> [:port_num>] [-n <iscsi_name>]] <adapter_name> -parameter --reset <param_name> -ip <stor_ip_addr|stor_hostname> [:port_num>] [-name <iscsi_name>]] <adapter_name> -z --reset_auth -a -z -m <auth_method> -b [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name>]] <adapter_name> --authentication --reset_auth --method <auth_method> [--ip <stor_ip_addr|stor_hostname> [:<portnum>] [--name <iscsi_name>]] <adapter_name> Resetstargetlevelauthentication propertiestobeinheritedfrom [Link] --authenticationoption. Returnsparametersindiscovery targetorsendtargettodefault inheritancebehavior. SetsiSCSIparameters. ListsiSCSIparameterdetails. ListsiSCSIparameter information. Liststargetinformation. Listsexternal,vendorspecific propertiesofaniSCSIadapter. Addsastaticdiscoveryaddress.

VMware, Inc.

61

vSphere Command-Line Interface Concepts and Examples

iSCSI Storage Setup with ESXCLI


YoucansetupiSCSIstorageusingthevSphereClient,commandsintheesxcli iscsinamespace,or vicfg-iscsicommands(seeiSCSIStorageSetupwithvicfgiscsionpage 67).

Setting Up Software iSCSI with ESXCLI


[Link],seethediscussionofthecorrespondingcommand inthischapterorthereferenceinformationavailablefromesxcli iscsi --helpandtheVMware [Link] 17inplaceof <conn_options> 1 EnablesoftwareiSCSI.
esxcli <conn_options> iscsi software set --enabled=true

Checkwhetheranetworkportal,thatis,aboundport,existsforiSCSItraffic.
esxcli <conn_options> iscsi adapter list

Ifnoadapterexists,[Link],butrequiresthatatleastone [Link].
esxcli <conn_options> iscsi networkportal add -n <portal_name> -A <vmhba>

(Optional)Checkthestatus.
esxcli <conn_options> iscsi software get

ThesystemprintstrueifsoftwareiSCSIisenabled,orfalseifitisnotenabled. 5 (Optional)SettheiSCSInameandalias.
esxcli <conn_options> iscsi adapter set --adapter=<iscsi adapter> --name=<name> esxcli <conn_options> iscsi adapter set --adapter=<iscsi adapter> --alias=<alias>

Addadynamicdiscoveryaddressorastaticdiscoveryaddress. Thetwotypesoftargetdifferasfollows:

Withdynamicdiscovery,allstoragetargetsassociatedwithahostnameorIPaddressarediscovered. Yourunthefollowingcommand.
esxcli <conn_options> iscsi adapter discovery sendtarget add --address=<ip/dns[:port]> --adapter=<adapter_name>

Withstaticdiscovery,youmustspecifythehostnameorIPaddressandtheiSCSInameofthestorage [Link].
esxcli <conn_options> iscsi adapter discovery statictarget add --address=<ip/dns[:port]> --adapter=<adapter_name> --name=<target_name>

Whenyoulaterremoveadiscoveryaddress,[Link] canaddthediscoveryaddressandrescantodisplaythecorrectparentforthestatictargets. 7 (Optional)SettheauthenticationinformationforCHAP(seeSettingiSCSICHAPonpage 56and EnablingiSCSIAuthenticationonpage 76).YoucansetpertargetCHAPforstatictargets,peradapter CHAP,orapplythecommandtothediscoveryaddress.

62

VMware, Inc.

Chapter 5 Managing iSCSI Storage

Adapterlevel CHAP

esxcli iscsi adapter auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=[prohibited, discouraged, preferred, required] --secret=<string> --adapter=<vmhba> esxcli iscsi adapter discovery sendtarget auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=[prohibited, discouraged, preferred, required] --secret=<string> --adapter=<vmhba> --address<sendtarget_address> esxcli iscsi adapter target portal auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=[prohibited, discouraged, preferred, required] --secret=<string> --adapter=<vmhba> --name<iscsi_iqn_name>

Discoverylevel CHAP

Targetlevel CHAP

Table 51,SupportedLevelsforCHAP,onpage 56listswhateachsupportedleveldoes. Forexample:


esxcli <conn_options> iscsi adapter auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=preferred --secret=uni_secret --adapter=vmhba33

(Optional)SettheauthenticationinformationformutualCHAPbyrunningesxcli iscsi adapter auth chap set againwith--directionsettomutualandadifferentauthenticationusernameand secret. Adapterlevel CHAP
esxcli iscsi adapter auth chap set --direction=mutual --mchap_username=<name2> --mchap_password=<pwd2> --level=[prohibited required] --secret=<string2> --adapter=<vmhba> esxcli iscsi adapter discovery sendtarget auth chap set --direction=mutual --mchap_username=<name2> --mchap_password=<pwd2> --level=[prohibited, required] --secret=<string2> --adapter=<vmhba> --address=<sendtarget_address> eesxcli iscsi adapter target portal auth chap set --direction=mutual --mchap_username=<nam2e> --mchap_password=<pwd2> --level=[prohibited required] --secret=<string2> --adapter=<vmhba> --name=<iscsi_iqn_name>

Discoverylevel CHAP

Targetlevel CHAP

IMPORTANTYouareresponsibleformakingsurethatCHAPissetbeforeyousetmutualCHAP,andfor usingcompatiblelevelsforCHAPandmutualCHAP. 9 (Optional)SetiSCSIparameters. Adapterlevel parameters Discoverylevel parameters Targetlevel parameters


esxcli iscsi adapter param set --adapter=<vmhba> --key=<key> --value=<value> esxcli iscsi adapter discovery sendtarget param set --adapter=<vmhba> --key=<key> --value=<value> --address=<sendtarget_address> esxcli iscsi adapter target portal param set --adapter=<vmhba> --key=<key> --value=<value> --address=<address> --name=<[Link]>

SeeListingandSettingiSCSIParametersonpage 72 10 Aftersetupiscomplete,[Link]:
esxcli <conn_options> iscsi adapter discovery rediscover esxcli <conn_options> storage core adapter rescan --adapter=vmhba36

VMware, Inc.

63

vSphere Command-Line Interface Concepts and Examples

11

(Optional)IfyouwanttomakeadditionaliSCSIloginparameterchanges(seeListingandSettingiSCSI Parametersonpage 72),youmustlogoutofthecorrespondingiSCSIsessionandlogbackin. a b Runesxcli iscsi session removetologout. Runesxcli iscsi session addorrescantheadaptertoaddthesessionback.

Setting Up Dependent Hardware iSCSI with ESXCLI


[Link],seethediscussionofthe correspondingcommandinthischapterorthereferenceinformationavailablefromesxcli iscsi --help [Link] 17 inplaceof<conn_options>. 1 DeterminetheiSCSIadaptertypeandretrievetheiSCSIadapterID.
esxcli <conn_options> iscsi adapter list

(Optional)SettheiSCSInameandalias.
esxcli <conn_options> iscsi adapter set --adapter <adapter_name> --name=<name> esxcli <conn_options> iscsi adapter set --adapter <adapter_name> --alias=<alias>

Setupportbindingbyfollowingthesesteps: a IdentifytheVMkernelportofthedependenthardwareiSCSIadapter.
esxcli <conn_options> iscsi logicalnetworkportal list --adapter=<adapter_name>

ConnectthedependenthardwareiSCSIinitiatortotheiSCSIVMkernelportsbyrunningthe followingcommandforeachport.
esxcli <conn_options> iscsi networkportal add --nic=<bound_vmknic> --adapter=<iscsi_adapter>

VerifythattheportswereaddedtothedependenthardwareiSCSIinitiator.
esxcli <conn_options> iscsi physicalnetworkportal list --adapter=<adapter_name>

Addadynamicdiscoveryaddressorastaticdiscoveryaddress. Thetwotypesoftargetdifferasfollows:

Withdynamicdiscovery,allstoragetargetsassociatedwithahostnameorIPaddressarediscovered. Yourunthefollowingcommand.
esxcli <conn_options> iscsi adapter discovery sendtarget add --address=<ip/dns[:port]> --adapter=<adapter_name>

Withstaticdiscovery,youmustspecifythehostnameorIPaddressandtheiSCSInameofthestorage [Link].
esxcli <conn_options> iscsi adapter discovery statictarget add --address=<ip/dns[:port]> --adapter=<adapter_name> --name=<target_name>

Whenyoulaterremoveadiscoveryaddress,[Link] canaddthediscoveryaddressandrescantodisplaythecorrectparentforthestatictargets. 5 (Optional)SettheauthenticationinformationforCHAP(seeSettingiSCSICHAPonpage 56and EnablingiSCSIAuthenticationonpage 76).YoucansetpertargetCHAPforstatictargets,peradapter CHAP,orapplythecommandtothediscoveryaddress.

64

VMware, Inc.

Chapter 5 Managing iSCSI Storage

Adapterlevel CHAP

esxcli iscsi adapter auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=[prohibited, discouraged, preferred, required] --secret=<string> --adapter=<vmhba> esxcli iscsi adapter discovery sendtarget auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=[prohibited, discouraged, preferred, required] --secret=<string> --adapter=<vmhba> --address<sendtarget_address> esxcli iscsi adapter target portal auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=[prohibited, discouraged, preferred, required] --secret=<string> --adapter=<vmhba> --name<iscsi_iqn_name>

Discoverylevel CHAP

Targetlevel CHAP

Table 51,SupportedLevelsforCHAP,onpage 56listswhateachsupportedleveldoes. Forexample:


esxcli <conn_options> iscsi adapter auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=preferred --secret=uni_secret --adapter=vmhba33

(Optional)SettheauthenticationinformationformutualCHAPbyrunningesxcli iscsi adapter auth chap set againwith--directionsettomutualandadifferentauthenticationusernameand secret. Adapterlevel CHAP
esxcli iscsi adapter auth chap set --direction=mutual --mchap_username=<name> --mchap_password=<pwd> --level=[prohibited required] --secret=<string2> --adapter=<vmhba> esxcli iscsi adapter discovery sendtarget auth chap set --direction=mutual --mchap_username=<name> --mchap_password=<pwd> --level=[prohibited, required] --secret=<string2> --adapter=<vmhba> --address=<sendtarget_address> esxcli iscsi adapter target portal auth chap set --direction=mutual --mchap_username=<name> --mchap_password=<pwd> --level=[prohibited required] --secret=<string2> --adapter=<vmhba> --name=<iscsi_iqn_name>

Discoverylevel CHAP

Targetlevel CHAP

IMPORTANTYouareresponsibleformakingsurethatCHAPissetbeforeyousetmutualCHAP,andfor usingcompatiblelevelsforCHAPandmutualCHAP. 7 (Optional)SetiSCSIparameters. Adapterlevel parameters Discoverylevel parameters Targetlevel parameters


esxcli iscsi adapter param set --adapter=<vmhba> --key=<key> --value=<value> esxcli iscsi adapter discovery sendtarget param set --adapter=<vmhba> --key=<key> --value=<value> --address=<sendtarget_address> esxcli iscsi adapter target portal param set --adapter=<vmhba> --key=<key> --value=<value> --address=<address> --name=<[Link]>

SeeListingandSettingiSCSIParametersonpage 72 8 Aftersetupiscomplete,[Link]:
esxcli <conn_options> iscsi adapter discovery rediscover esxcli <conn_options> storage core adapter rescan --adapter=vmhba36

VMware, Inc.

65

vSphere Command-Line Interface Concepts and Examples

(Optional)IfyouwanttomakeadditionaliSCSIloginparameterchanges(seeListingandSettingiSCSI Parametersonpage 72),youmustlogoutofthecorrespondingiSCSIsessionandlogbackin. a b Runesxcli iscsi session removetologout. Runesxcli iscsi session addorrescantheadaptertoaddthesessionback.

Setting Up Independent Hardware iSCSI with ESXCLI


WithindependenthardwarebasediSCSIstorage,youuseaspecializedthirdpartyadaptercapableof accessingiSCSIstorageoverTCP/[Link] managementforyourESXisystem. YoumustinstallandconfiguretheindependenthardwareiSCSIadapterforyourhostbeforeyoucanaccess [Link],seevendordocumentation. [Link],seethediscussionofthe [Link] listedinConnectionOptionsonpage 17inplaceof<conn_options>. 1 DeterminetheiSCSIadaptertypeandretrievetheiSCSIadapterID.
esxcli <conn_options> iscsi adapter list

Configurethehardwareinitiator(HBA)byrunningesxcli iscsi networkportal ipconfig withone ormoreofthefollowingoptions.


-A|--adapter=<str> -1|--dns1=<str> -2|--dns2=<str> -g|--gateway=<str> -i|--ip=<str> -n|--nic=<str> -s|--subnet=<str> iSCSIadaptername.(required). iSCSInetworkportalprimaryDNSaddress. iSCSInetworkportalsecondaryDNSaddress. iSCSInetworkportalgatewayaddress. iSCSInetworkportalIPaddress(required). iSCSInetworkportal(vmknic). iSCSInetworkportalsubnetmask(required).

(Optional)SettheiSCSInameandalias.
esxcli <conn_options> iscsi adapter set --adapter <adapter_name> --name=<name> esxcli <conn_options> iscsi adapter set --adapter <adapter_name> --alias=<alias>

Addadynamicdiscoveryaddressorastaticdiscoveryaddress. Thetwotypesoftargetdifferasfollows:

Withdynamicdiscovery,allstoragetargetsassociatedwithahostnameorIPaddressarediscovered. Yourunthefollowingcommand.
esxcli <conn_options> iscsi adapter discovery sendtarget add --address=<ip/dns[:port]> --adapter=<adapter_name>

Withstaticdiscovery,youmustspecifythehostnameorIPaddressandtheiSCSInameofthestorage [Link].
esxcli <conn_options> iscsi adapter discovery statictarget add --address=<ip/dns[:port]>

(Optional)SettheauthenticationinformationforCHAP(seeSettingiSCSICHAPonpage 56and EnablingiSCSIAuthenticationonpage 76).YoucansetpertargetCHAPforstatictargets,peradapter CHAP,orapplythecommandtothediscoveryaddress.

66

VMware, Inc.

Chapter 5 Managing iSCSI Storage

Adapterlevel CHAP

esxcli iscsi adapter auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=[prohibited, discouraged, preferred, required] --secret=<string> --adapter=<vmhba> esxcli iscsi adapter discovery sendtarget auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=[prohibited, discouraged, preferred, required] --secret=<string> --adapter=<vmhba> --address<sendtarget_address> esxcli iscsi adapter target portal auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=[prohibited, discouraged, preferred, required] --secret=<string> --adapter=<vmhba> --name<iscsi_iqn_name>

Discoverylevel CHAP

Targetlevel CHAP

Table 51,SupportedLevelsforCHAP,onpage 56listswhateachsupportedleveldoes. Forexample:


esxcli <conn_options> iscsi adapter auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=preferred --secret=uni_secret --adapter=vmhba33

MutualCHAPisnotsupportedforindependenthardwareiSCSIstorage. 6 (Optional)SetiSCSIparameters. Adapterlevel parameters Discoverylevel parameters Targetlevel parameters


esxcli iscsi adapter param set --adapter=<vmhba> --key=<key> --value=<value> esxcli iscsi adapter discovery sendtarget param set --adapter=<vmhba> --key=<key> --value=<value> --address=<sendtarget_address> esxcli iscsi adapter target portal param set --adapter=<vmhba> --key=<key> --value=<value> --address=<address> --name=<[Link]>

SeeListingandSettingiSCSIParametersonpage 72 7 8 Aftersetupiscomplete,runesxcli storage core adapter rescan --adapter=<iscsi_adapter> torescanallstoragedevices. Aftersetupiscomplete,[Link]:


esxcli <conn_options> iscsi adapter discovery rediscover esxcli <conn_options> storage core adapter rescan --adapter=vmhba36

iSCSI Storage Setup with vicfg-iscsi


YoucansetupiSCSIstorageusingthevSphereClient,commandsintheesxcli iscsinamespace(seeiSCSI StorageSetupwithESXCLIonpage 62)orthevicfg-iscsicommand.

Setting Up Software iSCSI with vicfg-iscsi


[Link],seethediscussionofthe [Link] listedinConnectionOptionsonpage 17inplaceof<conn_options>. 1 DeterminetheHBAtypeandretrievetheHBAID.
vicfg-iscsi <conn_options> --adapter --list

EnablesoftwareiSCSIfortheHBA.
vicfg-iscsi <conn_options> --swiscsi --enable

VMware, Inc.

67

vSphere Command-Line Interface Concepts and Examples

(Optional)Checkthestatus.
vicfg-iscsi <conn_options> --swiscsi --list

ThesystemprintsSoftware iSCSI is enabledorSoftware iSCSI is not enabled. 4 (Optional)SettheiSCSInameandalias.


vicfg-iscsi vicfg-iscsi vicfg-iscsi vicfg-iscsi <conn_options> <conn_options> <conn_options> <conn_options> -I -n <iscsi_name> <adapter_name> --iscsiname --name <iscsi_name> <adapter_name> -I -a <alias_name> <adapter_name> --iscsiname --alias <alias_name> <adapter_name>

Addadynamicdiscoveryaddressorastaticdiscoveryaddress. Thetwotypesoftargetdifferasfollows:

Withdynamicdiscovery,allstoragetargetsassociatedwithahostnameorIPaddressarediscovered. Yourunthefollowingcommand:
vicfg-iscsi <conn_options> --discovery --add --ip <ip_addr | domain_name> <adapter_name>

Withstaticdiscovery,youmustspecifythehostnameorIPaddressandtheiSCSInameofthestorage [Link]:
vicfg-iscsi <conn_options> --static --add --ip <ip_addr | domain_name> --name <iscsi_name> <adapter_name>

Whenyoulaterremoveadiscoveryaddress,[Link] canaddthediscoveryaddressandrescantodisplaythecorrectparentforthestatictargets. 6 (Optional)SettheauthenticationinformationforCHAP(seeSettingiSCSICHAPonpage 56and EnablingiSCSIAuthenticationonpage 76).


vicfg-iscsi <conn_options> -A -c <level> -m <auth_method> -u <auth_u_name> -w <chap_password> [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name]] <adapter_name> vicfg-iscsi <conn_options> --authentication --level <level> --method <auth_method> --chap_username <auth_u_name> --chap_password <chap_password> [--ip <stor_ip_addr|stor_hostname> [:<portnum>] [-name <iscsi_name]] <adapter_name>

Thetarget(-i)andname(-n)optiondeterminewhatthecommandappliesto.
Option -iandn Onlyi Neither-inorn Result CommandappliestopertargetCHAPforstatictargets. Commandappliestothediscoveryaddress. CommandappliestoperadapterCHAP.

(Optional)SettheauthenticationinformationformutualCHAPbyrunningvicfg-iscsi -Aagainwith the-boptionandadifferentauthenticationusernameandpassword. For<level>,specifychapProhibitedorchapRequired.

[Link],specify chapProhibitedtodisableit. [Link] [Link].

For<auth_method>,CHAPistheonlyvalidvalue. IMPORTANTYouareresponsibleformakingsurethatCHAPissetbeforeyousetmutualCHAP,andfor usingcompatiblelevelsforCHAPandmutualCHAP. 8 9 (Optional)SetiSCSIparametersbyrunningvicfg-iscsi -W. Aftersetupiscomplete,runvicfg-rescantorescanallstoragedevices.

68

VMware, Inc.

Chapter 5 Managing iSCSI Storage

Setting Up Dependent Hardware iSCSI with vicfg-iscsi


[Link],seethediscussionof thecorrespondingcommandlineoptioninthischapter,[Link] optionslistedinConnectionOptionsonpage 17inplaceof<conn_options>. 1 DeterminetheHBAtypeandretrievetheHBAID.
vicf-iscsi <conn_options> --adapter --list

(Optional)SettheiSCSInameandalias.
vicfg-iscsi vicfg-iscsi vicfg-iscsi vicfg-iscsi <conn_options> <conn_options> <conn_options> <conn_options> -I -n <iscsi_name> <adapter_name> --iscsiname --name <iscsi_name> <adapter_name> -I -a <alias_name> <adapter_name> --iscsiname --alias <alias_name> <adapter_name>

Setupportbindingbyfollowingthesesteps: a IdentifytheVMkernelportofthedependenthardwareiSCSIadapter.
esxcli <conn_options> swiscsi vmknic list -d <vmhba>

ConnectthedependenthardwareiSCSIinitiatortotheiSCSIVMkernelportsbyrunningthe followingcommandforeachport.
esxcli <conn_options> swiscsi nic add -n <port_name> -d <vmhba>

VerifythattheportswereaddedtothedependenthardwareiSCSIinitiator.
esxcli <conn_options> swiscsi nic list -d <vmhba>

RescanthedependenthardwareSCSIinitiator.
vicfg-rescan <conn_options> <vmhba>

Addadynamicdiscoveryaddressorastaticdiscoveryaddress. Thetwotypesoftargetdifferasfollows:

Withdynamicdiscovery,allstoragetargetsassociatedwithahostnameorIPaddressarediscovered. Yourunthefollowingcommand:
vicfg-iscsi <conn_options> --discovery --add --ip <ip_addr | domain_name> <adapter_name>

Withstaticdiscovery,youmustspecifythehostnameorIPaddressandtheiSCSInameofthestorage [Link]:
vicfg-iscsi <conn_options> --static --add --ip <ip_addr | domain_name> --name <iscsi_name> <adapter_name>

Whenyoulaterremoveadiscoveryaddress,[Link] canaddthediscoveryaddressandrescantodisplaythecorrectparentforthestatictargets. 5 (Optional)SettheauthenticationinformationforCHAP(seeSettingiSCSICHAPonpage 56and EnablingiSCSIAuthenticationonpage 76).


vicfg-iscsi <conn_options> -A -c <level> -m <auth_method> -u <auth_u_name> -w <chap_password> [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name]] <adapter_name> vicfg-iscsi <conn_options> --authentication --level <level> --method <auth_method> --chap_username <auth_u_name> --chap_password <chap_password> [--ip <stor_ip_addr|stor_hostname> [:<portnum>] [-name <iscsi_name]] <adapter_name>

Thetarget(-i)andname(-n)optiondeterminewhatthecommandappliesto.
Option -iandn Onlyi Neither-inorn Result CommandappliestopertargetCHAPforstatictargets. Commandappliestothediscoveryaddress. CommandappliestoperadapterCHAP.

VMware, Inc.

69

vSphere Command-Line Interface Concepts and Examples

(Optional)SettheauthenticationinformationformutualCHAPbyrunningvicfg-iscsi -Aagainwith the-boptionandadifferentauthenticationusernameandpassword. For<level>,specifychapProhibitedorchapRequired.

[Link],specify chapProhibitedtodisableit. [Link] [Link].

For<auth_method>,CHAPistheonlyvalidvalue. IMPORTANTYouareresponsibleformakingsurethatCHAPissetbeforeyousetmutualCHAP,andfor usingcompatiblelevelsforCHAPandmutualCHAP. 7 8 (Optional)SetiSCSIparametersbyrunningvicfg-iscsi -W. Aftersetupiscomplete,runvicfg-rescantorescanallstoragedevices.

Setting Up Independent Hardware iSCSI with vicfg-iscsi


WithindependenthardwarebasediSCSIstorage,youuseaspecializedthirdpartyadaptercapableof accessingiSCSIstorageoverTCP/[Link] managementforyourESXisystem. YoumustinstallandconfiguretheindependenthardwareiSCSIadapterforyourhostbeforeyoucanaccess [Link],seevendordocumentation. [Link],seethediscussionofthe correspondingcommandlineoptioninthischapter,themanpage(Linux),orthereferenceinformation. SpecifyoneoftheoptionslistedinConnectionOptionsonpage 17inplaceof<conn_options>. 1 DeterminetheHBAtypeandretrievetheHBAID.
vicf-iscsi <conn_options> --adapter --list

Configurethehardwareinitiator(HBA)byrunningvicfg-iscsi -Nwithoneormoreofthefollowing options.


--listListnetworkproperties. --ip <ip_addr>SetHBAIPv4address. --subnetmask <subnet_mask>SetHBAnetworkmask. --gateway <default_gateway>SetHBAgateway. --set ARP=true|falseEnableordisableARPredirect.

YoucanalsosettheHBAIPv4addressandnetworkmaskandgatewayinonecommand.
vicfg-iscsi <conn_options> --ip <ip_addr> --subnetmask <subnet_mask> --gateway <default_gateway>

(Optional)SettheiSCSInameandalias.
vicfg-iscsi vicfg-iscsi vicfg-iscsi vicfg-iscsi <conn_options> <conn_options> <conn_options> <conn_options> -I -n <iscsi_name> <adapter_name> --iscsiname --name <iscsi_name> <adapter_name> -I -a <alias_name> <adapter_name> --iscsiname --alias <alias_name> <adapter_name>

Addadynamicdiscoveryaddressorastaticdiscoveryaddress. Thetwotypesoftargetdifferasfollows:

Withdynamicdiscovery,[Link] followingcommand:
vicfg-iscsi <conn_options> --discovery --add --ip <ip_addr> <adapter_name>

70

VMware, Inc.

Chapter 5 Managing iSCSI Storage

Withstaticdiscovery,youmustspecifytheIPaddressandtheiSCSInameofthestoragetargettobe [Link]:
vicfg-iscsi <conn_options> --static --add --ip <ip_addr> --name <iscsi_name> <adapter_name>

Whenyoulaterremoveadiscoveryaddress,[Link] canlateraddthediscoveryaddressandrescantodisplaythecorrectparentforthestatictargets. 5 (Optional)SettheauthenticationinformationforCHAPbyrunningvicfg-iscsi -A. Youcansettheinformationforperadapter,perdiscovery,[Link] CHAPonpage 56andEnablingiSCSIAuthenticationonpage 76.


vicfg-iscsi <conn_options> --authentication --level <level> --method <auth_method> --chap_username <auth_u_name> --chap_password <chap_password> [--ip <stor_ip_addr|stor_hostname> [:<portnum>] [-name <iscsi_name]] <adapter_name>

Thetarget(-i)andname(-n)optiondeterminewhatthecommandappliesto.
Option -iandn Onlyi Neither-inorn Result CommandappliestopertargetCHAPforstatictargets. Commandappliestothediscoveryaddress. CommandappliestoperadapterCHAP.

MutualCHAPisnotsupportedforindependenthardwareiSCSIstorage. 6 7 (Optional)SetadditionaliSCSIparametersbyrunningvicfg-iscsi -W. Aftersetupiscomplete,callvicfg-rescantorescanallstoragedevices.

Listing and Setting iSCSI Options


[Link] ListingandSettingiSCSIParametersonpage 72.

Listing iSCSI Options with ESXCLI


Useesxcli iscsi informationretrievalcommandstolistexternalHBAproperties,informationabout targets,[Link] 17inplaceof <conn_options>.

Runesxcli iscsi adapter firmwaretolistoruploadthefirmwarefortheiSCSIadapter.


esxcli <conn_options> iscsi adapter firmware get --adapter=<adapter_name> esxcli <conn_options> iscsi adapter firmware set --file=<firmware_file_path>

Thesystemreturnsinformationaboutthevendor,model,description,andserialnumberoftheHBA.

Runcommandsintheesxcli iscsi adapter targetnamespace.


esxcli iscsi adapter target portallistsandsetsauthenticationandportalparameters. esxcli iscsi adapter target listlistsLUNinformation.

Setting MTU with ESXCLI


IfyouwanttochangetheMTUusedforyouriSCSIstorage,youmustmakethechangeintwoplaces.

Runesxcli network vswitch standard settochangetheMTUofthevirtualswitch. Runesxcli network ip interface settochangetheMTUofthenetworkinterface.

VMware, Inc.

71

vSphere Command-Line Interface Concepts and Examples

Listing and Setting iSCSI Options with vicfg-iscsi


Usevicfg-iscsiinformationretrievaloptionstolistexternalHBAproperties,informationabouttargets,and [Link] listedinConnectionOptionsonpage 17inplaceof<conn_options>.

Runvicfg-iscsi -P|--phbatolistexternal(vendorspecific)propertiesofaniSCSIadapter.
vicfg-iscsi <conn_options> -P -l <adapter_name> vicfg-iscsi <conn_options> --phba --list <adapter_name>

Thesystemreturnsinformationaboutthevendor,model,description,andserialnumberoftheHBA.

Runvicfg-iscsi -T| --targettolisttargetinformation.


vicfg-iscsi <conn_options> -T -l <adapter_name> vicfg-iscsi <conn_options> --target --list <adapter_name>

Thesystemreturnsinformationabouttargetsforthespecifiedadapter,includingtheiSCSIname(IQNor EUIformat)[Link] 55.

Runvicfg-iscsi -L|--luntolistLUNinformation.
vicfg-iscsi <conn_options> -L -l <adapter_name> vicfg-iscsi <conn_options> --lun --list <adapter_name>

Thecommandreturnstheoperatingsystemdevicename,busnumber,targetID,LUNID,andLUNsize fortheLUN.

Runvicfg-iscsi -Lwith-ttolistonlyLUNsonaspecifiedtarget.
vicfg-iscsi <conn_options> -L -l -t <target_ID> <adapter_name> vicfg-iscsi <conn_options> --lun --list --target_id <target_id> <adapter_name>

ThesystemreturnstheLUNsonthespecifiedtargetandthecorrespondingdevicename,devicenumber, LUNID,andLUNsize.

Runvicfg-iscsi -p|--pnptolistphysicalnetworkportalinformationforindependenthardwareiSCSI [Link]--mtu.


vicfg-iscsi <conn_options> -p -l <adapter_name> vicfg-iscsi <conn_options> --pnp --list <adapter_name>

ThesystemreturnsinformationabouttheMACaddress,MTU,andcurrenttransferrate.

Runvicfg-iscsi -I -[Link] [Link],aliasname, andaliassettablebitfortheinitiator.


vicfg-iscsi <conn_options> -I -l vmhba42

Runvicfg-iscsi -p -[Link].
vicfg-iscsi <conn_options> -p -M <mtu_size> <adapter_name> vicfg-iscsi <conn_options> --pnp --mtu <mtu-size> <adapter_name>

Listing and Setting iSCSI Parameters


YoucanlistandsetiSCSIparametersforsoftwareiSCSIandfordependenthardwareiSCSIwithESXCLIor withvicfg-iscsi.

72

VMware, Inc.

Chapter 5 Managing iSCSI Storage

Listing and Setting iSCSI Parameters with ESXCLI


YoucanretrieveandsetiSCSIparametersbyrunningoneofthefollowingcommands.
Adapterlevel parameters Targetlevel parameters Discoverylevel parameters esxcli iscsi adapter param set --adapter=<vmhba> --key=<key> --value=<value>

esxcli iscsi adapter target portal param set --adapter=<vmhba> --key=<key> --value=<value> --address=<address> --name=<[Link]> esxcli iscsi adapter discovery sendtarget param set --adapter=<vmhba> --key=<key> --value=<value> --address=<address>

Table [Link] esxcli iscsi adapter param gettodeterminewhetheraparameterissettableornot. TheparametersinTable 56applytosoftwareiSCSIanddependenthardwareiSCSI. Table 5-5. Settable iSCSI Parameters
Parameter DataDigestType Description [Link],thesystemperformsachecksumover eachPDUsdatapartandverifiesusingtheCRC32Calgorithm. Note:SystemsthatuseIntelNehalemprocessorsoffloadtheiSCSIdigestcalculationsfor softwareiSCSI,thusreducingtheimpactonperformance. ValidvaluesaredigestProhibited,digestDiscouraged,digestPreferred,or digestRequired. HeaderDigest [Link],thesystemperformsachecksumover theheaderpartofeachiSCSIProtocolDataUnit(PDU)andverifiesusingtheCRC32C algorithm. MaxOutstandingR2TdefinestheReadytoTransfer(R2T)PDUsthatcanbeintransitionbefore anacknowledgementPDUisreceived. MaximumamountofunsoliciteddataaniSCSIinitiatorcansendtothetargetduringthe executionofasingleSCSIcommand,inbytes. MaximumSCSIdatapayloadinaDataInorasolicitedDataOutiSCSIsequence,inbytes. Maximumdatasegmentlength,inbytes,thatcanbereceivedinaniSCSIPDU. Timeinterval,inseconds,betweenNOPOutrequestssentfromyouriSCSIinitiatortoaniSCSI [Link] theiSCSIinitiatorandtheiSCSItargetisactive. Supportedonlyattheinitiatorlevel. NoopTimeout Amountoftime,inseconds,[Link] [Link] NoopTimeoutlimitisexceeded,theinitiatorterminatesthecurrentsessionandstartsanew one. Supportedonlyattheinitiatorlevel. RecoveryTimeout DelayedAck Amountoftime,inseconds,[Link] exceedsitslimit,theiSCSIinitiatorterminatesthesession. Allowssystemstodelayacknowledgmentofreceiveddatapackets.

MaxOutstandingR2T FirstBurstLength MaxBurstLength MaxRecvDataSegLen NoopInterval

YoucanusethefollowingESXCLIcommandstolistparameteroptions.

Runesxcli iscsi adapter param gettolistparameteroptionsfortheiSCSIadapter. Runesxcli iscsi adapter discovery sendtarget param getoresxcli iscsi adapter target portal param settoretrieveinformationaboutiSCSIparametersandwhethertheyaresettable. Runesxcli iscsi adapter discovery sendtarget param getoresxcli iscsi adapter target portal param settosetiSCSIparameteroptions.

Ifspecialcharactersareinthe<name>=<value>sequence,forexample,ifyouaddaspace,youmustsurround thesequencewithdoublequotes(<name> = <value>).


VMware, Inc. 73

vSphere Command-Line Interface Concepts and Examples

Returning Parameters to Default Inheritance


ThevaluesofiSCSIparametersassociatedwithadynamicdiscoveryaddressorastaticdiscoverytargetare [Link],theparentisthe [Link],theparentistheadapterordiscoveryaddress.

IfyouusethevSphereClienttomodifyauthenticationsettings,youdeselecttheInheritfromParent checkboxbeforeyoucanmakeachangetothediscoveryaddressordiscoverytarget. Ifyouuseesxcli iscsi,thevalueyousetoverridestheinheritedvalue.

Inheritanceisrelevantonlyifyouwanttoreturnadynamicdiscoveryaddressorastaticdiscoverytargetto [Link],usethefollowingcommand,whichrequiresthe--nameoptionforstatic discoveryaddresses,butnotfordynamicdiscoverytargets.


Dynamictarget:esxcli iscsi adapter discovery sendtarget param set Statictarget:esxcli iscsi adapter target portal param set

Listing and Setting iSCSI Parameters with vicfg-iscsi


YoucanlistandsetiSCSIparametersbyrunningvicfg-iscsi -[Link] 56listsallsettableparameters. [Link]-iscsi --parameter --list --detailstodeterminewhetheraparameterissettableornot. TheparametersinTable 56applytosoftwareiSCSIanddependenthardwareiSCSI. Table 5-6. Settable iSCSI Parameters
Parameter DataDigestType Description [Link],thesystemperformsachecksumover eachPDUsdatapartandverifiesusingtheCRC32Calgorithm. Note:SystemsthatuseIntelNehalemprocessorsoffloadtheiSCSIdigestcalculationsfor softwareiSCSI,thusreducingtheimpactonperformance. ValidvaluesaredigestProhibited,digestDiscouraged,digestPreferred,or digestRequired. HeaderDigest [Link],thesystemperformsachecksumover theheaderpartofeachiSCSIProtocolDataUnit(PDU)andverifiesusingtheCRC32C algorithm. MaxOutstandingR2TdefinestheReadytoTransfer(R2T)PDUsthatcanbeintransitionbefore anacknowledgementPDUisreceived. MaximumamountofunsoliciteddataaniSCSIinitiatorcansendtothetargetduringthe executionofasingleSCSIcommand,inbytes. MaximumSCSIdatapayloadinaDataInorasolicitedDataOutiSCSIsequence,inbytes. Maximumdatasegmentlength,inbytes,thatcanbereceivedinaniSCSIPDU. Timeinterval,inseconds,betweenNOPOutrequestssentfromyouriSCSIinitiatortoaniSCSI [Link] theiSCSIinitiatorandtheiSCSItargetisactive. Supportedonlyattheinitiatorlevel. NoopTimeout Amountoftime,inseconds,[Link] [Link] NoopTimeoutlimitisexceeded,theinitiatorterminatesthecurrentsessionandstartsanew one. Supportedonlyattheinitiatorlevel. RecoveryTimeout DelayedAck Amountoftime,inseconds,[Link] exceedsitslimit,theiSCSIinitiatorterminatesthesession. Allowssystemstodelayacknowledgmentofreceiveddatapackets.

MaxOutstandingR2T FirstBurstLength MaxBurstLength MaxRecvDataSegLen NoopInterval

74

VMware, Inc.

Chapter 5 Managing iSCSI Storage

[Link] ConnectionOptionsonpage 17inplaceof<conn_options>.

Runvicfg-iscsi -W -ltolistparameteroptionsfortheHBA.
vicfg-iscsi <conn_options> -W -l [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name>]] <adapter_name> vicfg-iscsi <conn_options> --parameter --list [--ip <stor_ip_addr|stor_hostname> [:<portnum>] [--name <iscsi_name>]] <adapter_name>

Thetarget(-i)andname(-n)optiondeterminewhatthecommandappliesto.
Option -iandn Onlyi Neither-inorn Result Commandappliestostatictargets. Commandappliestothediscoveryaddress. Commandappliestoperadapterparameters.

Runvicfg-iscsi -W -l -k tolistiSCSIparametersandwhethertheyaresettable.
vicfg-iscsi <conn_options> -W -l -k [-i <stor_ip_addr|stor_hostname>[:<port_num>] [-n <iscsi_name>]] <adapter_name>

vicfg-iscsi <conn_options> --parameter --list --detail [--ip <stor_ip_addr|stor_hostname>[:<port_num>][--name <iscsi_name>]] <adapter_name>

Runvicfg-iscsi -W -jtosetiSCSIparameteroptions.
vicfg-iscsi <conn_options> -W -j <name>=<value> -i <stor_ip_addr|stor_hostname>[:port_num>][-n <iscsi_name>]] <adapter_name> vicfg-iscsi <conn_options> --parameter --set <name>=<value> --ip <stor_ip_addr|stor_hostname>[:port_num>][--name <iscsi_name>]] <adapter_name>

Thetarget(-i)andname(-n)optiondeterminewhatthecommandappliesto.
Option -iandn Onlyi Neither-inorn Result CommandappliestopertargetCHAPforstatictargets. Commandappliestothediscoveryaddress. CommandappliestoperadapterCHAP.

Ifspecialcharactersareinthe<name>=<value>sequence,forexample,ifyouaddaspace,youmustsurround thesequencewithdoublequotes(<name> = <value>).

Returning Parameters to Default Inheritance


ThevaluesofiSCSIparametersassociatedwithadynamicdiscoveryaddressorastaticdiscoverytargetare [Link],theparentisthe [Link],theparentistheadapterordiscoveryaddress.

IfyouusethevSphereClienttomodifyauthenticationsettings,youdeselecttheInheritfromParent checkboxbeforeyoucanmakeachangetothediscoveryaddressordiscoverytarget. Ifyouusevicfg-iscsi,thevalueyousetoverridestheinheritedvalue.

Inheritanceisrelevantonlyifyouwanttoreturnadynamicdiscoveryaddressorastaticdiscoverytargetto [Link],usethe--reset <param_name>option,whichrequiresthe--nameoptionfor staticdiscoveryaddresses,butnotfordynamicdiscoverytargets.


vicfg-iscsi <conn_options> --parameter --reset <param_name> --ip <stor_ip_addr | stor_hostname>[:port_num>] <adapter_name> vicfg-iscsi <conn_options> -W -o <param_name> -i <stor_ip_addr|stor_hostname>[:port_num>] <adapter_name>

VMware, Inc.

75

vSphere Command-Line Interface Concepts and Examples

Enabling iSCSI Authentication


YoucanenableiSCSIauthenticationwithESXCLIorwithvicfg-iscsi.

Enabling iSCSI Authentication with ESXCLI


Theesxcli iscsi adapter [Link] supportedforsoftwareiSCSIanddependenthardwareiSCSI,butnotforindependenthardwareiSCSI(see SettingiSCSICHAPonpage 56). 1 (Optional)SettheauthenticationinformationforCHAP.
esxcli <conn_options> iscsi adapter auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=[prohibited, discouraged, preferred, required] --secret=<string> --adapter=<adapter_name>

YoucansetpertargetCHAPforstatictargets,peradapterCHAP,orapplythecommandtothediscovery address.

peradapterCHAP:esxcli iscsi adapter auth chap set perdiscoveryCHAP:esxcli iscsi adapter discovery sendtarget auth chap set pertargetCHAP:esxcli iscsi adapter target portal auth chap set

Forexample:
esxcli <conn_options> iscsi adapter auth chap set --direction=uni --chap_username=User1 --chap_password=MySpecialPwd --level=preferred --secret=uni_secret --adapter=vmhba33

(Optional)SettheauthenticationinformationformutualCHAPbyrunningesxcli iscsi adapter auth chap set againwiththe-doptionsettomutualoptionandadifferentauthenticationusername andsecret.


esxcli <conn_options> iscsi adapter auth chap set --direction=mutual --mchap_username=<m_name> --mchap_password=<m_pwd> --level=[prohibited, required] --secret=<string> --adapter=<adapter_name>

For<level>,specifyprohibitedorrequired.

[Link],specify chapProhibitedtodisableit. [Link] [Link].

Fordirection,specifymutual. IMPORTANTYouareresponsibleformakingsurethatCHAPissetbeforeyousetmutualCHAP,andfor [Link]. To enable mutual authentication 1 Enableauthentication.


esxcli <conn_options> iscsi adapter auth chap set --direction=uni --chap_username=<name> --chap_password=<pw> --level=[prohibited, discouraged, preferred, required] --secret=<string> --adapter=<adapter_name>

Thespecifiedchap_usernameandsecretmustbesupportedonthestorageside. 2 ListpossibleVMkernelNICstobind.
esxcli <conn_options> iscsi logicalnetworkportal list

76

VMware, Inc.

Chapter 5 Managing iSCSI Storage

Enablemutualauthentication.
esxcli <conn_options> iscsi adapter auth chap set --direction=mutual --mchap_username=<m_name> --mchap_password=<m_pwd> --level=[prohibited, required] --secret=<string> --adapter=<adapter_name>

Thespecifiedmchap_usernameandsecretmustbesupportedonthestorageside. Makesurethefollowingrequirementsaremet.

CHAPauthenticationisalreadysetupwhenyoustartsettingupmutualCHAP. [Link] passwordaresupportedformutualauthenticationonthestorageside. CHAPandmutualCHAPusecompatibleCHAPlevels.

Aftersetupiscomplete,[Link]:
esxcli <conn_options> iscsi adapter discovery rediscover esxcli <conn_options> storage core adapter rescan --adapter=vmhba36

Enabling iSCSI Authentication with vicfg-iscsi


Thevicfg-iscsi-A -[Link] iSCSIanddependenthardwareiSCSI,[Link] page 56. To enable mutual authentication 1 EnableauthenticationontheESXihost.
vicfg-iscsi <conn_options> -A -c <level> -m <auth_method> -u <auth_u_name> -w <chap_password> [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name]] <adapter_name>

Thespecifiedusernameandpasswordmustbesupportedonthestorageside. 2 EnablemutualauthenticationontheESXihost.
vicfg-iscsi <conn_options> -A -c <level> -m <auth_method> -b -u <ma_username> -w <ma_password> [-i <stor_ip_addr|stor_hostname> [:<portnum>] [-n <iscsi_name]] <adapter_name>

Makesurethefollowingrequirementsaremet.

CHAPauthenticationisalreadysetupwhenyoustartsettingupmutualCHAP. [Link] passwordaresupportedformutualauthenticationonthestorageside. CHAPandmutualCHAPusecompatibleCHAPlevels.

Aftersetupiscomplete,performrediscoveryandrescanallstoragedevices.

Setting Up Ports for iSCSI Multipathing


Withportbinding,youcreateaseparateVMkernelportforeachphysicalNICusing1:[Link] [Link] indetailhowtospecifyportbinding. Youcannotsetupportsformultipathingbyusingvicfg-iscsi. Intheexamplesbelow,specifyoneoftheoptionslistedinConnectionOptionsonpage 17inplaceof <conn_options>. IMPORTANTTheESX/[Link].

VMware, Inc.

77

vSphere Command-Line Interface Concepts and Examples

To specify port binding 1 FindoutwhichuplinksareavailableforusewithiSCSIadapters.


esxcli <conn_options> iscsi physicalnetworkportal list --adapter=<adapter_name>

ConnectthesoftwareiSCSIordependenthardwareiSCSIinitiatortotheiSCSIVMkernelportsbyrunning thefollowingcommandforeachport.
esxcli <conn_options> iscsi networkportal nic add --adapter=<adapter_name> --nic=<bound_nic>

VerifythattheportswereaddedtotheiSCSIinitiatorbyrunningthefollowingcommand:
esxcli <conn_options> iscsi networkportal list --adapter=<adapter_name>

4 5

(Optional)IfthereareactiveiSCSIsessionsbetweenyourhostandtargets,[Link] RemovingiSCSISessionsonpage 79. RescantheiSCSIinitiator.


esxcli <conn_options> storage core adapter rescan --adapter <iscsi adapter>

TodisconnecttheiSCSIinitiatorfromtheports,runthefollowingcommand.
esxcli <conn_options> iscsi networkportal remove --adapter=<adapter_name> --nic=<bound_nic>

Managing iSCSI Sessions


Tocommunicatewitheachother,[Link] iscsi sessiontolistandmanageiSCSIsessionsforsoftwareiSCSIanddependenthardwareiSCSI.

Introduction to iSCSI Session Management


Bydefault,softwareiSCSIanddependenthardwareiSCSIinitiatorsstartoneiSCSIsessionbetweeneach [Link],yourhostcan [Link] [Link] [Link].

[Link] [Link],thearraypresentsmoredatapathsforyour [Link] performancebenefits,[Link] [Link] iscsi session addcommandto cloneasession. [Link] DataDigestparameters,youmustsettheparameter,removethesession,andaddthesessionbackforthe [Link]. [Link] usefulifyourhostconnectstoasingleportstoragesystemthat,bydefault,presentsonlyonetargetport toyourinitiator,[Link] betweenyouriSCSIinitiatorandanothertargetportcreatesanadditionalpathtothestoragesystem.

CAUTIONSomestoragesystemsdonotsupportmultiplesessionsfromthesameinitiatornameorendpoint. AttemptstocreatemultiplesessionstosuchtargetscanresultinunpredictablebehaviorofyouriSCSI environment. [Link] iscsi session --helpandeach [Link]. SpecifyoneoftheoptionslistedinConnectionOptionsonpage 17inplaceof<conn_options>. IMPORTANTTheESX/[Link] ESXi5.0hosts.
78 VMware, Inc.

Chapter 5 Managing iSCSI Storage

Listing iSCSI Sessions

ListasoftwareiSCSIsessionattheadapterlevel.
esxcli <conn_options> iscsi session list --adapter=<iscsi_adapter>

ListasoftwareiSCSIsessionatthetargetlevel.
esxcli <conn_options> iscsi session list --name=<target> --adapter=<iscsi_adapter>

Logging in to iSCSI Sessions


Youcanuseesxcli iscsi [Link] Optionsonpage 17inplaceof<conn_options>.

LogintoasessiononthecurrentsoftwareiSCSIordependenthardwareiSCSIconfigurationatthe adapterlevel.
esxcli <conn_options> iscsi session add --adapter=<adapter_name>

Forexample:
esxcli --config /host-config-file iscsi session add --adapter=vmhba36

LogintoasessiononthecurrentsoftwareiSCSIordependenthardwareiSCSIconfigurationatthetarget level.
esxcli <conn_options> iscsi session add --name=<target> --adapter=<adapter_name>

Forexample:
esxcli --config /host-config-file iscsi session add -name=[Link] --adapter=vmhba36

AddduplicatesessionswithtargetandsessionIDsincurrentsoftwareiSCSIordependenthardware iSCSIconfiguration.
esxcli <conn_options> iscsi session add --name=<[Link]> --isid=<session_id> --adapter=<iscsi_adapter>

[Link],whichyoucandeterminebylistingallsessions.session_idisthesessions [Link]:
esxcli --config /host-config-file iscsi session add -name=[Link] --isid='[Link]' --adapter=vmhba36

Removing iSCSI Sessions


Youcanuseesxcli iscsi [Link] ConnectionOptionsonpage 17inplaceof<conn_options>.

RemovesessionsfromthecurrentsoftwareiSCSIordependenthardwareiSCSIconfigurationatthe adapterlevel.
esxcli <conn_options> iscsi session remove --adapter=<iscsi_adapter>

Forexample:
esxcli iscsi session remove --adapter=vmhba36

RemovesessionsfromthecurrentsoftwareiSCSIordependenthardwareiSCSIconfigurationatthetarget level.
esxcli <conn_options> iscsi session remove --name=<iqn> --adapter=<iscsi_adapter>

Forexample:
esxcli <conn_options> iscsi session remove --name=[Link] --adapter=vmhba38

VMware, Inc.

79

vSphere Command-Line Interface Concepts and Examples

RemovesessionsfromthecurrentsoftwareiSCSIordependenthardwareiSCSIconfigurationwithtarget andsessionID.
esxcli <conn_options> iscsi session remove --name=<[Link]> --isid=<session id> --adapter=<iscsi_adapter>

[Link],whichyoucandeterminebylistingallsessions.session_idisthesessions iSCSIID. Forexample:


esxcli --config /host-config-file iscsi session remove --name=[Link] --session='[Link]' --adapter=vmhba36

80

VMware, Inc.

Managing Third-Party Storage Arrays

VMwarepartnersandcustomerscanoptimizeperformanceoftheirstoragearraysinconjunctionwith VMwarevSphereusingVMwarePSA(pluggablestoragearchitecture).Theesxcli storage core namespacemanagesVMwarePSAandtheesxcli storage nmpnamespacemanagestheVMwareNMP plugin. ThevSphereStoragedocumentationdiscussesPSAfunctionalityindetailandexplainshowtousethevSphere ClienttomanagethePSA,theassociatednativemultipathingplugin(NMP)andthirdpartypluginswiththe vSphereClient. Thischapterusesthefollowingacronyms.
Acronym PSA NMP PSP SATP Meaning PluggableStorageArchitecture. [Link]. [Link]. [Link].

Thischapterincludesthesetopics:

ManagingNMPwithesxclistoragenmponpage 81 PathClaimingwithesxclistoragecoreclaimingonpage 88 ManagingClaimRulesonpage 89

Managing NMP with esxcli storage nmp


TheNMP(NativeMultipathingPlugin)isanextensiblemultipathingmodulethatESXisupportsbydefault. Youcanuseesxcli storage nmptomanagedevicesassociatedwithNMPandtosetpathpolicies. TheNMPsupportsallstoragearrayslistedontheVMwarestorageHardwareCompatibilityList(HCL)and [Link] astoragedevice(LUN).AStorageArrayTypePlugin(SATP)determineshowpathfailoverishandledfora [Link](PSP)determineswhichphysicalpathisusedtoissueanI/O [Link].

VMware, Inc.

81

vSphere Command-Line Interface Concepts and Examples

Device Management with esxcli storage nmp device


ThedeviceoptionperformsoperationsondevicescurrentlyclaimedbytheVMwareNMPplugin.

esxcli storage nmp device list


ThelistcommandliststhedevicescontrolledbyVMwareNMPandshowstheSATPandPSPinformation [Link],runesxcli storage nmp path listto listinformationforalldevices,orforjustonedevicewiththe--deviceoption.
Options --device <device> -d <device> Description [Link] devices.

esxcli storage nmp device set


ThesetcommandsetsthePathSelectionPolicy(PSP)foradevicetooneofthepoliciesloadedonthesystem. AnydevicecanusethePSPassignedtotheSATPhandlingthatdevice,oryoucanrunesxcli storage nmp device set --device [Link] --psp <psp>tospecificallyoverridethePSPassignedtothedevice.

IfadevicedoesnothaveaspecificPSPset,[Link] fortheSATPchanges,thePSPassignedtothedevicechangesonlyafterrebootorafteradeviceis [Link]. Ifyouuseesxcli storage nmp device settooverridetheSATPsdefaultPSPwithaspecificPSP,the [Link] hasnoeffect.

Usethe--defaultoptiontoreturnthedevicetousingtheSATPsPSP.
Options --default -E --device <device> -d <device> --psp <PSP> -P <PSP> Description SetsthePSPbacktothedefaultfortheSATPassignedtothisdevice. DevicetosetthePSPfor. [Link] storage nmp psp listtodisplayall [Link] 41,SupportedPathPolicies,onpage 46. SeevSphereStorageforadiscussionofpathpolicies.

TosetthepathpolicyforthespecifieddevicetoVMW_PSP_FIXED,runthefollowingcommand:
esxcli <conn_options> storage nmp device set --device [Link] --psp VMW_PSP_FIXED

Listing Paths with esxcli storage nmp path


[Link],thecommanddisplaysinformationaboutall [Link]:

Onlyshowpathstoasingedevice(esxcli storage nmp path list --device <device>). Onlyshowinformationforasinglepath(esxcli storage nmp path list --path=<path>.

Tolistdevices,callesxcli storage nmp device list.

Managing Path Selection Policy Plugins with esxcli storage nmp psp
Useesxcli storage nmp psptomanageVMwarepathselectionpolicypluginsincludedwiththeVMware NMPpluginandtomanagethirdpartyPSPs. IMPORTANTWhenusedwiththirdpartyPSPs,thesyntaxdependsonthethirdpartyPSPimplementation.

82

VMware, Inc.

Chapter 6 Managing Third-Party Storage Arrays

Retrieving PSP Information


Theesxcli storage nmp pspgeneric deviceconfig getandesxcli storage nmp pspgeneric pathconfig [Link] commandtouse.

Usenmp pspgeneric deviceconfig getforPSPsthataresettoVMW_PSP_RR,VMW_PSP_FIXEDor VMW_PSP_MRU. Usenmp pspgeneric pathconfig getforPSPsthataresettoVMW_PSP_FIXEDorVMW_PSP_MRU.No pathconfigurationinformationisavailableforVMW_PSP_RR.

ToretrievePSPconfigurationparameters,usetheappropriatecommandforthePSP.

Deviceconfigurationinformation.
esxcli <conn_options> storage nmp psp generic deviceconfig get --device=<device> esxcli <conn_options> storage nmp psp fixed deviceconfig get --device=<device> esxcli <conn_options> storage nmp psp roundrobin deviceconfig get --device=<device>

Pathconfigurationinformation.
esxcli <conn_options> storage nmp psp generic pathconfig get --path=<path>

RetrievethePSPconfigurationforthespecifiedpath.
esxcli <conn_options> nmp psp pathconfig generic get --path vmh[Link]T2:L23

Theesxcli storage nmp psp listcommandshowsthelistofPathSelectionPluginsonthesystemanda briefdescriptionofeachplugin.

Setting Configuration Parameters for Third-Party Extensions


The esxcli storage nmp psp generic deviceconfig setandesxcli storage nmp psp generic pathconfig [Link] configurationparametersforthosethirdpartyextensions. [Link] documentationforinformation. Useesxcli storage nmp roundrobin [Link] RoundRobinSetuponpage 84. Youcanrunesxcli storage nmp psp generic deviceconfig set --device=<device>tospecifyPSP informationforadevice,andesxcli storage nmp psp generic pathconfig set --path=<path>to [Link],use--configtosetthespecifiedconfigurationstring.
Options --config <config_string> -c <config_string> --device <device> -d <device> --path <path> -p <path> Description [Link] Table 41,SupportedPathPolicies,onpage 46. Deviceforwhichyouwanttocustomizethepathpolicy. Pathforwhichyouwanttocustomizethepathpolicy.

VMware, Inc.

83

vSphere Command-Line Interface Concepts and Examples

Fixed Path Selection Policy Operations


ThefixedoptiongetsandsetsthepreferredpathpolicyforNMPdevicesconfiguredtouseVMW_PSP_FIXED.

Retrieving the Preferred Path


Theesxclistoragenmp fixed deviceconfig getcommandretrievesthepreferredpathonaspecified devicethatisusingNMPandtheVMW_PSP_FIXEDPSP.
Options --device <device> -d <device> Description [Link] VMW_PSP_FIXEDPSP.

Toreturnthepathconfiguredasthepreferredpathforthespecifieddevice,runthefollowingcommand. SpecifyoneoftheoptionslistedinConnectionOptionsonpage 17inplaceof<conn_options>.


esxcli <conn_options> storage nmp fixed deviceconfig get --device [Link]

Setting the Preferred Path


Theesxcli storage nmp fixed deviceconfig setcommandsetsthepreferredpathonaspecifieddevice thatisusingNMPandtheVMW_PSP_FIXEDpathpolicy.
Options --device <device> -d <device> Description [Link] VMW_PSP_FIXEDPSP. Useesxcli storage nmp device --listtolistthepoliciesforalldevices. --path <path> -p <path> Pathtosetasthepreferredpathforthespecifieddevice.

Tosetthepreferredpathforthespecifieddevicetovmh[Link]T5:L3,[Link] oneoftheoptionslistedinConnectionOptionsonpage 17inplaceof<conn_options>.


esxcli <conn_options> storage nmp fixed deviceconfig set --device [Link] --path vmh[Link]T5:L3

Customizing Round Robin Setup


Theesxcli storage nmp psp roundrobincommandssetsroundrobinpathoptionsonadevicecontrolled bytheVMW_PSP_RRPSP.SpecifyoneoftheoptionslistedinConnectionOptionsonpage 17inplaceof <conn_options>. To specify and customize round robin path policies 1 Setthepathpolicytoroundrobin.
esxcli <conn_options> storage nmp device set --device [Link] --psp VMW_PSP_RR

Specifywhentoswitchpaths. YoucanchoosethenumberofI/Ooperations,numberofbytes,[Link]:
esxcli <conn_options> storage nmp psp roundrobin deviceconfig set --type "bytes" -B 12345 --device [Link]

Setsthedevicespecifiedby--devicetoswitchtothenextpatheachtime12345byteshavebeensent alongthecurrentpath.
esxcli <conn_options> storage nmp psp roundrobin deviceconfig set --type=iops --iops 4200 --device [Link]

Setsthedevicespecifiedby--devicetoswitchafter4200I/Ooperationshavebeenperformedonapath.

84

VMware, Inc.

Chapter 6 Managing Third-Party Storage Arrays

Retrieving Path Selection Settings


Theesxcli storage nmp psp roundrobin deviceconfig get commandretrievespathselectionsettings [Link].
Options -d <device> --device <device> Description Devicetogetroundrobinpropertiesfor.

Specifying Conditions for Path Changes


Theesxcli storage nmp psp roundrobin deviceconfig setcommandspecifiesunderwhichconditions adevicethatisusingtheVMW_PSP_RRPSPchangestoadifferentpath.Youcanuse--bytesor--iopsto specifywhenthepathshouldchange.
Options --bytes -B --device -d --iops -I --type -t Description NumberofbytestosendalongonepathforthisdevicebeforethePSPswitchestothenextpath. Youcanusethisoptiononlywhen--typeissettobytes. [Link] (VMW_PSP_RR)PSP. NumberofI/OoperationstosendalongonepathforthisdevicebeforethePSPswitchestothe [Link]--typeissettoiops. [Link] supported:

bytes:Setthetriggerforpathswitchingbasedonthenumberofbytessentdownapath. default:Setthetriggerforpathswitchingbacktodefaultvalues. iops:SetthetriggerforpathswitchingbasedonthenumberofI/Ooperationsonapath.

Anequalsign(=)beforethetypeordoublequotesaroundthetypeareoptional. --useANO -U Ifsetto1,theroundrobinPSPincludespathsintheactive,unoptimizedstateintheroundrobin set.Ifsetto0,thePSPusesactive,unoptimizedpathsonlyifnoactiveoptimizedpathsare [Link],thePSPincludesonlyactiveoptimizedpathsintheroundrobinpathset.

Managing SATPs
Theesxcli storage nmp [Link] followngtasks:

Retrieveandsetconfigurationparameters AddandremoverulesfromthelistofclaimrulesforaspecifiedSATP SetthedefaultPSPforaspecifiedSATP ListSATPsthatarecurrentlyloadedintoNMPandtheassociatedclaimrules

ThedefaultSATPforanactiveactiveFCarraywithavendorandmodelnotlistedintheSATPrulesis VMW_SATP_DEFAULT_AA.

Retrieving Information About SATPs


Theesxcli storage nmp satplistcommandliststheSATPsthatarecurrentlyavailabletotheNMP [Link] informationabouttheseSATPs.
esxcli <conn_options> storage nmp satp list

Therule listcommandliststheclaimrulesforSATPs. esxcli <conn_options> storage nmp satp rule list

VMware, Inc.

85

vSphere Command-Line Interface Concepts and Examples

Adding SATP Rules


Claimrulesspecifythatastoragedevicethatusesacertaindriverortransportorhasacertainvendorormodel [Link] storage nmp satp rule addcommandaddsarulethatperforms [Link],thefollowing commandspecifiesthatifapathhasvendorVMWAREandmodelVirtual,thePSAassignsittothe VMW_SATP_LOCALSATP.
esxcli <conn_options> storage nmp satp rule add --satp="VMW_SATP_LOCAL" --vendor="VMWARE" --model="Virtual" --description="VMware virtual disk Option --driver -D --device -d --force -f --model -M [Link] ^mod*,[Link],thepatternsuccessfullymatches mod1andmodz,butnotmymod1. Thecommandsupportsthestart/end(^)andwildcard(*)functionalitybutnootherregular expressions. --transport -R --vendor -V --satp -s --claim-option -c --description -e --option -o --psp -P --psp-option -O --type -t SettheclaimtypewhenaddingaSATPclaimrule. PSPoptionsfortheSATPclaimrule. DefaultPSPfortheSATPclaimrule. OptionstringtosetwhenaddingtheSATPclaimrule. DescriptionstringtosetwhenaddingtheSATPclaimrule. ClaimoptionstringtosetwhenaddingtheSATPclaimrule. SATPforwhichtheruleisadded. [Link], forexample,iscsiorfc. VendorstringtosetwhenaddingtheSATPclaimrule. [Link] vendor/modelanddriverrules. Forceclaimrulestoignorevaliditychecksandinstalltheruleevenifchecksfail. Description DriverstringtosetwhenaddingtheSATPclaimrule.

[Link] Optionsonpage 17inplaceof<conn_options>.

AddaSATPrulethatspecifiesthatdiskswithvendorstringVMWAREandmodelstringVirtualshouldbe addedtoVMW_SATP_LOCAL.
esxcli <conn_options> storage nmp satp rule add --satp="VMW_SATP_LOCAL" --vendor="VMWARE" --model="Virtual" --description="VMware virtual disk"

AddaSATPrulethatspecifiesthatdiskswiththedriverstringsomedrivershouldbeaddedto VMW_SATP_LOCAL.
esxcli <conn_options> storage nmp satp rule add --satp="VMW_SATP_LOCAL" --driver="somedriver"

86

VMware, Inc.

Chapter 6 Managing Third-Party Storage Arrays

AddarulethatspecifiesthatallstoragedeviceswithvendorstringABCandamodelnamethatstartswith 120shoulduseVMW_SATP_DEFAULT_AA(VMW_SATP_DEFAULT_AAisanexample).
esxcli <conn_options> storage nmp satp rule add --satp VMW_SATP_DEFAULT_AA --vendor="ABC" --model="^120*

Removing SATP Rules


Theesxcli storage nmp satp rule [Link] [Link] 86aresupported. ThefollowingexampleremovestherulethatassignsdeviceswithvendorstringVMWAREandmodelstring VirtualtoVMW_SATP_LOCAL.
esxcli <conn_options> storage nmp satp rule remove --satp="VMW_SATP_LOCAL" --vendor="VMWARE" --model="Virtual"

Retrieving and Setting SATP Configuration Parameters


Theesxcli storage nmp satp generic deviceconfig getandesxcli storage nmp satp generic pathconfig [Link] retrievepathsordevicesforallSATPs,youmustretrievetheinformationonepathoronedeviceatatime. UsethiscommandtoretrieveperdeviceorperpathSATPconfigurationparameters,andtoseewhetheryou cansetcertainconfigurationparametersforadeviceorpath. Forexampleesxcli storage nmp satp generic deviceconfig get --device [Link] SATP VMW_SATP_LSI does not support device configuration. esxcli storage nmp satp generic pathconfig get -path vmh[Link]T0:L8mightreturnINIT,AVT OFF,v5.4,DUAL ACTIVE,ESX FAILOVER Theesxcli storage nmp satp generic deviceconfigsetandesxcli storage nmp satp generic pathconfig set commandssetconfigurationparametersforSATPsthatareloadedintothesystem,ifthey [Link]. IMPORTANTThecommandpassestheconfigurationstringtotheSATPassociatedwiththatdeviceorpath. [Link] [Link].
Options --config -c Description Configurationstringtosetforthepathspecifiedby--pathorthedevicespecifiedby--device. YoucansettheconfigurationforthefollowingSATPs:

VMW_SATP_ALUA_CX VMW_SATP_ALUA VMW_SATP_CX VMW_SATP_INV navireg_onstartsautomaticregistrationofthedevicewithNavisphere. navireg_offstopstheautomaticregistrationofthedevice. ipfilter_onstopsthesendingofthehostnameforNavisphereregistration.Usedifhostis knownaslocalhost. ipfilter_offenablesthesendingofthehostnameduringNavisphereregistration.

Youcanspecifyoneofthefollowingdeviceconfigurationstrings:

--device -d --path -p

[Link]. [Link].

Runesxcli storage nmp device set --default --device=<device> tosetthePSPforthespecified devicebacktothedefaultfortheassignedSATPforthisdevice.

VMware, Inc.

87

vSphere Command-Line Interface Concepts and Examples

Path Claiming with esxcli storage core claiming


Theesxcli storage core [Link] commandsarenotpersistentandareusefulonlytodeveloperswhoarewritingPSApluginsor [Link]/Oisactiveonthepath,unclaimandreclaimactionsfail. IMPORTANTThehelpforesxcli storage core claiming [Link] thiscommandunlessinstructedtodosobyVMwaresupportstaff.

Using the Reclaim Troubleshooting Command


Theesxcli storage core claiming reclaimtroubleshootingcommandisintendedforPSAplugin [Link].

Attemptstounclaimallpathstoadevice. Runstheloadedclaimrulesoneachoftheunclaimedpathstoreclaimthosepaths.

Itisnormalforthiscommandtofailifadeviceisinuse. IMPORTANTThereclaimcommandunclaimspathsassociatedwithadevice. YoucannotusethecommandtoreclaimpathscurrentlyassociatedwiththeMASK_PATHpluginbecause --deviceistheonlyoptionforreclaimandMASK_PATHpathsarenotassociatedwithadevice. YoucanusethecommandtounclaimpathsforadeviceandhavethosepathsreclaimedbytheMASK_PATH plugin.


Options --device <device> -d <device> --help Displaysthehelpmessage. Description Nameofthedeviceonwhichallpathsarereclaimed.

Unclaiming Paths or Sets of Paths


Theesxcli storage core claiming unclaimcommandunclaimsapathorsetofpaths,disassociating [Link]. [Link] [Link],especiallywhenyou specifyapluginoradaptertounclaim. [Link] [Link]. [Link] unclaimpathsassociatedwiththeMASK_PATHpluginbutcannotusethedeviceoptiontounclaimthose paths.
Options --adapter <adapter> -A <adapter> --channel <channel> -C <channel> --claimrule-class <cl> -c <cl> Description If--typeissettolocation,specifiesthenameoftheHBAforthepathsthatyouwant [Link],unclaimingrunsonpathsfromall adapters. If--typeissettolocation,specifiestheSCSIchannelnumberforthepathsthatyou [Link],unclaimingrunsonpathsfromall channels. [Link](Multipathing),Filter,or [Link] bothVAAI_FILTERandVAAIplugintouseit.

88

VMware, Inc.

Chapter 6 Managing Third-Party Storage Arrays

Options --device <device> -d <device> --driver <driver> -D <driver> --lun <lun_number> -L <lun_number> --model <model> -m <model> --path <path> -p <path> --plugin <plugin> -P

Description If--typeissettodevice,[Link] areactiveI/Ooperationsonthespecifieddevice,atleastonepathcannotbeunclaimed. If--typeisdriver,unclaimsallpathsspecifiedbythisHBAdriver. If--typeislocation,[Link] specify--lun,unclaimingrunsonpathswithanyLUNnumber. If--typeisvendor,attemptstounclaimallpathstodeviceswithspecificmodel information(formultipathingplugins)orunclaimthedeviceitself(forfilterplugins).If thereareactiveI/Ooperationsonthisdevice,atleastonepathfailstounclaim. If--typeispath,unclaimsapathspecifiedbyitspathUIDorruntimename. If--typeisplugin,unclaimsallpathsforaspecifiedmultipathplugin. <plugin>[Link] MASK_PATHareavailable,butadditionalpluginsmightbeinstalled. If--typeislocation,unclaimsthepathswiththeSCSItargetnumberspecifiedby [Link]--target,unclaimingrunsonpathsfromalltargets. [Link],path,driver, device,plugin,andvendor. If--typeisvendor,attemptstounclaimallpathstodeviceswithspecificvendorinfo [Link] activeI/Ooperationsonthisdevice,atleastonepathfailstounclaim

--target <target> -T <target> --type <type> -t <type> --vendor <vendor> -v <vendor>

Thefollowingtroubleshootingcommandtriestounclaimallpathsonvmhba1.
esxcli <conn_options> storage core claiming unclaim --type location -A vmhba1

Runvicfg-mpath <conn_options> -ltoverifythatthecommandsucceeded. Ifapathisthelastpathtoadevicethatwasinuse,oraifapathwasveryrecentlyinuse,theunclaimoperation [Link] [Link].

Managing Claim Rules


ThePSAusesclaimrulestodeterminewhichmultipathingmoduleshouldclaimthepathstoaparticular [Link] core claimrulemanagesclaimrules. [Link] [Link] page 17inplaceof<conn_options>. To change the current claim rules in the VMkernel 1 2 Runoneormoreoftheesxcli storage coreclaimrulemodificationcommands(add,remove,or move). Runesxcli storage core claimrule loadtoreplacethecurrentrulesintheVMkernelwiththe modifiedrulesfromtheconfigurationfile.

Youcanalsorunesxcli storage core plugin listtolistallloadedplugins.

Adding Claim Rules


Theesxcli storage core claimrule addcommandaddsaclaimruletothesetofclaimrulesonthe system.YoucanusethiscommandtoaddnewclaimrulesortomaskapathusingtheMASK_PATHclaimrule. Youmustloadtherulesafteryouaddthem.

VMware, Inc.

89

vSphere Command-Line Interface Concepts and Examples

Options --adapter <adapter> -A <adapter> --autoassign -u --channel <channel> -C <channel> --claimrule-class <cl> -c <cl>

Description [Link]--typeislocation. [Link]. [Link]--typeislocation. [Link](default),Filter,orVAAI. Toconfigurehardwareaccelerationforanewarray,addtwoclaimrules,oneforthe [Link] instructions. [Link]--typeisdriver. Forceclaimrulestoignorevaliditychecksandinstalltherule. [Link]--typeislocation. [Link]--typeisvendor. [Link] vicfg-scsidevs <conn_options> -loneachdevicetoseemodelstringvalues. [Link],thevaluesareNMPorMASK_PATH,butthirdpartiescan shiptheirownPSApluginsinthefuture. MASK_PATHreferstothepluginMASK_PATH_PLUGIN.Thecommandaddsclaimrules forthispluginiftheuserwantstomaskthepath. [Link] availableinESX/[Link] MASK_PATH_PLUGIN.YoucanaddaclaimrulethatcausestheMASK_PATH_PLUGINto [Link] documentationfordetails.

--driver <driver> -D <driver> --force -f --lun <lun_number> -L <lun_number> --model <model> -M <model> --plugin -P

--rule <rule_ID> -r <rule_ID> --target <target> -T <target> --transport <transport> -R <transport>

[Link] storage core claimrule [Link] [Link] claimrulesareevaluatedinnumericorderstartingwith101. [Link]--typeislocation. [Link] aresupported:

blockblockstorage fcFibreChannel iscsivendoriSCSI iscsinotcurrentlyused ideIDEstorage sasSASstorage sataSATAstorage usbUSBstorage parallelparallel unknown

--type <type> -t <type> --vendor -V

[Link],location,driver, andtransport. [Link]--typeisvendor. [Link] vicfg-scsidevs <conn_options> -loneachdevicetoseevendorstringvalues. WorldWideNodeNumberforthetargettouseinthisoperation. WorldWidePortNumberforthetargettouseinthisoperation.

--wwnn --wwpn

90

VMware, Inc.

Chapter 6 Managing Third-Party Storage Arrays

Claimrulesarenumberedasfollows.

Rules0100arereservedforinternalusebyVMware. [Link] [Link],thePSAclaimrule101masksDellarraypseudodevices. Donotremovethisrule,unlessyouwanttounmaskthesedevices. Rules6543665535arereservedforinternalusebyVMware.

Whenclaimingapath,thePSArunsthroughtherulesstartingfromthelowestnumberanddeterminesisa [Link],itgivesthepathtothecorresponding [Link]. [Link] Optionsonpage 17inplaceof<conn_options>.

Addrule321,whichclaimsthepathonadaptervmhba0,channel0,target0,LUN0fortheNMPplugin.
esxcli <conn_options> storage core claimrule add -r 321 -t location -A vmhba0 -C 0 -T 0 -L 0 -P NMP

Addrule429,whichclaimsallpathsprovidedbyanadapterwiththemptscsidriverfortheMASK_PATH plugin.
esxcli <conn_options> storage core claimrule add -r 429 -t driver -D mptscsi -P MASK_PATH

Addrule914,whichclaimsallpathswithvendorstringVMWAREandmodelstringVirtualfortheNMP plugin.
esxcli <conn_options> storage core claimrule add -r 914 -t vendor -V VMWARE -M Virtual -P NMP

Addrule1015,whichclaimsallpathsprovidedbyFCadaptersfortheNMPplugin.
esxcli <conn_options> storage core claimrule add -r 1015 -t transport -R fc -P NMP

Converting ESX 3.5 LUN Masks to Claim Rule Format


Theesxcli storage core claimrule convertcommandconvertsLUNmasksinESX3.5format (/adv/Disk/MaskLUNs)[Link] [Link] 17inplaceof<conn_options>. To convert ESX 3.5 format LUN masks to claim rule format 1 Runesxcli storage core claimrule convertwithoutoptions. ThatcallreturnsNo /adv/Disk/MaskLUNs config entry to convertordisplaysthelistofclaimrules [Link]: Rule 120 121 122 Plugin MASK_PATH MASK_PATH MASK_PATH HbaName vmhba11 vmhba11 vmhba4 Controller 0 0 0 Target 0 0 2 LUN 11 10 1

VMware, Inc.

91

vSphere Command-Line Interface Concepts and Examples

Runesxcli storage core claimrule convert --committoactuallycommitthechange.

WhenyouconvertLUNmaskingtotheclaimruleformatafteranupgradefromESX/ESXi3.5toESX/ESXi4.x, thiscommandconvertsthe/adv/Disk/[Link] ruleswithMASK_PATHastheplugin. [Link],roleconversion forsoftwareiSCSILUNsisnotsupported. Inspectthelistofgeneratedclaimrulescarefullybeforeyoucommitthembyusing--commit. Table 6-1. esxcli storage core claimrule convert Options
Options --commit -C Description [Link] parameter,changesarenotsaved,andyoucanfirstinspectthegeneratedclaimrules.

Removing Claim Rules


Theesxcli storage core claimrule removecommandremovesaclaimrulefromthesetofclaimrules onthesystem. IMPORTANTBydefault,[Link], unlessyouwanttounmaskthesedevices.
Option --rule <rule_ID> -r <rule_ID> Description [Link] storage core claimrule listtoseetheruleID.

Thefollowingexampleremovesrule1015.
esxcli <conn_options> storage core claimrule remove -r 1015

Listing Claim Rules


[Link].
Option --claimrule-class <cl> -c <cl> Description [Link](Multipathing),Filter,or [Link] bothVAAI_FILTERandVAAIplugintouseit.SeevSphereStorageforinformationabout VAAI.

[Link],sobothformsofthecommandhavethesame [Link] 17inplaceof<conn_options>.


esxcli <conn_options> storage core claimrule list -c Filter esxcli <conn_options> storage core claimrule list --claimrule-class=Filter

Loading Claim Rules


Theesxcli storage core claimrule [Link] [Link] timeconfiguration. Thiscommandhasnooptions;[Link].

92

VMware, Inc.

Chapter 6 Managing Third-Party Storage Arrays

Moving Claim Rules


Theesxcli storage core claimrule movecommandmovesaclaimrulefromoneruleIDtoanother.
Options --claimrule-class <cl> -c <cl> --new-rule <rule_ID> -n <rule_ID> --rule <rule_ID> -r <rule_ID> Description Claimruleclasstouseinthisoperation. NewruleIDyouwanttogivetotherulespecifiedbythe--ruleoption. [Link] storage core claimrule listtodisplay theruleID.

[Link] inConnectionOptionsonpage 17inplaceof<conn_options>.


esxcli <conn_options> storage core claimrule move -r 1015 -n 1016

Running Path Claiming Rules


Theesxcli storage core claimrule [Link] [Link],thesystemchecksforclaimruleupdateseveryfiveminutes [Link] 17inplaceof <conn_options>. To load and apply claim rules 1 Modifyrulesandloadthem.
esxcli <conn_options> storage core claimrule load

Quiescethedevicesthatusepathsforwhichyouwanttochangetheruleandunclaimthosepaths.
esxcli <conn_options> storage core claiming unclaim --device=<device>

Runpathclaimingrules.
esxcli <conn_options> storage core claimrule run

Thiscommandisalsousedfortroubleshootingandboottimeconfiguration.
Options --adapter <adapter> -A <adapter> --channel <channel> -C <channel> --claimrule-class -c --lun <lun> -L <lun> --path <path_UID> -p <path_UID> --target <target> -T <target> Description If--typeislocation,[Link] runclaimrulesonpathsfromalladapters,omitthisoption. If--typeislocation,valueoftheSCSIchannelnumberforthepathstorunthe [Link],omitthis option. Claimruleclasstouseinthisoperation. If--typeislocation,[Link] runclaimrulesonpathswithanyLUN,omitthisoption. If--typeispath,thisoptionindicatestheuniquepathidentifier(UID)orthe runtimenameofapathtorunclaimruleson. If--typeislocation,valueoftheSCSItargetnumberforthepathstorunclaim [Link],omitthisoption

VMware, Inc.

93

vSphere Command-Line Interface Concepts and Examples

Options --type <location|path|all> -t <location|path|all> --wait -w

Description [Link],usesall,whichmeansclaimrulesrunwithout [Link],path,and all. Youcanusethisoptiononlyifyoualsouse--typeall. Iftheoptionisincluded,theclaimwaitsforpathstosettlebeforerunningtheclaim [Link],thesystemdoesnotstarttheclaimingprocessuntilitislikely thatallpathsonthesystemhaveappearedbeforestartingtheclaimprocess. Aftertheclaimingprocesshasstarted,thecommanddoesnotreturnuntildevice registrationhascompleted. Ifyouaddorremovepathsduringtheclaimingorthediscoveryprocess,thisoption mightnotworkcorrectly.

94

VMware, Inc.

Managing Users

AnESXisystemgrantsaccesstoitsresourceswhenaknownuserwithappropriatepermissionslogsontothe [Link] [Link]-usercommandtocreate,modify,delete, [Link] vCenterServersystem. Thischapterincludesthefollowingtopics:


UsersandGroupsinthevSphereEnvironmentonpage 95 vicfguserCommandSyntaxonpage 95 ManagingUserswithvicfguseronpage 96 ManagingGroupswithvicfguseronpage 98

Users and Groups in the vSphere Environment


Users,groups,androlescontrolwhohasaccesstovSpherecomponentsandwhatactionseachusercan [Link]. [Link]. vCenterServerandESXisystemsauthenticateauserwithacombinationofusername,password,and [Link]. [Link] andvCenterServerusesetsofprivileges,orroles,tocontrolwhichusersorgroupscanaccessparticular [Link]. TheprivilegesandrolesassignedonanESXihostareseparatefromtheprivilegesandrolesassignedona [Link],onlytheprivilegesandroles [Link] vSphereClient,onlytheprivilegesandrolesassigneddirectlyonthehostareavailable.

vicfg-user Command Syntax


[Link]:
vicfg-user <conn_options> -e <user|group> -o <add|modify|delete|list>

Ifyoucreateauserwithoutspecifyingtherole(--role),[Link] usersrole,youcanonlychangetheuserspermission. IMPORTANTIfyoucreateauserwiththevSphereClient,youcannotmakechangestothatuserwiththe vicfg-usercommand.

VMware, Inc.

95

vSphere Command-Line Interface Concepts and Examples

Options [Link] [Link] 17.


Option --addgroup <group_list> -g <group_list> --adduser <user_list> -u <user_list> --entity <group|user> -e <group|user> --group <name> -d <name> --groupid <group_id> -D <group_id> --login <login_id> -l <login_id> --newpassword <p_wd> -p <p_wd> --newuserid <UUID> -i <UUID> --newusername <name> -n <name> --operation -o --removegroup <group_list> -G <group_list> --removeuser <user_list> -U <user_list> --role <admin|read-only|no-access> -r <admin|read-only|no-access> Description Commaseparatedlistofgroupstoaddtheuserto. [Link] listofusers. [Link]. Groupnameofthegroup. GroupIDofthegroup. LoginIDoftheuser. Passwordforthetargetuser. NewUUIDforthetargetuser. Newusernameforthetargetuser. [Link],modify,delete,orlist. Commaseparatedlistofgroupstoremovethetargetuserfrom. Commaseparatedlistofuserstoberemovedfromthetargetgroup. [Link],read-only,or no-access. Usersthatyoucreatewithoutassigningpermissionshavenopermissions. --shell -s [Link] commandtochangethedefaultortorevokeshellaccessrightsafterthey havebeengranted. Validvaluesareyesandno. [Link] [Link].

Managing Users with vicfg-user


AuserisanindividualauthorizedtologintoanESXiorvCenterServersystem. vSpheredoesnotexplicitlyrestrictuserswiththesameauthenticationcredentialsfromaccessingandtaking actionwithinthevSphereenvironmentsimultaneously. YoumanageusersdefinedonthevCenterServersystemandusersdefinedonindividualhostsseparately.

ManageusersdefinedonESXiwiththevSphereClient,thevSphereWebServicesSDK,orvicfg-user. ManagevCenterServeruserswiththevSphereClientorthevSphereWebServicesSDK.

IMPORTANTYoucannotmodifyuserscreatedwiththevSphereClientwiththevicfg-usercommand. IfyoucreateauserwiththevSphereClient,youcannotmakechangestothatuserwiththevicfg-user command.

96

VMware, Inc.

Chapter 7 Managing Users

EveniftheuserlistsofahostandavCenterServersystemappeartohavecommonusers(forinstance,auser calleddevuser),[Link] Server,includingpermissions,passwords,andsoforth,areseparatefromtheattributesofdevuserontheESXi [Link],youmighthavepermissiontoviewanddeletefilesfroma [Link],youmightnothavethesepermissions. UsersauthorizedtoworkdirectlyonanESXihostareaddedtotheinternaluserlistwhenESXiisinstalledor [Link]-usertoaddusers,removeusers, changepasswords,setgroupmembership,andconfigurepermissions. CAUTIONSeetheAuthenticationandUserManagementchapterofvSphereSecurityforinformationaboutroot [Link] consequences. EachESXihosthasseveraldefaultusers:

[Link] [Link] [Link],creatinggroupsandusers(onESXihostsonly), workingwithevents,andsoon. ThevpxuseruserisavCenterServerentitywithrootrightsontheESXihost,allowingittomanage [Link]. vpxuserisnotpresentontheESXihostunlessthehostisbeingmanagedthroughvCenterServer. Otherusersmightbedefinedbythesystem,dependingonthenetworkingsetupandotherfactors.

[Link] listedinConnectionOptionsonpage 17inplaceof<conn_options>. To create, modify, and delete users 1 Listtheexistingusers.


vicfg-user <conn_options> -e user -o list

Thelistdisplaysallusersthatarepredefinedbythesystemandallusersthatwereaddedlater. IMPORTANTThecommandlistsamaximumof100users. 2 Addanewuser,specifyingaloginIDandpassword.


vicfg-user <conn_options> -e user -o add -l user27 -p 27_password

[Link],thecommandautogeneratesaUIDfortheuser. 3 ListtheusersagaintoverifythatthenewuserwasaddedandaUIDwasgenerated.
vicfg-user <conn_options> -e user -o list USERS ------------------Principal -: root Full Name -: root UID -: 0 Shell Access -> 1 ------------------... -------------------Principal -: user27 Full Name -: UID -: 501 Shell Access -> 0

Modifythepasswordforuseruser27.
vicfg-user <conn_options> -e user -o modify -l user27 -p 27_password2

ThesystemmightreturnUpdated user user27 successfully.


VMware, Inc. 97

vSphere Command-Line Interface Concepts and Examples

Assignreadonlyprivilegestotheuser(whocurrentlyhasnoaccess).
vicfg-user <conn_options> -e user -o modify -l user27 --role read-only

Thesystempromptswhetheryouwanttochangethepassword,whichmightbeadvisableiftheuserdoes [Link].
Updated user user27 successfully. Assigned the role read-only

Listtheexistinggroups.
vicfg-user <conn_options> -e group -o list

Thesystemprintsanextensivelistofallgroupsandtheusersineachgroup. 7 Createagroup.
vicfg-user <conn_options> -e group -o add -d test

Thesystemaddsthegroup,[Link],thenewgroupis included.
---------Group Information: Principal -: test Full Name -: GID -: 500 ----------

Adduseruser27tothenewgroup.
vicfg-user <conn_options> -e user -o modify -l user27 -g test

[Link],thenewgroupandthe assigneduserareincluded.
---------Group Information: Principal -: test Full Name -: GID -: 500 Users in group test: Principal -: user27 Full Name -: ___________

RemovetheuserwithloginIDuser27.
vicfg-user <conn_options> -e user -o delete -l user27

Thesystemremovestheuserandprintsamessage.
Removed the user user27 successfully.

Managing Groups with vicfg-user


[Link] throughacommonsetofpermissions. [Link],allusersinthe [Link]. [Link] thevSphereClientorvCLI.

UsetheUsersandGroupstabinavSphereClientconnecteddirectlytothehost. Usethevicfg-uservCLIcommand.

IMPORTANTManageausereitherwiththevSphereClientorwiththevCLIcommand.

98

VMware, Inc.

Chapter 7 Managing Users

Beforeyoucanadduserstoagroup,youmustcreatethegroupbyusingthevicfg-user addcommand,as [Link] 17inplaceof <conn_options>.

[Link],thesystemassignsanIDforthe group.
vicfg-user <conn_options> -e group -o add -d group40 -D 55

Createagroupwithpredefinedreadonlyprivilegesthatyoucanlaterusetoassignreadonlyprivileges tomultipleusers.
vicfg-user <conn_options> --entity group --operation add --group group42 --groupid 4242 --role read-only

Youcanthenaddandremoveusersfromthegroup,[Link] optionslistedinConnectionOptionsonpage 17inplaceof<conn_options>. To add and remove users from groups 1 Addauserwithusernametesttoagroupgroup42.
vicfg-user <conn_options> -e group -o modify -d group42 --adduser test

[Link]. 2 Adduserswithusernamesu1,u2,andu3togroup45,whichhasreadonlyprivileges.
vicfg-user <conn_options> -e group -o modify -d group45 --adduser u1,u2,u3

Removetheuserwithusernameu3fromthegroup.
vicfg-user <conn_options> -e group -o modify -d group45 --removeuser u3

Removethegroupwithgroupnamegroup45.
vicfg-user <conn_options> -e group -o delete -d group45

Youcanonlyremovegroupsthatdonothaveusers.

VMware, Inc.

99

vSphere Command-Line Interface Concepts and Examples

100

VMware, Inc.

Managing Virtual Machines

[Link] vmware-cmdyoucanregisterandunregistervirtualmachines,retrievevirtualmachineinformation,manage snapshots,turnthevirtualmachineonandoff,addandremovevirtualdevices,andpromptforuserinput. Thechapterincludesthesetopics:


vmwarecmdOverviewonpage 101 ListingandRegisteringVirtualMachinesonpage 102 RetrievingVirtualMachineAttributesonpage 103 ManagingVirtualMachineSnapshotswithvmwarecmdonpage 104 PoweringVirtualMachinesOnandOffonpage 105 ConnectingandDisconnectingVirtualDevicesonpage 106 WorkingwiththeAnswerVMAPIonpage 107 ForciblyStoppingVirtualMachineswithEXCLIonpage 107

SomevirtualmachinemanagementutilityapplicationsareincludedinthevSphereSDKforPerl. ThevSpherePowerCLIcmdlets,whichyoucaninstallforusewithMicrosoftPowerShell,managemany aspectsofvirtualmachines.

vmware-cmd Overview
[Link]-cmdcommandhasbeen availableinthevCLIpackagesinceESXiversion3.0. [Link]-cmdvCLIcommandinstead. Olderversionsofvmware-cmdsupportasetofconnectionoptionsandgeneraloptionsthatdifferfromthe [Link] commandalsosupportsthestandardvCLI--server,--username,--password,and--vihostoptions. vmware-cmddoesnotsupportotherconnectionoptions. IMPORTANTvmware-cmdisalegacytoolandsupportstheusageofVMFSpathsforvirtualmachine [Link],usedatastorepathstoaccessvirtualmachineconfigurationfiles.

VMware, Inc.

101

vSphere Command-Line Interface Concepts and Examples

Connection Options for vmware-cmd


[Link] optionsarenotsupported,forexample,youcannotusevariablesbecausethecorrespondingoptionisnot supported.
Option --server <host> -H <host> --vihost <target> -h <target> -O <port> username <username> -U <username> password <password> -P <password> -Q <protocol> Protocoltouse,[Link]. Passwordfortheuserspecifiedby-U. Whenyourunvmware-cmdwiththe-HoptionpointingtoavCenterServersystem,use --vihosttospecifytheESXihosttorunthecommandagainst. Alternativeconnectionport.Thedefaultportnumberis902. Userwhoisauthorizedtologintothehostspecifiedby--serveror--vihost. Description TargetESXiorvCenterServersystem.

General Options for vmware-cmd


Thevmware-cmdvCLIcommandsupportsthefollowinggeneraloptions.
Option --help -q -v Description Printsahelpmessagethatliststheoptionsforthiscommand. [Link] arguments. Runsinverbosemode.

Format for Specifying Virtual Machines


Whenyourunvmware-cmd,[Link] usingoneofthefollowingformats:

Datastoreprefixstyle:'[ds_name] relative_path',forexample:
'[myStorage1] testvms/VM1/[Link]'(Linux)

"[myStorage1] testvms/VM1/[Link]" (Windows)

UUIDbasedpath: folder/subfolder/file,forexample:
'/vmfs/volumes/mystorage/testvms/VM1/[Link]'(Linux)

"/vmfs/volumes/mystorage/testvms/VM1/[Link]"(Windows)

Listing and Registering Virtual Machines


RegisteringorunregisteringavirtualmachinemeansaddingthevirtualmachinetothevCenterServerorESXi inventoryorremovingthevirtualmachine. IMPORTANTIfyouregisteravirtualmachinewithavCenterServersystem,andthenremoveitfromtheESXi host,[Link]-cmd -s unregisterwiththevCenterServersystem asthetargettoresolvetheissue. ThefollowingexamplescenariolistsallregisteredvirtualmachinesonavCenterServer,unregistersavirtual machine,andreregistersthevirtualmachine.

102

VMware, Inc.

Chapter 8 Managing Virtual Machines

To list, unregister, and register virtual machines 1 Runvmware-cmd -ltolistallregisteredvirtualmachinesonaserver.


vmware-cmd -H <vc_server> -U <login_user> -P <login_password> --vihost <esx_host> -l

ThecommandliststheVMXfileforeachvirtualmachine.
/vmfs/volumes/<storage>/winxpPro-sp2/[Link] /vmfs/volumes/<storage>/RHEL-lsi/[Link] /vmfs/volumes/<storage>/VIMA0809/[Link] .....

Runvmware-cmd -s unregistertoremoveavirtualmachinefromtheinventory.
vmware-cmd -H <vc_server> -U <login_user> -P <login_password> --vihost <esx_host> -s unregister /vmfs/volumes/Storage2/testvm/[Link]

Thesystemreturns0toindicatesuccess,1toindicatefailure. NOTEWhenyourunagainstavCenterServersystem,youmustspecifythedatacenterandtheresource [Link]-datacenterandthedefaultresource poolisResources. WhenyourunagainstanESXihost,youusuallydonotspecifytheresourcepoolanddatacenter. However,iftwovirtualmachineswiththesamenameexistintworesourcepools,youmustspecifythe resourcepool. 3 4 Runvmware-cmd -lagaintoverifythatthevirtualmachinewasremovedfromtheinventory. Runvmware-cmd -s registertoaddthevirtualmachinebacktotheinventory.
vmware-cmd -H <vc_server> -U <login_user -P <login_password --vihost <esx_host> -s register /vmfs/volumes/Storage2/testvm/[Link]

Thesystemreturns0toindicatesuccess,1toindicatefailure.

Retrieving Virtual Machine Attributes


[Link] youspecifythevirtualmachinepath(seeFormatforSpecifyingVirtualMachinesonpage 102).Youmust alsospecifyconnectionoptions,whichdifferfromothervCLIcommands(seeConnectionOptionsfor vmwarecmdonpage 102). Youcanusevmware-cmdoptionstoretrieveanumberofdifferentvirtualmachineattributes.

Thegetuptimeoptionretrievestheuptimeoftheguestoperatingsystemonthevirtualmachine,in seconds.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] getuptime getuptime() = 17921

Thegetproductinfo productoptionliststheVMwareproductthatthevirtualmachinerunson.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] getproductinfo product

Thereturnvalueisesx(VMwareESX),embeddedESX(VMwareESXi),orunknown.

Thegetproductinfo platformoptionliststheplatformthatthevirtualmachinerunson.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] getproductinfo platform

Thereturnvalueiswin32-x86(x86basedWindowssystem),linux-x86(x86basedLinuxsystem),or vmnix-x86(x86basedESXimicrokernel).

VMware, Inc.

103

vSphere Command-Line Interface Concepts and Examples

Thegetproductinfo build,getproductinfo majorversion,orgetproductinfo minorversion optionsretrieveversioninformation. Thegetstateoptionretrievestheexecutionstateofthevirtualmachine,whichcanbeon,off, suspended,orunknown.


vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] getstate getstate() = on

ThegettoolslastactiveoptionindicateswhetherVMwareToolsisinstalledandwhethertheguest operatingsystemisrespondingnormally.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] gettoolslastactive

Thecommandreturnsanintegerindicatinghowmuchtimehaspassed,inseconds,sincethelast [Link] [Link], [Link] returnsoneofthefollowingvalues:


0VMwareToolsisnotinstalledornotrunning. 1Guestoperatingsystemisrespondingnormally. [Link]. [Link].

NOTEYouusuallyusethevmware-cmd guestinfooptiononlywhenVMwareSupportinstructsyoutodo [Link].

Managing Virtual Machine Snapshots with vmware-cmd


Asnapshotcapturestheentirestateofthevirtualmachineatthetimeyoutakethesnapshot. Virtualmachinestateincludesthefollowingaspectsofthevirtualmachine.

[Link]. [Link]. [Link].

Whenyoureverttoasnapshot,youreturntheseitemstothestatetheywereinatthetimethatyoutookthe [Link],makesurethat itisinthatstatewhenyoutakethesnapshot. Youcanusesnapshotsasrestorationpointswhenyouinstallupdatepackages,orduringabranchingprocess, [Link] [Link]. [Link]-cmdonlysupportsrevertingto thecurrentsnapshot.

Taking Virtual Machine Snapshots


Youcantakeasnapshotwhileavirtualmachineisrunning,shutdown,[Link] ofsuspendingavirtualmachine,waituntilthesuspendoperationhasfinishedbeforetakingasnapshot. Ifavirtualmachinehasmultipledisksindifferentdiskmodes,youmustshutdownthevirtualmachinebefore [Link],ifyouhaveaspecialpurposeconfigurationthatrequiresyoutousean independentdisk,youmustshutdownthevirtualmachinebeforetakingasnapshot.

104

VMware, Inc.

Chapter 8 Managing Virtual Machines

To take a snapshot 1 (Optional)Ifthevirtualmachinehasmultipledisksindifferentdiskmodes,shutdownthevirtual machine.


vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] stop soft

(Optional)Checkthattheshutdownoperationhasbeencompleted.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] getstate

Runvmware-cmdwiththecreatesnapshotoption. Youmustspecifythedescription,quiesceflag(0or1)andmemoryflag(0or1).
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] createsnapshot VM1Aug09 test snapshot August 09 0 0

Checkthatthevirtualmachinehasasnapshotbyusingthehassnapshotoption. Thecallreturns1ifthevirtualmachinehasasnapshotandreturns0otherwise.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] hassnapshot hassnapshot () = 1

Reverting and Removing Snapshots


Youcanusevmware-cmdtoreverttothecurrentsnapshotortoremoveasnapshot. [Link] namedsnapshot. [Link],the commanddoesnothingandleavesthevirtualmachinestateunchanged.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] revertsnapshot

Runvmware-cmdwiththeremovesnapshotsoptiontoremoveallsnapshotsassociatedwithavirtual [Link],thecommanddoesnothing.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] removesnapshots

Powering Virtual Machines On and Off


Youcanstart,reboot,stop,[Link] thepowerop_modeflag,whichcanbesoftorhard. IMPORTANTYoumusthavethecurrentversionofVMwareToolsinstalledandrunningintheguestoperating systemtouseasoftpoweroperation.

Softpoweroperations.Whenyouspecifysoftasthepowerop_modevalue,theresultofthecalldepends ontheoperation.
Operation Stop Reset Suspend Result vmware-cmdattemptstoshutdowntheguestoperatingsystemandpowersoffthevirtualmachine. vmware-cmdattemptstoshutdowntheguestoperatingsystemandrebootsthevirtualmachine. vmware-cmdattemptstorunascriptintheguestoperatingsystembeforesuspendingthevirtual machine.

VMware, Inc.

105

vSphere Command-Line Interface Concepts and Examples

[Link]-cmdimmediatelyandunconditionallyshutsdown,resets,orsuspends thevirtualmachine.

Thefollowingexamplesillustratehowtousevmware-cmd.

[Link] powerop_mode,eitherhardorsoft,isrequired.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] start soft

Reset.Whenyouresetthevirtualmachinewiththesoftpower_opmode(thedefault),theguest operatingsystemisshutdownbeforethereset. IfVMwareToolsisnotcurrentlyinstalledonthevirtualmachine,youcanperformonlyahardreset operation. a CheckthatVMwaretoolsisinstalledsothatyoucanresetthevirtualmachinewiththedefault power_opmode,whichissoft.


vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] gettoolslastactive

SeeRetrievingVirtualMachineAttributesonpage 103. b Usetheresetoptiontoshutdownandrestartthevirtualmachine.


vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] reset soft

[Link].

Thesuspendoptionwiththehardpoweropmodeunconditionallyshutsdownavirtualmachine.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] suspend hard

Thesuspendoptionwiththesoftpoweropmoderunsscriptsthatresultinagracefulshutdownof [Link] softpowerop_mode.


vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] suspend soft

Connecting and Disconnecting Virtual Devices


[Link] selectedguestoperatingsystemdetermineswhichoftheavailabledevicesyoucanaddtoagivenvirtual machine. ThevirtualhardwarethatyouaddappearsinthehardwarelistthatisdisplayedintheVirtualMachine [Link],ifthe followingconditionsaremet:

[Link] SystemInstallationdocumentation. Thevirtualmachineisusinghardwareversion7.

Thefollowingexamplesillustrateconnectinganddisconnectingavirtualdevice.

TheconnectdeviceoptionconnectsthevirtualIDEdeviceCD/DVDDrive2tothespecifiedvirtual machine.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] connectdevice "CD/DVD Drive 2"

Thedisconnectdeviceoptiondisconnectsthevirtualdevice.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host> /vmfs/volumes/Storage2/testvm/[Link] disconnectdevice "CD/DVD Drive 2"

106

VMware, Inc.

Chapter 8 Managing Virtual Machines

Working with the AnswerVM API


TheAnswerVMAPIallowsuserstoprovideinputtoquestions,therebyallowingblockedvirtualmachine [Link]-cmd --[Link] [Link]: 1 2 Theuserclonesavirtualmachineandprovidesthedefaultvirtualdisktype. Whentheuserpowersonthevirtualmachine,itpromptsforthedesiredvirtualdisktype.

Forcibly Stopping Virtual Machines with EXCLI


Insomecases,[Link],it [Link] mightresultinguestoperatingsystemdatalossandissimilartopullingthepowercableonaphysical machine. Youcanforciblystopvirtualmachinesthatarenotrespondingtonormalstopoperationwiththeesxcli vm process [Link] 17inplaceof <conn_options>. To forcibly stop a virtual machine 1 ListallrunningvirtualmachinesonthesystemtoseetheWorldIDofthevirtualmachinethatyouwant tostop.
esxcli <conn_options> vm process list

Stopthevirtualmachinebyrunningthefollowingcommand.
esxcli <conn_options> vm process kill --type <kill_type> --world-id <ID>

[Link](softbeforehard,hardbefore force).Thefollowingtypesaresupportedthroughthe--typeoption:

[Link](likekillorkill -SIGTERM) [Link](likekill -9orkill -SIGKILL) [Link].

Ifallthreeoptionsdonotwork,rebootyourESXihosttoresolvetheissue.

VMware, Inc.

107

vSphere Command-Line Interface Concepts and Examples

108

VMware, Inc.

Managing vSphere Networking

[Link] [Link] [Link] environmenttoworkwithexternalnetworkssuchasSNMPorNTP. Thischapterincludesthefollowingtopics:


IntroductiontovSphereNetworkingonpage 109 RetrievingBasicNetworkingInformationonpage 111 SettingUpvSphereNetworkingwithvSphereStandardSwitchesonpage 112 SettingUpvSphereNetworkingwithvSphereDistributedSwitchonpage 122 ManagingStandardNetworkingServicesinthevSphereEnvironmentonpage 123 SettingtheDNSConfigurationonpage 123 AddingandStartinganNTPServeronpage 125 ManagingtheIPGatewayonpage 126 UsingvicfgipsecforSecureNetworkingonpage 126 UsingesxclinetworkfirewallforESXiFirewallManagementonpage 130

Introduction to vSphere Networking


[Link](VSS)and distributedswitches(VDS).Eachvirtualswitchhasapresetnumberofportsandoneormoreportgroups. Virtualswitchesallowyourvirtualmachinestoconnecttoeachotherandtoconnecttotheoutsideworld.

Whentwoormorevirtualmachinesareconnectedtothesamevirtualswitch,networktrafficbetween themisroutedlocally. Whenvirtualmachinesareconnectedtoavirtualswitchthatisconnectedtoanuplinkadapter,each [Link] connectedtoastandardswitchoradistributeduplinkportconnectedtoadistributedswitch.

VirtualswitchesallowyourESXihosttomigratevirtualmachineswithVMwarevMotionandtouseIPstorage throughVMkernelnetworkinterfaces.

UsingvMotion,[Link] withvicfg-vmknic --[Link]. IPstoragereferstoanyformofstoragethatusesTCP/IPnetworkcommunicationasitsfoundationand [Link],theycanusethesame VMkernelinterfaceandportgroup.

VMware, Inc.

109

vSphere Command-Line Interface Concepts and Examples

ThenetworkservicesthattheVMkernelprovides(iSCSI,NFS,andvMotion)useaTCP/IPstackinthe [Link]/[Link] ofthesestacksaccessesvariousnetworksbyattachingtooneormoreportgroupsononeormorevirtual switches.

Networking Using vSphere Standard Switches


vSpherestandardswitchesallowyoutoconnectvirtualmachinestotheoutsideworld. Figure 9-1. Networking with vSphere Standard Switches
VM VM VM Network C port groups VM VM

vSphere Standard Switch Host1 Host1

vSphere Standard Switch

Host2

virtual

Host2 physical

physical network adapters

physical network

Figure [Link] thoseinthefigure.

AssociatedwitheachESXihostareoneormoreuplinkadapters(1).Uplinkadaptersrepresentthe [Link] esxcli network [Link] 117. Eachuplinkadapterisconnectedtoastandardswitch(2).Youcanmanageastandardswitchand associateitwithuplinkadaptersbyusingtheesxcli network vswitchorvicfg-vswitchvCLI [Link] page 112. Associatedwiththestandardswitchareportgroups(3).Portgroupisauniqueconceptinthevirtual [Link] security,networksegmentation,betterperformance,highavailability,[Link] usetheesxcli network vswitch standard portgrouporvicfg-vswitchcommandtoassociatea standardswitchwithaportgroup,andtheesxcli network ip interfaceorvicfg-vmkniccommand toassociateaportgroupwithaVMkernelnetworkinterface. TheVMkernelTCP/IPnetworkingstacksupportsiSCSI,NFS,andvMotionandhasanassociated [Link] network ip [Link] 119. SeparateVMkernelnetworkinterfacesareoftenusedforseparatetasks,forexample,youmightdevote [Link]/IP stacksandconnecttotheVMkernelattheEthernetlevelthroughvirtualswitches.

110

VMware, Inc.

Chapter 9 Managing vSphere Networking

Networking Using vSphere Distributed Switches


Whenyouwanttoconnectavirtualmachinetotheoutsideworld,youcanuseastandardswitchora [Link],thevirtualmachinecanmaintainitsnetworksettingsevenifthe virtualmachineismigratedtoadifferenthost. Figure 9-2. Networking with vSphere Distributed Switches
VM VM VM Network C distributed port group A B C D E F G H I J VM VM

vSphere Distributed Switch Host1 Host1 uplink

uplink

Host2

virtual

Host2 physical

physical network adapters

physical network

Eachphysicalnetworkadapter(1)onthehostispairedwithadistributeduplinkport(2),which [Link],thevirtualmachinenolonger dependsonthehostsphysicaluplinkbutonthe(virtual)[Link] primarilyusingthevSphereClientorvSphereAPIs. Thedistributedswitchitself(3)[Link] switchisnotassociatedwithasinglehost,virtualmachinescanmaintainconsistentnetwork configurationastheymigratefromonehosttoanother. Likeastandardswitch,eachdistributedswitchisanetworkhubthatvirtualmachinescanuse.A distributedswitchcanroutetrafficinternallybetweenvirtualmachinesorlinktoanexternalnetworkby [Link],but [Link] switcheswiththeesxcli network [Link] AssociatingaSwitchwithaNetworkInterfaceonpage 112.

Retrieving Basic Networking Information


[Link] insteaduseESXCLIcommandsdirectlyintheshellorusevCLIcommands. OnESXi5.0,ifconfiginformationshouldbetheinformationoftheVMkernelNICthatattachestothe [Link].
esxcli esxcli esxcli esxcli <conn_options> <conn_options> <conn_options> <conn_options> network network network network ip ip ip ip interface interface interface interface list ipv4 get -n vmk<X> ipv6 get -n vmk<X> ipv6 address list

ForinformationcorrespondingtotheLinuxnetstatcommand,usethefollowingESXCLIcommand.
esxcli <conn_options> network ip connection list

VMware, Inc.

111

vSphere Command-Line Interface Concepts and Examples

Setting Up vSphere Networking with vSphere Standard Switches


Youcansetupyourvirtualnetworkbyperformingthesetasks. 1 Createormanipulatevirtualswitchesusingesxcli network [Link], eachESXihosthasonevirtualswitch,[Link] [Link] onpage 112. (Optional)Makechangestotheuplinkadapterusingesxcli network vswitch standard uplinkor [Link] 117. (Optional)Useesxcli network vswitch standard portgrouporvicfg-vswitchtoaddportgroups [Link] 115. (Optional)Useesxcli network vswitch standard portgroup setorvicfg-vswitchtoestablish [Link] vicfgvswitchonpage 116. Useesxcli network ip interfaceorvicfg-vmknictoconfiguretheVMkernelnetworkinterfaces. SeeAddingandModifyingVMkernelNetworkInterfacesonpage 119.

2 3 4

Setting Up Virtual Switches and Associating a Switch with a Network Interface


[Link] thevSphereClient(seethevSphereNetworkingdocumentation)orbyusingvSphereCLIcommands. [Link],eachESXihosthasasingle [Link],[Link] [Link] machinesandtheESXiphysicalnetworkadapters.

YoucanconnectonevirtualmachinenetworkadaptertoeachportbyusingthevSphereClientUI. Youcanconnecttheuplinkadaptertothevirtualswitchesbyusingvicfg-vswitchoresxcli network vswitch standard [Link] page 119.

Whentwoormorevirtualmachinesareconnectedtothesamevirtualswitch,networktrafficbetweenthemis [Link],eachvirtualmachinecanaccessthe externalnetworkthattheadapterisconnectedto. [Link] DistributedSwitchesonpage 111forinformationaboutdistributedswitchenvironments. Whenworkingwithvirtualswitchesandportgroups,performthefollowingtasks: 1 Findoutwhichvirtualswitchesareavailableand(optionally)whattheassociatedMTUandCDP(Cisco DiscoveryProtocol)[Link] page 113andRetrievingInformationaboutVirtualSwitcheswithvicfgvswitchonpage 113. [Link] 113andAdding andDeletingVirtualSwitcheswithvicfgvswitchonpage 114. Foranewlyaddedswitch,performthesetasks: a b c d [Link] 115andManagingPort Groupswithvicfgvswitchonpage 115. (Optional)[Link] page 116andSettingthePortGroupVLANIDwithvicfgvswitchonpage 116. [Link] 119and LinkingandUnlinkingUplinkAdapterswithvicfgvswitchonpage 119. (Optional)[Link] vswitchstandardonpage 114andSettingSwitchAttributeswithvicfgvswitchonpage 114.
VMware, Inc.

2 3

112

Chapter 9 Managing vSphere Networking

Retrieving Information About Virtual Switches


[Link] optionslistedinConnectionOptionsonpage 17inplaceof<conn_options>.

Retrieving Information about Virtual Switches with ESXCLI


Youcanretrieveinformationaboutvirtualswitchesbyusingesxcli network vswitchcommands.

Listallvirtualswitchesandassociatedportgroups.
esxcli <conn_options> network vswitch standard list

Thecommandprintsinformationaboutthevirtualswitch,whichmightincludeitsname,numberof ports,MTU,portgroups,[Link] [Link] Management NetworkandVM Network.

Listthenetworkpolicysettings(securitypolicy,trafficshapingpolicy,andfailoverpolicy)forthevirtual [Link].
esxcli <conn_options> network vswitch standard policy failover get esxcli <conn_options> network vswitch standard policy security get esxcli <conn_options> network vswitch standard policy shaping get

Retrieving Information about Virtual Switches with vicfg-vswitch


[Link] theoptionslistedinConnectionOptionsonpage 17inplaceof<conn_options>.

CheckwhethervSwitch1exists.
vicfg-vswitch <conn_options> -c vSwitch1

Listallvirtualswitchesandassociatedportgroups.
vicfg-vswitch <conn_options> -l

Thecommandprintsinformationaboutthevirtualswitch,whichmightincludeitsname,numberof ports,MTU,portgroups,[Link] Networkand VM Network.

RetrievethecurrentCDP(CiscoDiscoveryProtocol)settingforthisvirtualswitch. IfCDPisenabledonavirtualswitch,ESXiadministratorscanfindoutwhichCiscoswitchportis [Link] [Link] [Link] someportinformation.


vicfg-vswitch <conn_options> --get-cdp vSwitch1

Adding and Deleting Virtual Switches


YoucanaddanddeletevirtualswitcheswithESXCLIandwithvicfg-vswitch.

Adding and Deleting Virtual Switches with ESXCLI


Youcanaddanddeletevirtualswitchesusingtheesxcli network vswitchstandard [Link] oneoftheoptionslistedinConnectionOptionsonpage 17inplaceof<conn_options>.

Addavirtualswitch.
esxcli <conn_options> network vswitch standard add --vswitch-name=vSwitch42

[Link], thedefaultvalueisused.Thesystemwideportcountcannotbegreaterthan4096.
esxcli <conn_options> network vswitch standard add --vswitch-name=vSwitch42 --ports=8
VMware, Inc. 113

vSphere Command-Line Interface Concepts and Examples

Afteryouhaveaddedavirtualswitch,youcansetswitchattributes(SettingSwitchAttributeswithesxcli networkvswitchstandardonpage 114)andaddoneormoreuplinkadapters(LinkingandUnlinking UplinkAdapterswithESXCLIonpage 119).

Deleteavirtualswitch.
esxcli <conn_options> network vswitch standard remove --vswitch-name=vSwitch42

YoucannotdeleteavirtualswitchifanyportsontheswitcharestillinusebyVMkernelnetworksor [Link] network vswitch standard list todeterminewhetheravirtualswitch isinuse.

Adding and Deleting Virtual Switches with vicfg-vswitch


Youcanaddanddeletevirtualswitchesusingthe--add|-aand--delete|-[Link] optionslistedinConnectionOptionsonpage 17inplaceof<conn_options>.

Addavirtualswitch.
vicfg-vswitch <conn_options> --add vSwitch2

Afteryouhaveaddedavirtualswitch,youcansetswitchattributes(SettingSwitchAttributeswith vicfgvswitchonpage 114)andaddoneormoreuplinkadapters(LinkingandUnlinkingUplink Adapterswithvicfgvswitchonpage 119).

Deleteavirtualswitch.
vicfg-vswitch <conn_options> --delete vSwitch1

YoucannotdeleteavirtualswitchifanyportsontheswitcharestillinusebyVMkernelnetworks,virtual machines,[Link]-vswitch --listtodeterminewhetheravirtualswitchisinuse.

Setting Switch Attributes with esxcli network vswitch standard


Youcansetthemaximumtransmissionunit(MTU)[Link] [Link] Optionsonpage 17inplaceof<conn_options>.

SettheMTUforavSwitch.
esxcli <conn_options> network vswitch standard set --mtu=9000 --vswitch-name=vSwitch1

TheMTUisthesize,inbytes,[Link] option,itaffectsalluplinksassignedtothevirtualswitch.

[Link],listen,advertise,orboth.
esxcli <conn_options> network vswitch standard set --cdp-status=listen --vswitch-name=vSwitch1

Setting Switch Attributes with vicfg-vswitch


Youcansetthemaximumtransmissionunit(MTU)[Link] [Link] Optionsonpage 17inplaceof<conn_options>.

SettheMTUforavSwitch.
vicfg-vswitch <conn_options> -m 9000 vSwitch1

TheMTUisthesize(inbytes)[Link] option,itaffectsalluplinksassignedtothevirtualswitch.

[Link],listen,advertise,orboth.
vicfg-vswitch <conn_options> --set-cdp listen

114

VMware, Inc.

Chapter 9 Managing vSphere Networking

Checking, Adding, and Removing Port Groups


Youcancheck,add,andremoveportgroupswithESXCLIandwithvicfg-vswitch.

Managing Port Groups with ESXCLI


[Link] specifyconfigurationoptionssuchasbandwidthlimitationsandVLANtaggingpoliciesforeachportinthe [Link]. Youcanuseesxcli network vswitch standard portgroup tocheck,add,andremoveportgroups. SpecifyoneoftheoptionslistedinConnectionOptionsonpage 17inplaceof<conn_options>.

Listportgroupscurrentlyassociatedwithavirtualswitch.
esxcli <conn_options> network vswitch standard portgroup list

Liststheportgroupname,associatedvirtualswitch,activeclients,andVLANID.

Addaportgroup.
esxcli <conn_options> network vswitch standard portgroup add --portgroup-name=<name> --vswitch-name=vSwitch1

Deleteoneoftheexistingportgroups.
esxcli <conn_options> network vswitch standard portgroup remove --portgroup-name=<name> --vswitch-name=vSwitch1

Managing Port Groups with vicfg-vswitch


[Link] andspecifyconfigurationoptionssuchasbandwidthlimitationsandVLANtaggingpoliciesforeachportin [Link] [Link] 17inplaceof<conn_options>. Youcanusevicfg-vswitchtocheck,add,andremoveportgroups.

Checkwhetherportgroupsarecurrentlyassociatedwithavirtualswitch.
vicfg-vswitch <conn_options> --check-pg <port_group> vSwitch1

Thecommandreturns0ifthespecifiedportgroupisassociatedwiththevirtualswitch,andreturns1 [Link]-vswitch --listtolistallportgroups.

Addaportgroup.
vicfg-vswitch <conn_options> --add-pg <port_group_name> vSwitch1

Deleteoneoftheexistingportgroups.
vicfg-vswitch <conn_options> --del-pg <port_group_name> vSwitch1

Managing Uplinks and Port Groups


YoucanmanageuplinksandportgroupswithESXCLIandwithvicfg-vswitch.

Connecting and Disconnecting Uplink Adapters and Port Groups with ESXCLI
Ifyoursetupincludesoneormoreportgroups,youcanassociateeachportgroupwithoneormoreuplink adapters(andremovetheassociation).Thisfunctionalityallowsyoutofiltertrafficfromaportgrouptoa specificuplink,[Link] inConnectionOptionsonpage 17inplaceof<conn_options>.

Connectaportgroupwithanuplinkadapter.
esxcli <conn_options> network vswitch standard portgroup policy failover set --active-uplinks=vmnic1,vmnic6,vmnic7

Thiscommandfailssilentlyiftheuplinkadapterdoesnotexist.
VMware, Inc. 115

vSphere Command-Line Interface Concepts and Examples

Makesomeoftheadaptersstandbyinsteadofactive.
esxcli <conn_options> network vswitch standard portgroup policy failover set --standby-uplinks=vmnic1,vmnic6,vmnic7

Connecting and Disconnecting Uplinks and Port Groups with vicfg-vswitch


Ifyoursetupincludesoneormoreportgroups,youcanassociateeachportgroupwithoneormoreuplink adapters(andremovetheassociation).Thisfunctionalityallowsyoutofiltertrafficfromaportgrouptoa specificuplink,[Link] inConnectionOptionsonpage 17inplaceof<conn_options>.

Connectaportgroupwithanuplinkadapter.
vicfg-vswitch <conn_options> --add-pg-uplink <adapter_name> --pg <port_group> <vswitch_name>

Thiscommandfailssilentlyiftheuplinkadapterdoesnotexist.

Removeaportgroupfromanuplinkadapter.
vicfg-vswitch <conn_options> --del-pg-uplink <adapter_name> --pg <port_group> <vswitch_name>

Setting the Port Group VLAN ID


YoucansettheportgroupVLANIDwithESXCLIandwithvicfg-vswitch.

Setting the Port Group VLAN ID with ESXCLI


VLANsallowyoutofurthersegmentasinglephysicalLANsegmentsothatgroupsofportsareisolatedasif theywereonphysicallydifferentsegments.ThestandardisIEEE802.1Q. AVLANIDrestrictsportgrouptraffictoalogicalEthernetsegmentwithinthephysicalnetwork.

SettheVLANIDto4095toallowaportgrouptoreachportgroupslocatedonotherVLAN. SettheVLANIDto0todisabletheVLANforthisportgroup.

IfyouuseVLANIDs,youmustchangetheportgrouplabelsandVLANIDstogethersothatthelabels [Link]. YoucanusethefollowingcommandsforVLANmanagement:

AllowportgroupstoreachportgroupslocatedonotherVLANs.
esxcli <conn_options> network vswitch standard portgroup set -p <pg_name> --vlan-id 4095

CallthecommandmultipletimestoallowallportstoreachportgroupslocatedonotherVLANs.

DisableVLANforportgroupg42
esxcli <conn_options> network vswitch standard portgroup set --vlan-id 0 -p <pg_name>

Setting the Port Group VLAN ID with vicfg-vswitch


VLANsallowyoutofurthersegmentasinglephysicalLANsegmentsothatgroupsofportsareisolatedasif theywereonphysicallydifferentsegments.ThestandardisIEEE802.1Q. AVLANIDrestrictsportgrouptraffictoalogicalEthernetsegmentwithinthephysicalnetwork.

SettheVLANIDto4095toallowaportgrouptoreachportgroupslocatedonotherVLAN. SettheVLANIDto0todisabletheVLANforthisportgroup.

IfyouuseVLANIDs,youmustchangetheportgrouplabelsandVLANIDstogethersothatthelabels [Link]. YoucanusethefollowingcommandsforVLANmanagement:

AllowallportgroupstoreachportgroupslocatedonotherVLANs.
vicfg-vswitch <conn_options> --vlan 4095 --pg ALL vSwitch2

116

VMware, Inc.

Chapter 9 Managing vSphere Networking

DisableVLANforportgroupg42.
vicfg-vswitch <conn_options> --vlan 0 --pg g42 vSwitch2

Runvicfg-vswitch -ltoretrieveinformationaboutVLANIDscurrentlyassociatedwiththevirtual switchesinthenetwork. Runesxcli network vswitch standard portgroup listtolistallportgroupsandassociatedVLANIDs.

Managing Uplink Adapters


Youcanmanageuplinkadapters,whichrepresentthephysicalNICsthatconnecttheESXihosttothenetwork byusingtheesxcli network [Link] network vswitchandesxcfg-vswitchtolinkandunlinktheuplink. Youcanusevicfg-nicstolistinformationandtospecifyspeedandduplexsettingfortheuplink. Youcanuseesxcli network nic tolistalluplinks,tolistinformation,tosetattributes,andtobringa specifieduplinkdownorup.

Managing Uplink Adapters with esxcli network nic


Thefollowingexampleworkflowlistsalluplinkadapters,listspropertiesforoneuplinkadapter,changesthe uplinksspeedandduplexsettings,[Link] inConnectionOptionsonpage 17inplaceof<conn_options>. To manipulate uplink adapter setup 1 Listalluplinksandinformationabouteachdevice.
esxcli <conn_options> network nic list

Youcannarrowdowntheinformationdisplayedbyusingesxcli network nic get --nic-name=<nic>. 2 (Optional)Bringdownoneoftheuplinkadapters.


esxcli <conn_options> network nic down --nic-name=vmnic0

Changeuplinkadaptersettings.
esxcli <conn_options> network nic set <option>

Specifyoneofthefollowingoptions.
-a|--auto -D|--duplex=<str> -P | --phy-address -l|--message-level=<long>

Setthespeedandduplexsettingstoautonegotiate. [Link]. SettheMACaddressofthedevice [Link] driver. [Link] list command(required). [Link].


-n|--nic-name=<str>

-p|--port=<str>

auiSelectauiasthedeviceport bncSelectbncasthedeviceport fibreSelectmiiasthedeviceport miiSelectmiiasthedeviceport tpSelecttpasthedeviceport

-S|--speed=<long>

SpeedtosetthisNICto.Acceptablevaluesare10,100,1000,and10000.

VMware, Inc.

117

vSphere Command-Line Interface Concepts and Examples

-t|--transceiver-type=<str>

[Link].

externalSetthetransceivertypetoexternal internalSetthetransceivertypetointernal

-w|--wake-on-lan=<str>

[Link] isastringofcharactersspecifyingwhichoptionstoenable.

pWakeonphyactivity uWakeonunicastmessages mWakeonmulticastmessages bWakeonbroadcastmessages aWakeonARP gWakeonMagicPacket sEnableSecureOnpasswordforMagicPacket

(Optional)Bringtheuplinkadapterbackup.
esxcli <conn_options> network nic up --nic-name=vmnic0

Specifying Multiple Uplinks with ESXCLI


Atanytime,[Link] activeuplinks,youalsochangethestandbyuplinksandthenumberofactiveuplinks. Thefollowingexampleillustrateshowactiveandstandbyuplinksareset. 1 2 3 Theportgroupnicarrayis[vmnic1,vmnic0,vmnic3,vmnic5,vmnic6,vmnic7]andactive-uplinksis settothreeuplinks(vmnic1,vmnic0,vmnic3).Theotheruplinksarestandbyuplinks. Yousettheactiveuplinkstoanewset[vmnic3,vmnic5]. [Link][vmnic3,vmnic5,vmnic6,vmnic7]. vmnic0andvmnic1areremovedfromtheNICarrayandmax-activebecomes2.

Ifyouwanttokeepvmnic0andvmnic1inthearray,youcanmakethoseNICsstandbyuplinksinthe commandthatchangestheactiveuplinks.
esxcli network vswitch standard portgroup policy failover set -p testPortgroup --active-uplinks vmnic3,vmnic5 --standby-uplinks vmnic1,vmnic0,vmnic6,vmnic7

Managing Uplink Adapters with vicfg-nics


Thefollowingexampleworkflowlistsanuplinkadaptersproperties,changestheduplexandspeed,andsets [Link] Optionsonpage 17inplaceof<conn_options>. To manipulate uplink adapter setup 1 Listsettings.
vicfg-nics <conn_options> -l

Liststheuplinksinthesystem,theircurrentandconfiguredspeed,andtheirduplexsetting. 2 Setthesettingsforvmnic0tofullandthespeedto100.
vicfg-nics <conn_options> -d full -s 100 vmnic0

Setvmnic2toautonegotiateitsspeedandduplexsettings.
vicfg-nics <conn_options> -a vmnic2

118

VMware, Inc.

Chapter 9 Managing vSphere Networking

Linking and Unlinking Uplink Adapters with ESXCLI


Whenyoucreateavirtualswitchusingesxcli network vswitch standard add,alltrafficonthatvirtual [Link] toeachother,butthevirtualmachinescannotconnecttothenetworkortovirtualmachinesonotherhosts.A virtualmachinealsocannotconnecttovirtualmachinesconnectedtoadifferentvirtualswitchonthesame host. Havingavirtualswitchthatisnotconnectedtothenetworkmightmakesenseifyouwantagroupofvirtual machinestobeabletocommunicatewitheachother,butnotwithotherhostsorwithvirtualmachineson [Link],yousetupthevirtualswitchtotransferdatatoexternalnetworksbyattachingone ormoreuplinkadapterstothevirtualswitch. Youcanusethefollowingcommandstolist,add,andremoveuplinkadapters:

Listuplinkadapters.
esxcli <conn_options> network vswitch standard list

TheuplinkadaptersarereturnedintheUplinkitem.

Addanewuplinkadaptertoavirtualswitch.
esxcli <conn_options> network vswitch standard uplink add --uplink-name=vmnic15 vswitch-name=vSwitch0

Removeanuplinkadapterfromavirtualswitch.
esxcli <conn_options> network vswitch standard uplink remove --uplink-name=vmnic15 vswitch-name=vSwitch0

Linking and Unlinking Uplink Adapters with vicfg-vswitch


Whenyoucreateavirtualswitchusingvicfg-vswitch--add,alltrafficonthatvirtualswitchisinitially [Link],but [Link] alsocannotconnecttovirtualmachinesconnectedtoadifferentvirtualswitchonthesamehost. Havingavirtualswitchthatisnotconnectedtothenetworkmightmakesenseifyouwantagroupofvirtual machinestobeabletocommunicatewitheachother,butnotwithotherhostsorwithvirtualmachineson [Link],yousetupthevirtualswitchtotransferdatatoexternalnetworksbyattachingone ormoreuplinkadapterstothevirtualswitch. Youcanusethefollowingcommandstoaddandremoveuplinkadapters:

Addanewuplinkadaptertoavirtualswitch.
vicfg-vswitch <conn_options> --link vmnic15 vSwitch0

Removeanuplinkadapterfromavirtualswitch.
vicfg-vswitch <conn_options> --unlink vmnic15 vSwitch0

Adding and Modifying VMkernel Network Interfaces


VMkernelnetworkinterfacesareusedprimarilyformanagementtraffic,whichcanincludevMotion,IP Storage,[Link] networkinterfaceforusebysoftwareanddependenthardwareiSCSIbyusingtheesxcli iscsicommands. [Link] andapplicationprogramscommunicatewithaVMkernelnetworkinterfacethroughacommonlyavailable [Link],communication [Link] communicatewithaVMkernelnetworkinterfaceifbothusethesamevirtualswitch. EachVMkernelnetworkinterfacehasitsownMACaddressandoneormoreIPaddresses,andrespondsto [Link] SegmentationOffload(TSO)enabled.
VMware, Inc. 119

vSphere Command-Line Interface Concepts and Examples

YoucanmanageVMkernelNICswithESXCLI(seeManagingVMkernelNetworkInterfaceswithESXCLI onpage 120)andwithvicfg-vmknic(seeManagingVMkernelNetworkInterfaceswithvicfgvmknicon page 121).

Managing VMkernel Network Interfaces with ESXCLI


YoucanconfiguretheVMkernelnetworkinterfaceforIPv4(seeToaddandconfigureanIPv4VMkernel NetworkInterfaceforIPv4onpage 120)orforIPv6(seeToaddandconfigureaVMkernelNetwork InterfaceforIPv6onpage 120)[Link]-vmknic,ESXCLIdoesnotsupport enablingvMotion. [Link] ConnectionOptionsonpage 17inplaceof<conn_options>. To add and configure an IPv4 VMkernel Network Interface for IPv4 1 AddanewVMkernelnetworkinterface.
esxcli <conn_options> network ip interface add --interface-name=vmk<x> --portgroup-name=<my_portgroup>

YoucanspecifytheMTUsettingafteryouhaveaddedthenetworkinterfacebyusingesxcli network ip interface set --mtu. 2 [Link]--ip,thenetmask,and [Link],assumethatVMSFVMK363isaportgrouptowhichyouwantto addaVMkernelnetworkinterface.


esxcli <conn_options> network ip interface ipv4 set --ip=<ip_address> --netmask=[Link] --interface-name=vmk<X>

Youcansettheaddressasfollows.

<X.X.X.X>StaticIPv4address. DHCPUseIPv4DHCP.

TheVMkernelsupportsDHCPonlyforESXi4.0andlater. Whenthecommandfinishessuccessfully,thenewlyaddedVMkernelnetworkinterfaceisenabled. 3 ListinformationaboutallVMkernelnetworkinterfacesonthesystem.


esxcli <conn_options> network ip interface list

Thecommanddisplaysthenetworkinformation,portgroup,MTU,andcurrentstateforeachvirtual networkadapterinthesystem. YoucanaddandconfigureanIPv6VMkernelNICwithESXCLI. To add and configure a VMkernel Network Interface for IPv6 1 Runesxcli network ip interface addtoaddanewVMkernelnetworkinterface.
esxcli <conn_options> network ip interface add --interface-name=vmk<x> --portgroup-name=<my_portgroup>

YoucanspecifytheMTUsettingafteryouhaveaddedthenetworkinterfacebyusingesxcli network ip interface set --mtu. Whenthecommandfinishessuccessfully,thenewlyaddedVMkernelnetworkinterfaceisenabled. 2 Runesxcli network ip interface ipv6 address add toconfiguretheinterfaceasanIPv6interface. [Link],assumethat VMSFVMK363isaportgrouptowhichyouwanttoaddaVMkernelnetworkinterface.
esxcli <conn_options> network ip interface ipv6 address add --ip=<X:X:X::/X> --interface-name=vmk<X>

120

VMware, Inc.

Chapter 9 Managing vSphere Networking

Youcansettheaddressasfollows.

<X:X:X::/X>:StaticIPv6address --enable-dhcpv6:EnablesDHCPv6onthisinterfaceandattemptstoacquireanIPv6addressfrom thenetwork. --enable-router-adv:[Link] theroutersendsthenextrouteradvert.

TheVMkernelsupportsDHCPonlyforESXi4.0andlater. Whenthecommandcompletessuccessfully,thenewlyaddedVMkernelnetworkinterfaceisenabled. 3 ListinformationaboutallVMkernelnetworkinterfacesonthesystem.


esxcli <conn_options> network ip interface list

Thelistcontainsthenetworkinformation,portgroup,MTU,andcurrentstateforeachVMkernel NetworkInterfaceonthesystem. 4 YoucanlaterremovetheIPv6addressanddisableIPv6.


esxcli <conn_options> network ip interface ipv6 address remove --interface-name=<VMK_NIC> --ipv6=<ipv6_addr> esxcli <conn_options> network ip set --ipv6-enabled=false

Managing VMkernel Network Interfaces with vicfg-vmknic


YoucanconfiguretheVMkernelnetworkinterfaceforIPv4(seeToaddandconfigureanIPv4VMkernel NetworkInterfacewithvicfgvmkniconpage 121)orforIPv6(seeToaddandconfigureanIPv6VMkernel NetworkInterfacewithvicfgvmkniconpage 122).SpecifyoneoftheoptionslistedinConnectionOptions onpage 17inplaceof<conn_options>. To add and configure an IPv4 VMkernel Network Interface with vicfg-vmknic 1 Runvicfg-vmknic --addtoaddaVMkernelnetworkinterface. YoumustspecifytheIPaddressbyusing--ip,thenetmask,[Link], assumethatVMSFVMK363isaportgrouptowhichyouwanttoaddaVMkernelnetworkinterface.
vicfg-vmknic <conn_options> --add --ip <ip_address> -n [Link] VMSF-VMK-363

[Link] settingatalatertime. Whenthecommandcompletessuccessfully,thenewlyaddedVMkernelnetworkinterfaceisenabled. 2 ChangetheIPaddressasneeded.


vicfg-vmknic <conn_options> --ip <address> VMSF-VMK-363

ForIPv4,chooseoneofthefollowingformats:

<X.X.X.X>StaticIPv4address. DHCPUseIPv4DHCP.

TheVMkernelsupportsDHCPonlyforESXi4.0andlater. 3 (Optional)EnablevMotion. Bydefault,vMotionisdisabled.


vicfg-vmknic <conn_options> --enable-vmotion VMSF-VMK-363

Youcanlateruse--disable-vmotiontodisablevMotionforthisVMkernelnetworkinterface. 4 ListinformationaboutallVMkernelnetworkinterfacesonthesystem.
vicfg-vmknic <conn_options> --list

Thecommanddisplaysthenetworkinformation,portgroup,MTU,andcurrentstateforeachvirtual networkadapterinthesystem.
VMware, Inc. 121

vSphere Command-Line Interface Concepts and Examples

To add and configure an IPv6 VMkernel Network Interface with vicfg-vmknic 1 Runvicfg-vmknic --addtoaddaVMkernelnetworkinterface. YoumustspecifytheIPaddressbyusing--ip,thenetmask,[Link] examples,assumethatVMSFVMK363isaportgrouptowhichyouwanttoaddaVMkernelnetwork interface. [Link] settingatalatertime. Whenthecommandcompletessuccessfully,thenewlyaddedVMkernelnetworkinterfaceisenabled. 2 EnableIPv6.
vicfg-vmknic <conn_options> --enable-ipv6 true VMSF-VMK-363

SupplyanIPv6address.
vicfg-vmknic <conn_options> --ip <ip_address> VMSF-VMK-363

ForIPv6,theIPaddresscanhaveoneofthefollowingformats:

<X:X:X::/X>StaticIPv6address [Link]/ESXi4.0andlater. [Link] withAUTOCONF,[Link] vmknic,theaddressisaddedwhentheroutersendsthenextrouteradvert.

(Optional)EnablevMotion. Bydefault,vMotionisdisabled.
vicfg-vmknic <conn_options> --enable-vmotion VMSF-VMK-363

Youcanlateruse--disable-vmotiontodisablevMotionagain. 5 ListinformationaboutallVMkernelnetworkinterfacesonthesystem.
vicfg-vmknic <conn_options> --list

Thelistcontainsthenetworkinformation,portgroup,MTU,andcurrentstateforeachvirtualnetwork adapterinthesystem. 6 YoucanlaterremovetheIPv6addressanddisableIPv6.


vicfg-vmknic <conn_options> --unset-ip <X:X:X::/X> VMSF-VMK-363 vicfg-vmknic <conn_options> --enable-ipv6 false VMSF-VMK-363

Setting Up vSphere Networking with vSphere Distributed Switch


[Link] [Link] NetworkingUsingvSphereDistributedSwitchesonpage 111. LikeavSpherestandardswitch,eachdistributedswitchisanetworkhubthatvirtualmachinescanuse.A distributedswitchcanforwardtrafficinternallybetweenvirtualmachinesorlinktoanexternalnetworkby connectingtouplinkadapters. [Link] groupmultipleportsunderacommonconfigurationandprovideastableanchorpointforvirtualmachines [Link],whichis [Link],whichrestrictsportgrouptraffictoalogicalEthernetsegment withinthephysicalnetwork,isoptional.

122

VMware, Inc.

Chapter 9 Managing vSphere Networking

[Link], youcanaddhostsbyusingthevSphereClient,createdistributedportgroups,andeditdistributedswitch [Link] vicfg-vswitch. IMPORTANTInvSphere5.0,youcannotcreatedistributedvirtualswitcheswithESXCLI. SeethevSphereNetworkingdocumentationandthewhitepaperavailablethroughtheResourceslinkat [Link] themusingthevSphereClient. Youcanaddandremovedistributedswitchuplinkportswithvicfg-vswitch. IMPORTANTYoucannotaddandremoveuplinkportswithESXCLI. Afterthedistributedswitchhasbeensetup,youcanusevicfg-vswitchtoaddorremoveuplinkports. SpecifyoneoftheoptionslistedinConnectionOptionsonpage 17inplaceof<conn_options>.

Addanuplinkport.
vicfg-vswitch <conn_options> --add-dvp-uplink <adapter_name> --dvp <DVPort_id> <dvswitch_name>

Removeanuplinkport.
vicfg-vswitch <conn_options> --del-dvp-uplink <adapter> --dvp <DVPort_id> <dvswitch_name>

Managing Standard Networking Services in the vSphere Environment


YoucanusevCLIcommandstosetupDNS,NTP,SNMP,andthedefaultgatewayforyourvSphere environment.

Setting the DNS Configuration


YoucansettheDNSconfigurationwithESXCLIorwithvicfg-dns.

Setting the DNS Configuration with ESXCLI


Theesxcli network ip dnscommandlistsandspecifiestheDNSconfigurationofyourESXihost. IMPORTANTIfyoutrytochangethehostordomainnameortheDNSserveronhoststhatuseDHCP,anerror results. InnetworkenvironmentswhereaDHCPserverandaDNSserverareavailable,ESXihostsareautomatically assignedDNSnames. InnetworkenvironmentswhereautomaticDNSisnotavailableoryoudonotwanttouseautomaticDNS,you canconfigurestaticDNSinformation,includingahostname,primarynameserver,secondarynameserver, andDNSsuffixes. Theesxcli network ip dnsnamespaceincludestwonamespaces.

esxcli network ip dns searchincludescommandsforDNSsearchdomainconfiguration. esxcli network ip dns serverincludescommandsforDNSserverconfiguration.

[Link] Optionsonpage 17inplaceof<conn_options>.

VMware, Inc.

123

vSphere Command-Line Interface Concepts and Examples

To set up a DNS Server 1 PrintalistofDNSserversconfiguredonthesystemintheorderinwhichtheywillbeused.


esxcli <conn_options> network ip dns server list

IfDNSisnotsetupforthetargetserver,thecommandreturnsanemptystring. 2 Addaserverbyrunningesxcli network ip dns server addandspecifyingtheserverIPv4address orIPv6address.


esxcli <conn_options> network ip dns server add --server=<str>

Changethesettingswithesxcli network ip dns.

SpecifytheDNSserverusingthe--dnsoptionandtheDNShost.
esxcli <conn_options> network ip dns server add --server=<server>

RunthecommandmultipletimestospecifymultipleDNShosts.

ConfiguretheDNShostnamefortheserverspecifiedby--server(or--vihost).
esxcli <conn_options> system hostname set --host=<new_host_name>

ConfiguretheDNSdomainnamefortheserverspecifiedby--server(or--vihost).
esxcli <conn_options> system hostname --domain=[Link]

ToturnonDHCP,enableDHCPandsettheVMkernelNIC.

TurnonDHCPforIPv4

esxcli <conn_options> network ip interface ipv4 set --type dhcp/none/static esxcli <conn_options> network ip interface ipv4 set --peer-dns=<str>

TurnonDHCPforIPv6

esxcli <conn_options> network ip interface ipv6 set --enable-dhcpv6=true/false esxcli <conn_options> network ip interface ipv6 set --peer-dns=<str>

To modify DNS setup for a preconfigured server 1 DisplayDNSpropertiesforthespecifiedserverasfollows:

Listthehostanddomainname.
esxcli <conn_options> system hostname get

ListavailableDNSservers
esxcli <conn_options> network ip dns server list

ListtheDHCPsettingsforindividualVMkernelNICs.
esxcli <conn_options> network ip interface ipv4 get esxcli <conn_options> network ip interface ipv6 get

IftheDNSpropertiesareset,andyouwanttochangetheDHCPsettings,youmustspecifythevirtual [Link]:
esxcli <conn_options> network ip interface ipv4 set --type dhcp/none/static esxcli <conn_options> network ip interface ipv6 set --enable-dhcpv6=true/false

Setting the DNS Configuration with vicfg-dns


[Link] [Link] network ip dnsforDNSmanagement. IMPORTANTIfyoutrytochangethehostordomainnameortheDNSserveronhoststhatuseDHCP,anerror results.

124

VMware, Inc.

Chapter 9 Managing vSphere Networking

InnetworkenvironmentswhereaDHCPserverandaDNSserverareavailable,ESXihostsareautomatically assignedDNSnames. InnetworkenvironmentswhereautomaticDNSisnotavailableornotdesirable,youcanconfigurestaticDNS information,includingahostname,primarynameserver,secondarynameserver,andDNSsuffixes. [Link] Optionsonpage 17inplaceof<conn_options>. To set up DNS 1 Runvicfg-dnswithoutcommandspecificoptionstodisplayDNSpropertiesforthespecifiedserver.
vicfg-dns <conn_options>

IfDNSisnotsetupforthetargetserver,thecommandreturnsanerror. 2 Tochangethesettings,usevicfg-dnswith--dns,--domain,or--hostname.

SpecifytheDNSserverbyusingthe--dnsoptionandacommaseparatedlistofhosts,inorderof preference.
vicfg-dns <conn_options --dns <dns1,dns2>

ConfiguretheDNShostnamefortheserverspecifiedby--server(or--vihost).
vicfg-dns <conn_options> -n dns_host_name

ConfiguretheDNSdomainnamefortheserverspecifiedby--server(or--vihost).
vicfg-dns <conn_options> -d [Link]

ToturnonDHCP,usethe--DHCPoption.
vicfg-dns <conn_options> --dhcp yes

To modify DNS setup for a preconfigured server 1 Runvicfg-dnswithoutcommandspecificoptionstodisplayDNSpropertiesforthespecifiedserver.


vicfg-dns <conn_options>

Theinformationincludesthehostname,domainname,DHCPsetting(trueorfalse),andDNSserverson theESXihost. 2 IftheDNSpropertiesareset,andyouwanttochangetheDHCPsettings,youmustspecifythevirtual networkadaptertousewhenoverridingthesystemDNS.v_nicmustbeoneoftheVMkernelnetwork adapters. OverridetheexistingDHCPsettingasfollows:


vicfg-dns <conn_options> --dhcp yes --v_nic <vnic>

Adding and Starting an NTP Server


Someprotocols,suchasKerberos,[Link],you canaddanNTP(NetworkTimeProtocol)servertoyourESXihost. IMPORTANTNoESXCLIcommandexistsforaddingandstartinganNTPserver. [Link] Optionsonpage 17inplaceof<conn_options>. To manage an NTP Server 1 Runvicfg-ntp--add toaddanNTPservertothehostspecifiedin<conn_options>anduseahostname orIPaddresstospecifyanalreadyrunningNTPserver.
vicfg-ntp <conn_options> -a [Link]

VMware, Inc.

125

vSphere Command-Line Interface Concepts and Examples

Runvicfg-ntp --starttostarttheservice.
vicfg-ntp <conn_options> --start

Runvicfg-ntp --listtolisttheservice.
vicfg-ntp <conn_options> --list

Runvicfg-ntp --stoptostoptheservice.
vicfg-ntp <conn_options> --stop

Runvicfg-ntp --deletetoremovethespecifiedNTPserverfromthehostspecifiedin<conn_options>.
vicfg-ntp <conn_options> --delete [Link]

Managing the IP Gateway


IfyoumoveyourESXihosttoanewphysicallocation,[Link] [Link]-route supportsasubsetoftheLinuxroutecommandsoptions. IMPORTANTNoESXCLIcommandexiststomanagethedefaultgateway. Ifyourunvicfg-routewithnooptions,[Link]--familytoprint [Link],thecommanddisplaysthedefaultIPv4gateway. SpecifyoneoftheoptionslistedinConnectionOptionsonpage 17inplaceof<conn_options>. To add, view, and delete a route entry 1 AddarouteentrytotheVMkernelandmakeitthedefault.

ForIPv4networks,noadditionaloptionsarerequired.
vicfg-route <conn_options> --add <network_ip> <netmask_IP> <gateway_ip>

Forexample,[Link].0.1:
vicfg-route <conn_options> -a [Link].100.0/24 [Link].0.1

or
vicfg-route <conn_options> -a [Link].100.0 [Link] [Link].0.1

ForIPv6networks,use--family v6
vicfg-route <conn_options> -f V6 --add <network_ip_and_mask> <gateway_ip>

Forexample:
vicfg-route <conn_options> -f V6 --add [Link]/64 [Link]

Listrouteentriestocheckthatyourroutewasaddedbyrunningthecommandwithoutoptions.
vicfg-route <conn_options>

Theoutputlistsallnetworksandcorrespondingnetmasksandgateways. 3 Setthedefaultgateway.

ForIPv4,usethissyntax:
vicfg-route <conn_options> [Link].0.1 or vicfg-route <conn_options> -a default [Link].0.1

ForIPv6,usethissyntax:
vicfg-route <conn_options> -f V6 -a default [Link]

Runvicfg-route --[Link],andthenthenetwork.
vicfg-route <conn_options> -d [Link].100.0/24 [Link].0.1

126

VMware, Inc.

Chapter 9 Managing vSphere Networking

Using vicfg-ipsec for Secure Networking


Youcanusevicfg-ipsectosetupInternetProtocolSecurity(IPsec),whichsecuresIPcommunications [Link] understandingofbothIPv6and IPsec. IMPORTANTNoESXCLIcommandexiststomanageIPsec. ESXihostssupportIPseconlyforIPv6traffic,butnotforIPv4traffic. IMPORTANTInESX/ESXi4.1,IPv6isbydefaultdisabled.YoucanturnonIPv6byrunningthisvCLI command:
vicfg-vmknic <conn_options> --enable-ipv6

Youcannotrunvicfg-ipsecwithavCenterServersystemasthetarget(usingthe--vihostoption). TheVMwareimplementationofIPsecadherestothefollowingIPv6RFCs:

4301SecurityArchitecturefortheInternetProtocol 4303IPEncapsulatingSecurityPayload(ESP) 4835CryptographicAlgorithmImplementationRequirementsforESP 2410TheNULLEncryptionAlgorithmandItsUseWithIPsec 2451TheESPCBCModeCipherAlgorithms 3602TheAESCBCCipherAlgorithmandItsUsewithIPsec 2404TheUseofHMACSHA196withinESPandAH 4868UsingHMACSHA256,HMACSHA384,andHMACSHA512

Using IPsec with ESXi


WhenyousetupIPseconanESXihost,[Link] preciselydependsonhowyousetupthesystemsSecurityAssociations(SAs)andSecurityPolicies (SPs).

[Link],youspecifythesourceand destination,authentication,andencryptionparameters,andanidentifierfortheSAinthefollowing optionstovicfg-ipsec.


sa-srcandsa-dst spi(securityparameterindex) sa-mode(tunnelortransport) ealgoandekey ialgoandikey

[Link],aselector, andanaction. Theselectorisspecifiedbythefollowingoptionstovicfg-ipsec.


src-addrandsrc-port dst-addranddst-port ulproto direction(inorout)

Theactionisspecifiedbythefollowingoptionstovicfg-ipsec.

sa-name sp-name action(none,discard,ipsec)

BecauseIPsecallowsyoutotargetpreciselywhichtrafficshouldbeencrypted,itiswellsuitedforsecuring [Link],youcansetuptheenvironmentsoallvMotiontrafficisencrypted.
VMware, Inc. 127

vSphere Command-Line Interface Concepts and Examples

Managing Security Associations with vicfg-ipsec


[Link] supported.
Option sa-src <source_IP> sa-dst <destination_IP> spi Description SourceIPfortheSA. DestinationIPfortheSA. SecurityParameterIndex(SPI)fortheSA.Mustbeahexadecimalnumberwitha0xprefix. WhenIPsecisinuse,ESXiusestheESPprotocol(RFC43030),whichincludesauthentication [Link]. EachSAyoucreatemusthaveauniquecombinationofsource,destination,protocol,and SPI. sa-mode [tunnel | transport] Eithertunnelortransport. Intunnelmode,theoriginalpacketisencapsulatedinanotherIPv6packet,wheresourceand destinationaddressesaretheSAendpointaddresses. Encryptionalgorithmtobeused.Choose3des-cbcoraes128-cbc,ornullforno encryption. [Link] a0xprefixoranASCIIstring. [Link]-sha1orhmac-sha2-256. [Link].

ealgo [null | 3des-cbc | aes128-cbc] ekey <key> ialgo [hmac-sha1 | hmac-sha2-256 ] ikey

YoucanperformthesemaintaskswithSAs:

CreateanSAwithvicfg-ipsec --[Link],thedestination,andthe [Link] mustspecifyanencryptionalgorithmandkey,butyoucanspecifynullifyouwantnoencryption. [Link] [Link](sa_2intheexample)isthenameoftheSA.


vicfg-ipsec --add-sa --sa-src [Link] --sa-dst [Link] --sa-mode transport --spi 0x1000 --ealgo 3des-cbc --ekey 0x6970763672656164796c6f676f336465736362636f757432 --ialgo hmac-sha1 --ikey 0x6970763672656164796c6f67736861316f757432 sa_2

ListanSAwithvicfg-ipsec --[Link] [Link]-ipsec. RemoveasingleSAwithvicfg-ipsec --[Link], thecommandcannotperformtheremoval. RemoveallSAswithvicfg-ipsec --[Link]. CAUTIONRunningvicfg-ipsec --flush-saremovesallSAsonyoursystemandmightleaveyour systeminaninconsistentstate.

128

VMware, Inc.

Chapter 9 Managing vSphere Networking

Managing Security Policies with vicfg-ipsec


AfteryouhavecreatedoneormoreSAs,youcanaddsecuritypolicies(SPs)[Link] specifiestheauthenticationandencryptionparameterstouse,theSPidentifiesandselectstraffic. ThefollowingoptionsforSPmanagementaresupported.
Option sp-src <ip>/<p_len> sp-dst <ip>/<p_len> src-port <port> dst-port <port> ulproto [any | tcp | udp | icmp6] dir [in | out] action [none | discard | ipsec] Description SourceIPaddressandprefixlength. DestinationIPaddressandprefixlength. Sourceport(065535).Specifyanyforanyports. Destinationport(065535).Specifyanyforanyports.Ifulprotoisicmp6,thisnumberrefers [Link],thisnumberreferstotheport. [Link],oruseanyto applytheSPtoallprotocols. [Link],create twopolicies. Actiontotakewhentrafficwiththespecifiedparametersisencountered. noneTakenoaction,thatis,allowtrafficunmodified. discardDonotallowdatainorout. ipsecUsetheauthenticationandencryptioninformationspecifiedintheSAtodetermine whetherthedatacomefromatrustedsource. sp-mode [tunnel | transport] sa-name Mode,eithertunnelortransport. NameoftheSAtousebythisSP.

YoucanperformthesemaintaskswithSPs:

CreateanSPwithvicfg-ipsec --[Link] sourceanddestinationIPaddressandprefix,sourceportanddestinationport,upperlayerprotocol, directionoftraffic,actiontotake,[Link] [Link].


vicfg-ipsec --add-sp --sp-src=[Link]/48 --sp-dst=[Link]/48 --src-port=23 --dst-port=25 --ulproto=tcp --dir=out --action=ipsec --sp-mode=transport --sp-name sp_2

ListanSPwithvicfg-ipsec --[Link] createdbytheadministrator. RemoveanSPwithvicfg-ipsec --[Link],the [Link]-ipsec --flush-spinsteadtoremovetheSP evenwhenitisinuse. CAUTIONRunningvicfg-ipsec --flush-spremovesallSPsonyoursystemandmightleaveyour systeminaninconsistentstate.

VMware, Inc.

129

vSphere Command-Line Interface Concepts and Examples

Using esxcli network firewall for ESXi Firewall Management


Tominimizetheriskofanattackthroughthemanagementinterface,ESXiincludesafirewallbetweenthe [Link],onlyasmallnumberoffirewall [Link] environmentandwhichportsyoumighthavetotemporarilyenableforcertaintraffic. [Link] [Link] network firewalltomanagefirewallrulesets [Link] 17 inplaceof<conn_options>. To limit shell access 1 CheckfirewallstatusandsshServerrulesetstatus.
esxcli <conn_options> network firewall get Default Action: DROP Enabled: true Loaded: true esxcli <conn_options> network firewall ruleset list --ruleset-id sshServer Name Enabled --------- ------sshServer true

EnablethesshServerrulesetifitisdisabled.
esxcli <conn_options> network firewall ruleset set --ruleset-id sshServer --enabled true

ObtainaccesstotheESXiShellandcheckthestatusoftheallowedAllflag.
esxcli <conn_options> network firewall ruleset allowedip list --ruleset-id sshServer Ruleset Allowed IP Addresses --------- -------------------sshServer All

SeeGettingStartedwithvSphereCommandLineInterfacesforinformationonaccessingtheESXiShell. 4 SetthestatusoftheallowedAllflagtofalse.
esxcli <conn_options> network firewall ruleset set --ruleset-id sshServer --allowed-all false

AddthelistofallowedIPaddresses.
esxcli <conn_options> network firewall ruleset allowedip add --ruleset-id sshServer --ip-address [Link].1.0/24 esxcli <conn_options> network firewall ruleset allowedip add --ruleset-id sshServer --ip-address [Link].10.10

ChecktheallowedIPaddresslist.
esxcli <conn_options> network firewall ruleset allowedip list --ruleset-id sshServer Ruleset Allowed IP Addresses --------- ----------------------------sshServer [Link].10.10, [Link].1.0/24

130

VMware, Inc.

10

Monitoring ESXi Hosts

10

StartingwiththevSphere4.0release,thevCenterServermakesperformancechartsforCPU,memory,diskI/O, networking,[Link] [Link] systemusingvCLIcommands. Thischapterincludesthesetopics:


UsingresxtopforPerformanceMonitoringonpage 131 ManagingDiagnosticPartitionsonpage 131 ManagingCoreDumpsonpage 132 ConfiguringESXiSyslogServicesonpage 134 ManagingESXiSNMPAgentswithvicfgsnmponpage 135 ESX,ESXi,andVirtualMachineLogsonpage 137

Using resxtop for Performance Monitoring


[Link] commandininteractivemode(default)[Link] howtouseresxtopandprovidesinformationaboutavailablecommandsanddisplaystatistics. IfyoucannotreachthehostwiththeresxtopvCLIcommand,youmightbeabletousetheesxtopcommand [Link] theshell. IMPORTANTresxtopandesxtoparesupportedonlyonLinux.

Managing Diagnostic Partitions


Yourhostmusthaveadiagnosticpartition(dumppartition)tostorecoredumpsfordebuggingandforuseby VMwaretechnicalsupport. [Link] [Link] [Link],youcaninstallESXiDumpCollectorand [Link] 133. Thefollowingconsiderationsapply:

AdiagnosticpartitioncannotbelocatedonaniSCSILUNaccessedthroughthesoftwareiSCSIor [Link],see GeneralBootfromiSCSISANRecommendationsinthevSphereStoragedocumentation.

VMware, Inc.

131

vSphere Command-Line Interface Concepts and Examples

[Link] SANLUN,thepartitionshouldbelargeenoughtoaccommodatecoredumpsofallhosts. Ifahostthatusesashareddiagnosticpartitionfails,rebootthehostandextractlogfilesimmediatelyafter [Link],thesecondhostthatfailsbeforeyoucollectthediagnosticdataofthefirsthost mightnotbeabletosavethecoredump.

Diagnostic Partition Creation


YoucanusethevSphereClienttocreatethediagnosticpartitiononalocaldiskoronaprivateorsharedSAN [Link] [Link]. CAUTIONIftwohoststhatshareadiagnosticpartitionfailandsavecoredumpstothesameslot,thecore dumpsmightbelost. Ifahostthatusesashareddiagnosticpartitionfails,rebootthehostandextractlogfilesimmediatelyafterthe failure.

Diagnostic Partition Management


Youcanusethevicfg-dumppartortheesxcli system coredumpcommandtoquery,set,andscananESXi [Link] withthevSphereClientandhowtomanagediagnosticpartitionsonaFibreChannelorhardwareiSCSISAN. Diagnosticpartitionscaninclude,inorderofsuitability,paralleladapter,blockadapter,FC,orhardwareiSCSI [Link]. IMPORTANTWhenyoulistdiagnosticpartitions,[Link],SANLUNs accessedthroughasoftwareiSCSIinitiatorarenotsupportedasdiagnosticpartitions.

Managing Core Dumps


Withesxcli system coredump,youcanmanagelocaldiagnosticpartitionsorsetupcoredumponaremote [Link],seethevSphere Networkingdocumentation.

Managing Local Core Dumps with ESXCLI


[Link] connectionoptionslistedinConnectionOptionsonpage 17inplaceof<conn_options>. To manage a local diagnostic partition 1 ShowthediagnosticpartitiontheVMkernelusesanddisplayinformationaboutallpartitionsthatcanbe usedasdiagnosticpartitions.
esxcli <conn_options> system coredump partition list

Deactivatethecurrentdiagnosticpartition.
esxcli <conn_options> system coredump partition set --unconfigure

TheESXisystemisnowwithoutadiagnosticpartition,andyoumustimmediatelysetanewone. 3 Settheactivepartitiontonaa.<naa_ID>.
esxcli <conn_options> system coredump partition set --partition=naa.<naa_ID>

Listpartitionsagaintoverifythatadiagnosticpartitionisset.
esxcli <conn_options> system coredump partition list

Ifadiagnosticpartitionisset,[Link],thecommand showsthatnopartitionisactivatedandconfigured.

132

VMware, Inc.

Chapter 10 Monitoring ESXi Hosts

Managing Core Dumps with ESXi Dump Collector


Bydefault,[Link] [Link],but [Link],includingsendingcore dumpstothelocaldisk. [Link] DumpCollectoronthesamesystemasthevCenterServerserviceoronadifferentWindowsorLinux [Link]. [Link] optionslistedinConnectionOptionsonpage 17inplaceof<conn_options>. To manage core dumps with ESXi Dump Collector 1 SetupanESXisystemtouseESXiDumpCollectorbyrunningesxcli system coredump.
esxcli <conn_options> system coredump network set --interface-name vmk0 --server-ipv4=[Link] --port=6500

YoumustspecifyaVMkernelportwith--interface-name,andtheIPaddressandportoftheserverto [Link],you mustchooseaVMkernelportthatisinpromiscuousmode. 2 EnableESXiDumpCollector.


esxcli <conn_options> system coredump network set --enable=true

(Optional)CheckthatESXiDumpCollectorisconfiguredcorrectly.
esxcli <conn_options> system coredump network get

ThehostonwhichyouhavesetupESXiDumpCollectorsendscoredumpstothespecifiedserverbyusing thespecifiedVMkernelNICandoptionalport.

Managing Core Dumps with vicfg-dumppart


[Link] inConnectionOptionsonpage 17inplaceof<conn_options>. To manage a diagnostic partition 1 ShowthediagnosticpartitiontheVMkerneluses.
vicfg-dumppart <conn_options> -t

[Link]-ltolistall diagnosticpartitions,-ftolistalldiagnosticpartitionsinorderofpriority.
vicfg-dumppart <conn_options> -f

Theoutputmightappearasfollows.
Partition name on [Link][Link]T0:L0:7 -> [Link][Link]T0:L0:7

Deactivatethediagnosticpartition.
vicfg-dumppart <conn_options> -d

TheESXisystemisnowwithoutadiagnosticpartition,andyoumustimmediatelysetanewone. 4 Settheactivepartitiontonaa.<naa_ID>.
vicfg-dumppart <conn_options> -s naa.<naa_ID>

Runvicfg-dumppart -tagaintoverifythatadiagnosticpartitionisset.
vicfg-dumppart <conn_options> -t

Ifadiagnosticpartitionisset,[Link],thecommand informsyouthatnopartitionisset.

VMware, Inc.

133

vSphere Command-Line Interface Concepts and Examples

Configuring ESXi Syslog Services


AllESXihostsrunaSyslogservice,whichlogsmessagesfromtheVMkernelandothersystemcomponentsto [Link] system syslogcommandto configurethefollowingparametersofthesyslogservice.

[Link] [Link] [Link] serviceinstalledontheremotehostforinformationonconfiguration. [Link](default),TCPorSSLtransports. [Link] [Link]/scratchdirectoryonthelocalfilesystemispersistent acrossreboots. [Link] [Link] usedbymultipleESXihosts. [Link] bothglobally,[Link],youcansetalargersizelimitforthevmkernel log.

IMPORTANTTheesxcli system syslogcommandistheonlysupportedcommandforchangingESXi5.0 [Link]-syslogcommandandeditingconfigurationfilesisnotsupportedforESXi 5.0andcanresultinerrors. Aftermakingconfigurationchanges,restartthesyslogservice(vmsyslogd)byrunningesxcli system syslog reload. Theesxcli system syslogcommandallowsyoutoconfiguretheloggingbehaviorofyourESXisystem. WithvSphere5.0,[Link] options.
Option mark reload config get config set Description Marksalllogswiththespecifiedstring. Reloadstheconfiguration,andupdatesanychangedconfigurationvalues. Retrievesthecurrentconfiguration. [Link].

--logdir=<path>Savelogstoagivenpath. --loghost=<host>[Link] page 135. --logdir-unique=<true|false>Specifywhetherthelogshouldgotoaunique subdirectoryofthedirectoryspecifiedinlogdir. --default-rotate=<int>Defaultnumberoflogrotationstokeep. --default-size=<int>Sizebeforerotatinglogs,inKB.

config logger list config logger set

Showcurrentlyconfiguredsubloggers. [Link].

--id=<str>IDoftheloggertoconfigure(required). --reset=<str>Resetvaluestodefault. --rotate=<long>Numberofrotatedlogstokeepforaspecificlogger(requires--id). --size=<long>Sizeoflogsbeforerotationforaspecificlogger,inKB(requires--id).

134

VMware, Inc.

Chapter 10 Monitoring ESXi Hosts

esxcli system syslog Examples Thefollowingworkflowillustrateshowyoumightuseesxcli system [Link] oneoftheoptionslistedinConnectionOptionsonpage 17inplaceof<conn_options>. 1 Showconfigurationoptions.
esxcli <conn_options> system syslog config get Default Rotation Size: 1024 Default Rotations: 8 Log Output: /scratch/log Logto Unique Subdirectory: false Remote Host: <none>

Setalllogstokeeptwentyrotationsbeforeoverwritingtheoldestlog.
esxcli <conn_options> system syslog config set --default-rotate=20

SettherotationpolicyforVMkernellogsto10rotations,rotatingat2MB.
esxcli <conn_options> system syslog config logger --id=vmkernel --size=2048 --rotate=10

[Link](UDP)andport (514).
esxcli system syslog config set --loghost='[Link]'

Savethelocalcopyoflogsto/scratch/mylogsandsendanothercopytotheremotehost.
esxcli <conn_options> system syslog config set --loghost='tcp://[Link]' --logdir='/scratch/mylogs'

[Link] [Link] advancedsetting. 6 Sendalogmessagetoalllogssimultaneously.


esxcli <conn_options> system syslog mark --message="this is a message!"

Reloadthesyslogdaemonandapplyconfigurationchanges.
esxcli <conn_options> system syslog reload

Managing ESXi SNMP Agents with vicfg-snmp


SimpleNetworkManagementProtocol(SNMP)allowsmanagementprogramstomonitorandcontrol [Link].

[Link] [Link] SNMPagentfunctionsonlyasatrapemitteranddoesnotsupportotherSNMPoperations(forexample, GET). YoucanmanagethevCenterServeragentwiththevSphereClient,butnotwiththevCLIcommand.

HostbasedembeddedSNMPagent.ESXi4.0andlaterincludesanSNMPagentembeddedinthehost daemon(hostd)thatcansendtrapsandreceivepollingrequestssuchasGETrequests. YoucanmanageSNMPonESXihostswiththevicfg-snmpvCLIcommand,butnotwiththevSphere ClientorwiththeESXCLIcommand.

[Link]/ESXi4.0includeaNetSNMPbasedagent. [Link] [Link],tousetheVMwareMIBfiles,youmust usethehostbasedembeddedSNMPagent.

TousetheNETSNMPbasedagentandhostbasedembeddedSNMPagentatthesametime,makeoneofthe [Link],bothagentsusethesameport.

VMware, Inc.

135

vSphere Command-Line Interface Concepts and Examples

[Link] thatyouperformthefollowingtasks: 1 2 [Link] 136. [Link]:


ConfiguringtheSNMPAgenttoSendTrapsonpage 136 ConfiguringtheSNMPAgentforPollingonpage 137

Configuring SNMP Communities


BeforeyouenabletheESXiembeddedSNMPagent,youmustconfigureatleastonecommunityfortheagent. [Link] [Link] systemcanbeamemberofmultiplecommunities. ToconfigureSNMPcommunities,runvicfg-snmp -c,[Link] example:
vicfg-snmp <conn_options> -c public, internal

Eachtimeyouspecifyacommunitywiththiscommand,thesettingsthatyouspecifyoverwritetheprevious configuration.

Configuring the SNMP Agent to Send Traps


YoucanusetheSNMPagentembeddedinESXitosendvirtualmachineandenvironmentaltrapsto [Link],youmustspecifyatarget(receiver)address,the community,[Link],theSNMPagentsendstrapstoUDPport162 onthetargetmanagementsystembydefault. To configure a trap destination 1 Makesureacommunityissetup.
vicfg-snmp <conn_options> --show Current SNMP agent settings: Enabled: 1 UDP port: 161 Communities: public Notification targets:

Runvicfg-snmp --targetwiththetargetaddress,portnumber,andcommunity. vicfg-snmp <conn_options> -t [Link]@163/public Eachtimeyouspecifyatargetwiththiscommand,thesettingsyouspecifyoverwriteallpreviously [Link],separatethemwithacomma. YoucanchangetheportthattheSNMPagentsendsdatatoonthetargetusingthe--targetsoption. ThatportisUDP162bydefault.

(Optional)EnabletheSNMPagentifitisnotyetrunning.
vicfg-snmp <conn_options> --enable

(Optional)Sendatesttraptoverifythattheagentisconfiguredcorrectly.
vicfg-snmp <conn_options> --test

TheagentsendsawarmStarttraptotheconfiguredtarget.

136

VMware, Inc.

Chapter 10 Monitoring ESXi Hosts

Configuring the SNMP Agent for Polling


IfyouconfiguretheESXiembeddedSNMPagentforpolling,itcanlistenforandrespondtorequestssuchas GETrequestsfromSNMPmanagementclientsystems. Bydefault,theembeddedSNMPagentlistensonUDPport161forpollingrequestsfrommanagement [Link] services,useaUDPportthatisnotdefinedin/etc/services. [Link] [Link],changetheportforoneagent toenablebothagentsforpolling. To configure the SNMP agent for polling 1 Runvicfg-snmp --targetwiththetargetaddress,portnumber,andcommunity. vicfg-snmp <conn_options> -c public -t [Link]@163/public Eachtimeyouspecifyatargetwiththiscommand,thesettingsyouspecifyoverwriteallpreviously [Link],separatethemwithacomma. YoucanchangetheportthattheSNMPagentsendsdatatoonthetargetbyusingthe--targetsoption. ThatportisUDP162bydefault. 2 (Optional)Specifyaportforlisteningforpollingrequests.
vicfg-snmp <conn_options> -p <port>

(Optional)IftheSNMPagentisnotenabled,enableit.
vicfg-snmp <conn_options> --enable

Runvicfg-snmp --testtovalidatetheconfiguration.

Thefollowingexampleshowshowthecommandsareruninsequence.
vicfg-snmp <conn_options> c public t [Link]@162/private --enable # next validate your config by doing these things: vicfg-snmp <conn_options> -test walk v1 c public esx-host

ESX, ESXi, and Virtual Machine Logs


Logscanhelpyoufindoutwhathappenedifcommandsdonothavethedesiredresults.OnESXi5.0systems, findalllogsinthe/var/[Link] /var/run/logdirectory. OnESXi4.1systems,youcanfindthefollowinglogs.
Component [Link] [Link] vSphereclientagentlog Virtualmachinekernelcorefile Sysloglog Serviceconsoleavailabilityreport VMkernelmessages,alerts,and availabilityreport VMkernelwarning Location /var/log/vmware/[Link] /var/log/vmware/[Link] /var/log/vmware/vpx/[Link] Afteryourebootyourmachine,files/root/vmkernel-log.<date>and /root/vmkernel-core.<date>arepresent. /var/log/messages /var/log/vmkernel /var/log/vmkernel /var/log/vmkwarning

VMware, Inc.

137

vSphere Command-Line Interface Concepts and Examples

Component Virtualmachinelogfile Virtualmachineconfigurationfile

Location [Link] <virtual_machine_name>/<virtual_machine_name>.vmxlocatedona [Link] pageinthevSphereClienttodeterminethedatastoreonwhichthisfileislocated.

138

VMware, Inc.

Index

Numerics
3.5 LUN masks 91

A
Active Directory 25 active path 45 ARP redirect 70 authentication algorithm (IPsec) 128 default inheritance 57 key (IPsec) 128 returning to default inheritance 57 AUTOCONF 122

configuration files, path 51 copying files 34 core dumps 132 ESXi Dump Collector 133 local 132 managing 133 cp850 encoding 17 cp936 encoding 17 creating directories 35

D
datastores mounting 30 NFS 48 overview 39 default gateway 126 default inheritance 57, 74, 75 default port groups 113 dependent hardware iSCSI 53, 64, 69 device 39 device management 42, 82 device mappings 41, 42 device naming device UID 39 runtime name 39 VML name 39 Device UID 39 DHCP 124, 125 DHCPV6 122 diagnostic partitions creating 132 example 132, 133 managing 131 directory management 36 directory names with special characters 34 discovery sessions 54 discovery targets 55 disk file path 51 distributed switches 109, 110, 111, 112

B
backing up configuration data 23

C
CDP 113, 114 Challenge Handshake Authentication Protocol 56 changing IP gateway 126 CHAP 56 chapDiscouraged 56 chapPreferred 56 chapProhibited 56 chapRequired 56 Cisco Discovery Protocol 113 claim rules adding 89 converting 91 deleting 92 from 3.5 systems 91 from LUN mask 91 listing 92 loading 92 moving 92 rule IDs 91 running 93 commands with esxcfg prefix 12 configuration data backing up 23 restoring 23

VMware, Inc.

139

vSphere Command-Line Interface Concepts and Examples

DNS 123, 124, 125 downloading files 34 duplicate datastores 29 dynamic discovery 54

E
encoding cp936 17 Shift_JIS 17 encodings cp850 17 encryption algorithm (IPsec) 128 encryption key (IPsec) 128 ESX/ESXi logs 137 esxcfg prefix 12 esxcli network ip commands 120 esxcli network ip dns 124 esxcli network nic commands 117 esxcli network vswitch commands 113, 115, 119 esxcli scsi session commands 78 esxcli storag nfs commands 49 esxcli storage core claiming commands 87 claimrule commands 89 claimrule convert commands 91 claimrule delete command 92 claimrule list command 92 claimrule load command 92 claimrule move command 92 claimrule run command 93 device list 40 esxcli storage core adapter rescan 52 esxcli storage core claiming reclaim command 88 unclaim command 88 esxcli storage core path 43, 45 esxcli storage nmp 81 device list command 82 device set command 82 fixed deviceconfig commands 83 path list command 82 psp commands 82, 83 psp roundrobin commands 84 roundrobin 47, 84 satp commands 85 esxcli system coredump 132 ESXi Dump Collector 131, 133 EUI name 43, 44, 55

examples backup with vMA 23 configure VMkernel NIC for IPv4 120 configure VMkernel NIC for IPv6 120 DNS setup 123 enable and set NetQueue modules 24 entering maintenance mode 22 iSCSI storage setup 62, 64, 67, 69 managing groups 99 managing users 97 route entry setup 126 svmotion 51 uplink adapter setup 117 external HBA properties 72

F
failover 42 FC LUNs 39 Fibre Channel LUNs 39 file management introduction 27 vifs 28, 36 file path, configuration file 51 file systems NAS 48 VMFS 29 fixed path selection policy 83

G
gateway, IP 126 groups 95, 98, 99

H
hard power operations 106 hardware iSCSI setup tasks 66, 70 HBA mappings 42 HBA properties 72 hosts managing 21 shutdown or reboot 21

I
ifconfig, ESXCLI equivalents 111 independent hardware iSCSI definition 53 setup tasks 66, 70 inheritance 75 IP gateway 126 IP storage 109 IPsec 126, 127 IPv4 120, 121 IPv6 120, 122 IQN name 55

140

VMware, Inc.

Index

iSCSI authentication 57, 76, 77 default inheritance 74, 75 dependent hardware iSCSI 64, 69 discovery target names 55 independent hardware iSCSI 66, 70 LUNs 39 mutual authentication 76, 77 options 71 overview 53 parameters 72, 74 parameters, returning to default inheritance 74, 75 port binding 64, 69 ports for multipathing 77 remove sessions 79 securing ports 56 security 55 sessions 79 setup examples 62, 64, 67, 69

MTU 114 multipathing 42, 43 mutual authentication 76, 77 mutual CHAP 63, 65, 68, 70, 76, 77

N
[Link] device name 43, 44 NAS datastores, datastores, NAS 48 NAS file systems 48 NetQueue VMkernel modules 24 network adapters duplex value 117 managing 117 speed 117 network interfaces 112, 117 networking IPsec 126 vDS 122 vSS 112 NFS datastores 48 NFS, capabilities 48 NMP 42, 81, 82 NTP server 125

K
Kerberos 125

L
license 50 listing available LUNs 40, 41 listing IP gateway 126 loading claim rules 92 lockdown mode 18 logical devices, listing 42 logs 137 LUN masks, convert to claim rule 91 LUNs listing available 40, 41 names 43, 44 overview 40

O
offload iSCSI 53 orphaned virtual machine 102

P
parameters default inheritance (iSCSI) 75 setting (iSCSI) 74 partitions, diagnostic 132 path change conditions for round robin 85 path claiming 87 path operations 82 path policies 45, 83, 84 path state, changing 44 paths active 45 changing state 44 disabling 45 identifier 39 listing 44 listing with ESXCLI 43 managing 42 preferred 46, 47, 83 performance monitoring 131 physical network interfaces 117 platform support 14 Pluggable Storage Architecture 42 port binding 64, 69, 77

M
MAC address, VMkernel NIC 119 MagicPacket 118 maintenance mode 22 Managing 42, 53, 117 managing 132 managing local core dumps 132 managing NMP 81 managing paths 42 managing physical network interfaces 117 migrating virtual machines,svmotion 49 mount datastores 30

VMware, Inc.

141

vSphere Command-Line Interface Concepts and Examples

port groups 110, 116 adding 115 and uplink adapter 115, 116 default 113 removing 115 ports, iSCSI multipathing 77 power operations 106 powerop_mode 105 preferred path 46, 47, 83 PSA 42 acronym 81 managing claim rules 89 PSP acronym 81 information 83 operations 82

R
raw devices 39 rebooting hosts 21 register virtual machines 103 removing snapshots 105 rescanning adapters 52 rescanning storage 39, 52 rescanning storage adapters 52 resignature VMFS copy 31 restoring configuration data 23 resxtop 12, 131 reverting snapshots 105 RFCs (vicfg-ipsec) 127 roles 95 round robin operations 47, 84 path change conditions 85 retrieve settings 84 route entry setup 126 rule IDs 91 rules 86 claim rules 89 SATP rules 86 runtime name 39

Shift_JIS encoding 17 Simple Network Management Protocol 135 snapshots 104, 105 SNMP communities 136 management 135 polling 137 traps 136 soft power operations 105 software iSCSI setup tasks 62, 64, 67, 69 spaces in directory names 34 special characters in directories 34 vicfg-iscsi 73, 75 standard networking services 123 starting NTP server 125 state of path, changing 44 static discovery 54 stopping virtual machines 107 storage creating directories with vifs 35 overview 37 path claiming 87 rescanning 39, 52 virtual machines 38 storage array target 40 storage device naming 39 supported platforms 14 svmotion 49 interactive Mode 50 license for storage vMotion 50 limitations 50 noninteractive mode 51 requirements 50 special characters 50 switch attributes 114 syslog server specification 134

T
TCP Segmentation Offload 119 TCP/IP 66, 70, 109 transport mode 128 TSO 119 tunnel mode 128

S
SATP configuration parameters 87 deleting rules 86 retrieve settings 85 rules, adding 85 secure networking 126 securing iSCSI ports 56 security associations (IPsec) 128 security policies (IPsec) 129 sessions, iSCSI 79
142

U
unregister virtual machines 103 uplink adapters 110, 117 and port groups 115, 116 setup 118 useANO (round robin) 48 user input 107

VMware, Inc.

Index

users adding to groups 99 creating 97 in vSphere environment 95 modifying 97 removing from groups 99

V
VDS 109 vicfg-authconfig 25 vicfg-cfgbackup 22, 23 vicfg-dumppart 132, 133 vicfg-hostops 21, 22 vicfg-ipsec 126, 128, 129 vicfg-iscsi command syntax 57 default inheritance for authentication 57 default inheritance for parameters 74, 75 iscsi parameter options 75 vicfg-module 24 vicfg-mpath 44 vicfg-nas 48, 49 vicfg-nics 118 vicfg-ntp 125 vicfg-rescan 52, 68, 69 vicfg-scsidevs 3.5 support 41 list options 41 vicfg-snmp 135 vicfg-syslog 134 vicfg-user 95, 96, 98 vicfg-vmhbadevs 40, 41 vicfg-vmknic 119 vicfg-volume 29 vicfg-vswitch 112, 115 vifs 28, 33 virtual devices 106 virtual machine configuration file path 51 virtual machines attributes 103 file management 27 listing 102, 103 logs 137 managing 103 migration with svmotion 49 network settings 111 orphaned 102 path 102 registering 102, 103 starting 105 stopping 107 storage VMotion 50 vmware-cmd 103
VMware, Inc.

virtual switches 109, 112, 113 MTU 114 retrieving information 113 vicfg-vswitch 112 VLAN ID 116 VMFS duplicate datastores 29 resignature copy 30 resignaturing 31 VMFS3 to VMFS5 conversion 29 VMkernel modules 24 VMkernel network interfaces 119 VMkernel NIC 119 enable VMotion 121 IPv4 120, 121 IPv6 120, 122 VMkernel NICs 119 vmkfstools 28 VML LUN names 43, 44 VMotion 110, 121 VMW_PSP_FIXED 45 VMW_PSP_MRU 46 VMW_PSP_RR 46 vmware-cmd connection options 102 general options 102 server options 102 snapshots 104 virtual machine options 103 VMware Tools 106 vSphere distributed switches 111, 122 VSS 109

W
Windows Active Directory 25

143

vSphere Command-Line Interface Concepts and Examples

144

VMware, Inc.

You might also like