Vmware VSphere Command Line Interface Concepts And Examples V Center Server 6.0 Esxi Vcenter 60 En

User Manual: vmware vCenter Server - 6.0 - Command-Line Interface Concepts and Examples Free User Guide for VMware vCenter Software, Manual

Open the PDF directly: View PDF PDF.
Page Count: 156 [warning: Documents this large are best viewed by clicking the View PDF Link!]

vSphere Command-Line Interface
Concepts and Examples
ESXi 6.0
vCenter Server 6.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 http://www.vmware.com/support/pubs.
EN-001470-00
VMware, Inc.
3401 Hillview Ave.
Palo Alto, CA 94304
www.vmware.com
2VMware, Inc.
vSphere Command-Line Interface Concepts and Examples
You can find the most up-to-date technical documentation on the VMware Web site at:
http://www.vmware.com/support/
The VMware Web site also provides the latest product updates.
If you have comments about this documentation, submit your feedback to:
docfeedback@vmware.com
Copyright © 2008 - 2015 VMware, Inc. All rights reserved. Copyright and trademark information
VMware, Inc. 3
Contents
AboutThisBook 9
1vSphereCLICommandOverviews 11
Introduction 11
Documentation 12
CommandLineHelp 12
ListofAvailableHostManagementCommands 12
TargetsandProtocolsforvCLIHostManagementCommands 14
SupportedPlatformsforvCLICommands 15
CommandswithanesxcfgPrefix 16
ESXCLIOverview 16
ESXCLICommandsAvailableonDifferentESXiHosts 16
TrustRelationshipRequirementforESXCLICommands 17
DownloadingandInstallingthevCenterServerCertificate 17
Usingthe‐‐cacertsfileOption 17
Usingthe‐‐thumbprintOption 17
UsingtheCredentialStore 17
UsingESXCLIOutput 18
ConnectionOptionsforvCLIHostManagementCommands 18
ConnectionOptionsforDCLICommands 18
vCLIHostManagementCommandsandLockdownMode 19
2ManagingHosts 21
Stopping,Rebooting,andExaminingHosts 21
StoppingandRebootingHostswithESXCLI 21
Stopping,Rebooting,andExaminingHostswithvicfghostops 21
EnteringandExitingMaintenanceMode 22
EnteringandExitingMaintenanceModewithESXCLI 22
EnteringandExitingMaintenanceModewithvicfghostops 23
BackingUpConfigurationInformationwithvicfgcfgbackup 23
BackupTasks 23
BackingUpConfigurationData 24
RestoringConfigurationData 24
UsingvicfgcfgbackupfromvMA 24
ManagingVMkernelModules 24
ManagingModuleswithesxclisystemmodule 25
ManagingModuleswithvicfgmodule 25
UsingvicfgauthconfigforActiveDirectoryConfiguration 25
UpdatingHosts 26
3ManagingFiles 27
IntroductiontoVirtualMachineFileManagement 27
ManagingtheVirtualMachineFileSystemwithvmkfstools 28
UpgradingVMFS3VolumestoVMFS5 29
ManagingVMFSVolumes 29
ManagingDuplicateVMFSDatastores 29
MountingDatastoreswithExistingSignatures 29
Getting Started with vSphere Command-Line Interfaces
4VMware, Inc.
MountingandUnmountingwithESXCLI 30
MountingandUnmountingwithvicfgvolume 30
ResignaturingVMFSCopies 30
ResignaturingaVMFSCopywithESXCLI 31
ResignaturingaVMFSCopywithvicfgvolume 31
ReclaimingUnusedStorageSpace 31
UsingvifstoViewandManipulateFilesonRemoteESXiHosts 32
Examples 34
ExampleScenario 35
4ManagingStorage 37
IntroductiontoStorage 37
HowVirtualMachinesAccessStorage 38
Datastores 39
StorageDeviceNaming 39
DeviceIdentifiers 40
LegacyIdentifiers 40
ExaminingLUNs 40
TargetandDeviceRepresentation 40
ExaminingLUNswithesxclistoragecore 41
ExaminingLUNswithvicfgscsidevs 42
DetachingDevicesandRemovingaLUN 43
WorkingwithPermanentDeviceLoss 43
ManagingPaths 44
MultipathingwithLocalStorageandFCSANs 44
ListingPathInformation 45
ListingPathInformationwithESXCLI 45
ListingPathInformationwithvicfgmpath 46
ChangingtheStateofaPath 46
ChangingPathStatewithESXCLI 47
ChangingPathStatewithvicfgmpath 47
ManagingPathPolicies 47
MultipathingConsiderations 48
ChangingPathPolicies 49
ChangingPathPolicieswithESXCLI 49
ChangingPathPolicieswithvicfgmpath 49
SettingPolicyDetailsforDevicesthatUseRoundRobin 50
ManagingNFS/NASDatastores 50
CapabilitiesSupportedbyNFS/NAS 51
AddingandDeletingNASFileSystems 51
ManagingNASFileSystemswithESXCLI 51
ManagingNASFileSystemswithvicfgnas 52
MonitoringandManagingSANStorage 52
MonitoringandManagingVirtualSANStorage 53
ToretrieveVirtualSANinformation 53
TomanageaVirtualSANcluster 53
ToaddandremoveVirtualSANstorage 54
MonitoringvSphereFlashReadCache 54
MonitoringandManagingVirtualVolumes 55
MigratingVirtualMachineswithsvmotion 55
StoragevMotionUses 56
StoragevMotionRequirementsandLimitations 56
RunningsvmotioninInteractiveMode 56
RunningsvmotioninNoninteractiveMode 56
VMware, Inc. 5
Contents
ConfiguringFCoEAdapters 57
ScanningStorageAdapters 58
RetrievingSMARTInformation 58
5ManagingiSCSIStorage 59
iSCSIStorageOverview 59
DiscoverySessions 60
DiscoveryTargetNames 61
ProtectinganiSCSISAN 61
ProtectingTransmittedData 61
SecuringiSCSIPorts 62
SettingiSCSICHAP 62
CommandSyntaxforesxcliiscsiandvicfgiscsi 63
esxcliiscsiCommandSyntax 63
KeytoesxcliiscsiShortOptions 64
vicfgiscsiCommandSyntax 65
iSCSIStorageSetupwithESXCLI 68
SettingUpSoftwareiSCSIwithESXCLI 68
SettingUpDependentHardwareiSCSIwithESXCLI 70
SettingUpIndependentHardwareiSCSIwithESXCLI 72
iSCSIStorageSetupwithvicfgiscsi 73
SettingUpSoftwareiSCSIwithvicfgiscsi 73
SettingUpDependentHardwareiSCSIwithvicfgiscsi 75
SettingUpIndependentHardwareiSCSIwithvicfgiscsi 76
ListingandSettingiSCSIOptions 77
ListingiSCSIOptionswithESXCLI 77
SettingMTUwithESXCLI 78
ListingandSettingiSCSIOptionswithvicfgiscsi 78
ListingandSettingiSCSIParameters 78
ListingandSettingiSCSIParameterswithESXCLI 79
ReturningParameterstoDefaultInheritance 80
ListingandSettingiSCSIParameterswithvicfgiscsi 80
ReturningParameterstoDefaultInheritance 81
EnablingiSCSIAuthentication 82
EnablingiSCSIAuthenticationwithESXCLI 82
EnablingiSCSIAuthenticationwithvicfgiscsi 83
SettingUpPortsforiSCSIMultipathing 83
ManagingiSCSISessions 84
IntroductiontoiSCSISessionManagement 84
ListingiSCSISessions 85
LoggingintoiSCSISessions 85
RemovingiSCSISessions 85
6ManagingThirdPartyStorageArrays 87
ManagingNMPwithesxclistoragenmp 87
DeviceManagementwithesxclistoragenmpdevice 87
esxclistoragenmpdevicelist 88
esxclistoragenmpdeviceset 88
ListingPathswithesxclistoragenmppath 88
ManagingPathSelectionPolicyPluginswithesxclistoragenmppsp 88
RetrievingPSPInformation 89
SettingConfigurationParametersforThirdPartyExtensions 89
FixedPathSelectionPolicyOperations 89
RetrievingthePreferredPath 89
SettingthePreferredPath 90
Getting Started with vSphere Command-Line Interfaces
6VMware, Inc.
CustomizingRoundRobinSetup 90
RetrievingPathSelectionSettings 90
SpecifyingConditionsforPathChanges 91
ManagingSATPs 91
RetrievingInformationAboutSATPs 91
AddingSATPRules 91
RemovingSATPRules 92
RetrievingandSettingSATPConfigurationParameters 93
PathClaimingwithesxclistoragecoreclaiming 93
UsingtheReclaimTroubleshootingCommand 94
UnclaimingPathsorSetsofPaths 94
ManagingClaimRules 95
AddingClaimRules 95
ConvertingESX3.5LUNMaskstoClaimRuleFormat 97
RemovingClaimRules 98
ListingClaimRules 98
LoadingClaimRules 98
MovingClaimRules 98
RunningPathClaimingRules 99
7ManagingUsers 101
UsersinthevSphereEnvironment 101
vicfguserCommandSyntax 101
ManagingUserswithvicfguser 102
AssigningPermissionswithESXCLI 104
8ManagingVirtualMachines 105
vmwarecmdOverview 105
ConnectionOptionsforvmwarecmd 106
GeneralOptionsforvmwarecmd 106
FormatforSpecifyingVirtualMachines 106
ListingandRegisteringVirtualMachines 106
RetrievingVirtualMachineAttributes 107
ManagingVirtualMachineSnapshotswithvmwarecmd 108
TakingVirtualMachineSnapshots 109
RevertingandRemovingSnapshots 109
PoweringVirtualMachinesOnandOff 109
ConnectingandDisconnectingVirtualDevices 110
WorkingwiththeAnswerVMAPI 111
ForciblyStoppingVirtualMachineswithEXCLI 111
9ManagingvSphereNetworking 113
IntroductiontovSphereNetworking 113
NetworkingUsingvSphereStandardSwitches 114
NetworkingUsingvSphereDistributedSwitches 115
RetrievingBasicNetworkingInformation 115
NetworkTroubleshooting 116
SettingUpvSphereNetworkingwithvSphereStandardSwitches 117
SettingUpVirtualSwitchesandAssociatingaSwitchwithaNetworkInterface 117
RetrievingInformationAboutVirtualSwitches 118
RetrievingInformationaboutVirtualSwitcheswithESXCLI 118
RetrievingInformationaboutVirtualSwitcheswithvicfgvswitch 118
AddingandDeletingVirtualSwitches 119
AddingandDeletingVirtualSwitcheswithESXCLI 119
VMware, Inc. 7
Contents
AddingandDeletingVirtualSwitcheswithvicfgvswitch 119
SettingSwitchAttributeswithesxclinetworkvswitchstandard 119
SettingSwitchAttributeswithvicfgvswitch 120
Checking,Adding,andRemovingPortGroups 120
ManagingPortGroupswithESXCLI 120
ManagingPortGroupswithvicfgvswitch 120
ManagingUplinksandPortGroups 121
ConnectingandDisconnectingUplinkAdaptersandPortGroupswithESXCLI 121
ConnectingandDisconnectingUplinksandPortGroupswithvicfgvswitch 121
SettingthePortGroupVLANID 121
SettingthePortGroupVLANIDwithESXCLI 121
SettingthePortGroupVLANIDwithvicfgvswitch 122
ManagingUplinkAdapters 122
ManagingUplinkAdapterswithesxclinetworknic 122
SpecifyingMultipleUplinkswithESXCLI 123
ManagingUplinkAdapterswithvicfgnics 124
LinkingandUnlinkingUplinkAdapterswithESXCLI 124
LinkingandUnlinkingUplinkAdapterswithvicfgvswitch 124
AddingandModifyingVMkernelNetworkInterfaces 125
ManagingVMkernelNetworkInterfaceswithESXCLI 125
ManagingVMkernelNetworkInterfaceswithvicfgvmknic 126
SettingUpvSphereNetworkingwithvSphereDistributedSwitch 128
ManagingStandardNetworkingServicesinthevSphereEnvironment 128
SettingtheDNSConfiguration 128
SettingtheDNSConfigurationwithESXCLI 128
SettingtheDNSConfigurationwithvicfgdns 130
AddingandStartinganNTPServer 131
ManagingtheIPGateway 131
SettingUpIPsec 132
UsingIPsecwithESXi 132
ManagingSecurityAssociations 133
ManagingSecurityPolicies 134
ManagingtheESXiFirewall 135
MonitoringVXLAN 136
137
10 MonitoringESXiHosts 139
UsingresxtopforPerformanceMonitoring 139
ManagingDiagnosticPartitions 139
DiagnosticPartitionCreation 140
DiagnosticPartitionManagement 140
ManagingCoreDumps 140
ManagingLocalCoreDumpswithESXCLI 140
ManagingCoreDumpswithESXiDumpCollector 141
ManagingCoreDumpswithvicfgdumppart 141
ConfiguringESXiSyslogServices 142
ManagingESXiSNMPAgents 143
ConfiguringSNMPCommunities 144
ConfiguringtheSNMPAgenttoSendTraps 144
ConfiguringaTrapDestinationwithESXCLI 144
ConfiguringaTrapDestinationwithvicfgsnmp 145
ConfiguringtheSNMPAgentforPolling 145
RetrievingHardwareInformation 146
VMware, Inc. 8
Contents
Index 147
VMware, Inc. 9
TheGettingStartedwithvSphereCommandLineInterfacesdocumentationexplainshowtousethecommandsin
theVMwarevSphere®CommandLineInterface(vCLI)andincludescommandoverviewsandexamples.
Intended Audience
ThisbookisforexperiencedWindowsorLinuxsystemadministratorswhoarefamiliarwithvSphere
administrationtasksanddatacenteroperationsandknowhowtousecommandsinscripts.
Document Feedback
VMwarewelcomesyoursuggestionsforimprovingourdocumentation.Ifyouhavecomments,sendyour
feedbacktodocfeedback@vmware.comorclickontheSendUsFeedbackbuttoninthedocumentationcenter.
Related Documentation
ThevSphereCommandLineInterfaceReference,availableinthevSphereDocumentationCenter,includes
referenceinformationforvicfg-commandsandESXCLIcommands.
GettingStartedwithvSphereCommandLineInterfacesincludesinformationaboutavailableCLIs,enablingthe
ESXiShell,andinstallingandrunningvCLIandDCLIcommands.
CommandLineManagementinvSphere5andvSphere6forServiceConsoleUsersisforcustomerswhocurrently
usetheESX ServiceConsole.
ThevSphereSDKforPerldocumentationexplainshowyoucanusethevSphereSDKforPerlandrelated
utilityapplicationstomanageyourvSphereenvironment.ThedocumentationincludesanInstallationGuide,a
ProgrammingGuide,andareferencetothevSphereSDKforPerlUtilityApplications.
BackgroundinformationforthetasksdiscussedinthismanualisavailableinthevSpheredocumentationset.
ThevSpheredocumentationconsistsofthecombinedvCenterServerandESXidocumentationandincludes
informationaboutmanagingstorage,networkingvirtualmachines,andmore.
Technical Support and Education Resources
Thefollowingsectionsdescribethetechnicalsupportresourcesavailabletoyou.Toaccessthecurrentversion
ofthisbookandotherbooks,gotohttp://www.pubs.vmware.com..
Online and Telephone Support
Touseonlinesupporttosubmittechnicalsupportrequests,viewyourproductandcontractinformation,and
registeryourproducts,gotohttp://www.vmware.com/support.
Customerswithappropriatesupportcontractsshouldusetelephonesupportforthefastestresponseon
priority1issues.Gotohttp://www.vmware.com/support/phone_support.
About This Book
Getting Started with vSphere Command-Line Interfaces
10 VMware, Inc.
Support Offerings
TofindouthowVMwaresupportofferingscanhelpmeetyourbusinessneeds,goto
http://www.vmware.com/support/services.
VMware Professional Services
VMwareEducationServicescoursesofferextensivehandsonlabs,casestudyexamples,andcoursematerials
designedtobeusedasonthejobreferencetools.Coursesareavailableonsite,intheclassroom,andlive
online.Foronsitepilotprograms andimplementationbestpractices,VMwareConsultingServicesprovides
offeringsto helpyouassess,plan,build,andmanageyourvirtualenvironment.Toaccessinformationabout
educationclasses,certificationprograms,andconsultingservices,gotohttp://www.vmware.com/services.
VMware, Inc. 11
1
Thischapterintroducesthecommandset,presentssupportedcommandsfordifferentversionsofvSphere,
listsconnectionoptions,anddiscussesvCLIandlockdownmode.
Thischapterincludesthefollowingtopics:
“Introduction”onpage 11
“ListofAvailableHostManagementCommands”onpage 12
“TargetsandProtocolsforvCLIHostManagementCommands”onpage 14
“CommandswithanesxcfgPrefix”onpage 16
“ESXCLIOverview”onpage 16
“ConnectionOptionsforvCLIHostManagementCommands”onpage 18
“ConnectionOptionsforDCLICommands”onpage 18
“vCLIHostManagementCommandsandLockdownMode”onpage 19
Introduction
ThecommandsinthevSphereCLIpackageallowyoutoperformvSphereconfigurationtasksusing
commandsfromvCLIpackageinstalledonsupportedplatforms,orusingcommandsfromvMA.Thepackage
consistsofseveralcommandsets.
vSphere CLI Command Overviews
1
Table 1-1. Components of the vSphere CLI Command Set
vCLI Commands Description
ESXCLIcommands ManagemanyaspectsofanESXihost.YoucanrunESXCLIcommandsremotelyorinthe
ESXiShell.
YoucanalsorunESXCLIcommandsfromthevSpherePowerCLIpromptbyusingthe
Get-EsxClicmdlet.
vicfg- commands SetofcommandsformanyaspectsofhostmanagementEventually,thesecommandswillbe
replacedbyESXCLIcommands.
Asetofesxcfg-commandsthatpreciselymirrorsthevicfg-commandsisalsoincludedin
thevCLIpackage.f
Othercommands
(vmware-cmd,vifs,
vmkfstools)
CommandsimplementedinPerlthatdonothaveavicfg-prefix.Thesecommandsare
scheduledtobedeprecatedorreplacedbyESXCLIcommands.
DCLIcommands ManageVMwareSDDCservices.
DCLIisaCLIclienttothevCloudSuiteSDKinterfaceformanagingVMwareSDDCservices.
ADCLIcommandtalkstoavCloudSuiteAPIendpointtolocaterelevantinformation,and
thenexecutesthecommandanddisplaysresulttotheuser.
Getting Started with vSphere Command-Line Interfaces
12 VMware, Inc.
YoucaninstallthevSphereCLIcommandsetonasupportedLinuxorWindowssystem.SeeGettingStarted
withvSphereCommandLineInterfaces.YoucanalsodeploythevSphereManagementAssistant(vMA)toan
ESXisystemofyourchoice.
Afterinstallation,runvCLIcommandsfromtheLinuxorWindowssystemorfromvMA.
ManageESXihostswithothervCLIcommandsbyspecifyingconnectionoptionssuchasthetargethost,
user,andpasswordoraconfigurationfile.See“ConnectionOptionsforvCLIHostManagement
Commands”onpage 18.
ManagevCenterserviceswithDCLIcommandsbyspecifyingatargetvCenterServersystemand
authenticationoptions.SeeGettingStartedwithvSphereCommandLineInterfacesforalistofconnection
options.
Documentation
GettingStartedwithvSphereCommandLineInterfacesincludesinformationaboutavailableCLIs,enablingthe
ESXiShell,andinstallingandrunningvCLIcommands.Anappendixsuppliesthenamespaceandcommand
hierarchiesforESXCLI.
ReferenceinformationforvCLIandDCLIcommandsisavailableonthevCLIdocumentationpage
http://www.vmware.com/support/developer/vcli/andinthevSphereDocumentationCenterfortheproduct
versionthatyouareusing.
vSphereCommandLineInterfaceReferenceisareferencetovicfg-andrelatedvCLIcommandsand
includesreferenceinformationforESXCLIcommands.Allreferenceinformationisgeneratedfromthe
help.
AreferencetoesxtopandresxtopisincludedintheResourceManagementdocumentation.
TheDCLIReferenceisincludedseparatelyfromthevSphereCommandLineInterfaceReference.Allreference
informationisgeneratedfromthehelp.
Command-Line Help
Availablecommandlinehelpdiffersforthedifferentcommandsets.
List of Available Host Management Commands
Table 12listsvCLIhostmanagementcommandsinalphabeticalorderandthecorrespondingESXCLI
commandifavailable.ForESXCLI,newcommandsandnamespacesareaddedwitheachrelease.Seethe
ReleaseNotesforthecorrespondingreleaseforinformation.
FunctionalityofDCLIcommandsetthatisbeingaddedinvSphere6.0isdifferentfromthesecommands.They
arenotincludedinthetable.
Command set Available Command-Line Help
vicfg‐commands Run<vicfg-cmd> --helpforanoverviewofeachoptions.
RunPod2Htmlwithavicfg‐commandasinputandpipetheoutputtoafileformoredetailed
helpinformation.
pod2html vicfg-authconfig.pl > vicfg-authconfig.html
ThisoutputcorrespondstotheinformationavailableinthevSphereCommandLineInterface
Reference.
ESXCLIcommands Run--helpatanylevelofthehierarchyforinformationaboutbothcommandsand
namespacesavailablefromthatlevel.
DCLIcommands Run--helpforanycommandornamespacetodisplaytheinputoptions,whethertheoption
isrequired,andtheinputoptiontype.Fornamespaces,--helpdisplaysallavailablechild
namespacesandcommands.
Rundcli --helptodisplayusageinformationforDCLI.
VMware, Inc. 13
Chapter 1 vSphere CLI Command Overviews
Table 1-2. vCLI and ESXCLI Commands
vCLI 4.1 Command
vCLI 5.1 and later
Command Comment
esxcli esxcli(newsyntax) AllvCLI4.1commandshavebeenrenamed.Significantadditionshavebeen
madetoESXCLI.Manytaskspreviouslyperformedwithavicfg-command
isnowperformedwithESXCLI.
resxtop resxtop(NoESXCLI
equivalent)
Supportedonlyon
Linux.
MonitorsinrealtimehowESXihostsuseresources.Runsininteractiveor
batchmode.
See“UsingresxtopforPerformanceMonitoring”onpage 139.SeethevSphere
ResourceManagementdocumentationforadetailedreference.
svmotion svmotion(NoESXCLI
equivalent)
Mustrunagainsta
vCenterServersystem.
Movesavirtualmachine’sconfigurationfile,and,optionally,itsdisks,while
thevirtualmachineisrunning.
See“MigratingVirtualMachineswithsvmotion”onpage 55.
vicfg-advcfg esxcli system
settings advanced
Performsadvancedconfiguration.
TheadvancedsettingsareasetofVMkerneloptions.Theseoptionsare
typicallyinplaceforspecificworkaroundsordebugging.
UsethiscommandasinstructedbyVMware.
vicfg-authconfig vicfg-authconfig(No
ESXCLIequivalent).
RemotelyconfiguresActiveDirectorysettingsforanESXihost.
See“UsingvicfgauthconfigforActiveDirectoryConfiguration”onpage 25.
vicfg-cfgbackup vicfg-cfgbackup(No
ESXCLIequivalent),
Cannotrunagainsta
vCenterServersystem.
BacksuptheconfigurationdataofanESXisystemandrestorespreviously
savedconfigurationdata.
See“BackingUpConfigurationInformationwithvicfgcfgbackup”on
page 23.
vicfg-dns esxcli network ip
dns
SpecifiesanESXihost’sDNS(DomainNameServer)configuration.See
“SettingtheDNSConfiguration”onpage 128.
vicfg-dumppart esxcli system
coredump
Setsboththepartition(esxcli system coredump partition)andthe
network(esxcli system coredump network)touseforcoredumps.Use
thiscommandtosetupESXiDumpCollector.
“ManagingDiagnosticPartitions”onpage 139.
vicfg-hostops esxcli system
maintenancemode
esxcli system
shutdown
Manageshosts.
“Stopping,Rebooting,andExaminingHosts”onpage 21.
“EnteringandExitingMaintenanceMode”onpage 22.
vicfg-ipsec esxcli network ip
ipsec
SetsupIPsec(InternetProtocolSecurity),whichsecuresIPcommunications
comingfromandarrivingatESXihosts.ESXihostssupportIPsecusingIPv6.
See“SettingUpIPsec”onpage 132.
vicfg-iscsi esxcli iscsi ManageshardwareandsoftwareiSCSIstorage.
See“ManagingiSCSIStorage”onpage 59.
vicfg-module esxcli system
module
EnablesVMkerneloptions.Usethiscommandwiththeoptionslistedinthis
document,orasinstructedbyVMware.
See“ManagingVMkernelModules”onpage 24.
vicfg-mpath
vicfg-mpath35
esxcli storage core
path
Configuresstoragearrays.
“ManagingPaths”onpage 44.
vicfg-nas esxcli storage nfs ManagesNAS/NFSfilesystems.See“ManagingNFS/NASDatastores”on
page 50.
vicfg-nics esxcli network nicManagestheESXihost’suplinkadapters.See“ManagingUplinkAdapters”
onpage 122.
vicfg-ntp vicfg-ntp(NoESXCLI
equivalent)
DefinestheNTP(NetworkTimeProtocol)server.SeeAddingandStartingan
NTPServeronpage 131.
vicfg-rescan esxcli storage core
adapter rescan
Rescansthestorageconfiguration.See“ScanningStorageAdapters”on
page 58.
vicfg-route esxcli network ip
route)
ManagestheESXihost’srouteentry.See“ManagingtheIPGateway”on
page 131.
Getting Started with vSphere Command-Line Interfaces
14 VMware, Inc.
Targets and Protocols for vCLI Host Management Commands
MostvCLIcommandsareusedtomanageorretrieveinformationaboutoneormoreESXihosts.Theycan
targetanESXihostoravCenterServersystem.WhenyoutargetavCenterServersystem,youcanuse
--vihosttospecifytheESXihosttorunthecommandagainst.Theonlyexceptionissvmotion,whichyou
canrunagainstvCenterServersystems,butnotagainstESXisystems.
ThefollowingcommandsmusthaveanESXisystem,notavCenterServersystemasatarget.
vifs
vicfg-user
vicfg-cfgbackup
vihostupdate
vmkfstools
TheresxtopcommandrequiresanHTTPSconnection.AllothercommandssupportHTTPandHTTPS.
vicfg-scsidevs esxcli storage core
device
FindsandexaminesavailableLUNs.See“ExaminingLUNs”onpage 40.
vicfg-snmp esxcli system snmp ManagestheSNMPagent.“ManagingESXiSNMPAgents”onpage 143.
UsingSNMPinavSphereenvironmentisdiscussedindetailinthevSphere
MonitoringandPerformancedocumentation.
NewoptionsaddedinvCLI5.0.
ExpandedSNMPsupportaddedinvCLI5.1.
vicfg-syslog esxcli system
syslog
SpecifieslogsettingsforESXihostsincludinglocalstoragepoliciesandserver
andportinformationfornetworklogging.See“ConfiguringESXiSyslog
Services”onpage 142.
ThevCenterServerandHostManagementdocumentationexplainshowtosetup
systemlogsusingthevSphereWebClient.
vicfg-user vicfg-user(No
ESXCLIequivalent)
Creates,modifies,deletes,andlistslocaldirectaccessusersandgroupsof
users.SeeManagingUsers”onpage 101.
ThevSphereSecuritydocumentationdiscussessecurityimplicationsofuser
managementandcustomroles.
vicfg-vmknic esxcli network ip
interface.
Adds,deletes,andmodifiesVMkernelnetworkinterfaces.SeeAddingand
ModifyingVMkernelNetworkInterfaces”onpage 125.
vicfg-volume esxcli storage
filesystem
SupportsresignaturingthecopyofaVMFSvolume,andmountingand
unmountingthecopy.See“ManagingDuplicateVMFSDatastores”on
page 29.
vicfg-vswitch esxcli network
vswitch
Addsorremovesvirtualswitchesormodifiesvirtualswitchsettings.See
“SettingUpVirtualSwitchesandAssociatingaSwitchwithaNetwork
Interface”onpage 117.
vifs vifs(NoESXCLI
equivalent)
Performsfilesystemoperationssuchasretrievinganduploadingfilesonthe
ESXisystem.See“ManagingtheVirtualMachineFileSystemwith
vmkfstools”onpage 28.
vihostupdate esxclisoftware vibUpdateslegacyESXihoststoadifferentversionofthesamemajorrelease.
YoucannotrunvihostupdateagainstESXi5.0andlaterhosts.
See“ManagingVMkernelModules”onpage 24.
vmkfstools vmkfstools(No
ESXCLIequivalent)
Createsandmanipulatesvirtualdisks,filesystems,logicalvolumes,and
physicalstoragedevicesonanESXihost.See“ManagingtheVirtualMachine
FileSystemwithvmkfstools”onpage 28.
vmware-cmd vmware-cmd(No
ESXCLIequivalent)
Performsvirtualmachineoperationsremotely.Thisincludes,forexample,
creatingasnapshot,poweringthevirtualmachineonoroff,andgetting
informationaboutthevirtualmachine.See“ManagingVirtualMachines”on
page 105.
Table 1-2. vCLI and ESXCLI Commands (Continued)
vCLI 4.1 Command
vCLI 5.1 and later
Command Comment
VMware, Inc. 15
Chapter 1 vSphere CLI Command Overviews
Supported Platforms for vCLI Commands
YoucannotrunthevihostupdatecommandagainstanESXi5.0orlatersystem.
Youcannotrunvicfg-syslog --setserverorvicfg-syslog --setportwithanESXi5.0orlatertarget.
Table 13listsplatformsupportforthedifferentvCLIcommands.
Table 1-3. Platform Support for vCLI 5.x Commands
Command ESXi 5.x and 6.0 VC 5.xand 6.0 ESXi 4.x ESX 4.x VC 4.x
DCLI No No No No No
esxcli Yes Yes Yes Yes No
resxtop Yes(fromLinux) Yes(fromLinux) Yes(from
Linux)
Yes(from
Linux)
Yes(from
Linux)
svmotion No Yes No No Yes
vicfg-advcfg Yes Yes Yes Yes Yes
vicfg-authconfig Yes Yes Yes Yes Yes
vicfg-cfgbackup Yes No Yes No No
vicfg-dns Yes Yes Yes Yes Yes
vicfg-dumppart Yes Yes Yes Yes Yes
vicfg-hostops Yes Yes Yes Yes Yes
vicfg-ipsec Yes No Yes Yes No
vicfg-iscsi Yes Yes Yes Yes Yes
vicfg-module Yes Yes Yes Yes Yes
vicfg-mpath Yes Yes Yes Yes Yes
vicfg-nas Yes Yes Yes Yes Yes
vicfg-nics Yes Yes Yes Yes Yes
vicfg-ntp Yes Yes Yes Yes Yes
vicfg-rescan Yes Yes Yes Yes Yes
vicfg-route Yes Yes Yes Yes Yes
vicfg-scsidevs Yes Yes Yes Yes Yes
vicfg-snmp Yes No Yes Yes No
vicfg-syslog No Nofor5.0target Yes No Yes
vicfg-user Yes No Yes Yes No
vicfg-vmknic Yes Yes Yes Yes Yes
vicfg-volume Yes Yes Yes Yes Yes
vicfg-vswitch Yes Yes Yes Yes Yes
vifs Yes No Yes Yes No
vihostupdate Useesxcli software vibinstead.Yes Yes No
vmkfstools Yes No Yes Yes No
vmware-cmd Yes Yes Yes Yes Yes
vicfg-mpath35 No No No No No
vihostupdate35 No No No No No
Getting Started with vSphere Command-Line Interfaces
16 VMware, Inc.
Commands with an esxcfg Prefix
Tofacilitateeasymigrationifshellscriptsthatuseesxcfg‐commands,thevCLIpackageincludesacopyof
eachvicfg-commandthatusesanesxcfg-prefix.
Table 14listsallvCLIvicfg-commandsforwhichavCLIcommandwithanesxcfgprefixisavailable.
ESXCLI Overview
ThissectiongivesanoverviewofESXCLIcommandsandhowtousethem.SeeGettingStartedwithvSphere
CommandLineInterfacesfordetails.
ESXCLI Commands Available on Different ESXi Hosts
WhenyourunanESXCLIvCLIcommand,youmustknowthecommandssupportedonthetargethost.For
example,ifyouruncommandsagainstESXi5.xhosts,ESXCLI5.xcommandsaresupported.Ifyourun
commandsagainstESXi6.0hosts,ESXCLI6.0commandsaresupported.
Somecommandsorcommandoutputsaredeterminedbythehosttype.Inaddition,VMwarepartnersmight
developcustomESXCLIcommandsthatyoucanrunonhostswherethepartnerVIBhasbeeninstalled.
Runesxcli --server <target> --helpforalistofnamespacessupportedonthetarget.Youcandrill
downintothenamespacesforadditionalhelp.
IMPORTANTVMwarerecommendsthatyouuseESXCLIorthevCLIcommandswiththevicfgprefix.
Commandswiththeesxcfgprefixareavailablemainlyforcompatibilityreasonsandarenowobsolete.
vCLIesxcfg-commandsareequivalenttovicfg-commands,butnotcompletelyequivalenttothe
deprecatedesxcfg- serviceconsolecommands.
Table 1-4. Commands with an esxcfg Prefix
Command with vicfg prefix Command with esxcfg prefix
vicfg-advcfg esxcfg-advcfg
vicfg-cfgbackup esxcfg-cfgbackup
vicfg-dns esxcfg-dns
vicfg-dumppart esxcfg-dumppart
vicfg-module esxcfg-module
vicfg-mpath esxcfg-mpath
vicfg-nas esxcfg-nas
vicfg-nics esxcfg-nics
vicfg-ntp esxcfg-ntp
vicfg-rescan esxcfg-rescan
vicfg-route esxcfg-route
vicfg-scsidevs esxcfg-scsidevs
vicfg-snmp esxcfg-snmp
vicfg-syslog esxcfg-syslog
vicfg-vmknic esxcfg-vmknic
vicfg-volume esxcfg-volume
vicfg-vswitch esxcfg-vswitch
IMPORTANTESXCLIonESX4.xhostsdoesnotsupporttargetingavCenterServersystem.Youcantherefore
notrunESXCLIcommandswith--serverpointingtoavCenterServersystemevenifyouinstallvCLI5.0.
VMware, Inc. 17
Chapter 1 vSphere CLI Command Overviews
Trust Relationship Requirement for ESXCLI Commands
StartingwithvSphere6.0,ESXCLIcheckswhetheratrustrelationshipexistsbetweenthemachinewhereyou
runtheESXCLIcommandandtheESXihost.Anerrorresultsifthetrustrelationshipdoesnotexist.
Toestablishthetrustrelationship,youhavetheseoptions.
Downloading and Installing the vCenter Server Certificate
YoucandownloadthevCenterServerrootcertificateusingaWebbrowserandaddittothetrustedcertificates
onthemachinewhereyouplanonrunningESXCLIcommands.
To download the certificate
1TypetheURLofthevCenterServersystemorvCenterServerVirtualApplianceintoaWebBrowser.
2ClicktheDownloadtrustedrootcertificateslink.
3 Changetheextensionofthedownloadedfileto.zip.(ThefileisaZIPfileofallcertificatesinthe
TRUSTED_ROOTSstore).
4ExtracttheZIPfile.
Theresultisacertsfolder.Thefolderincludesfileswiththeextension.0..1,andsoon,whichare
certificates,andfileswiththeextension.r0,r1,andsoonwhichareCRLfilesassociatedwiththe
certificates.
5Addthetrustedrootcertificatestothelistoftrustedroots.Theprocessdiffersdependingontheplatform
youareon.
YoucannowrunESXCLIcommandsagainstanyhostthatismanagedbythetrustedvCenterServerwithout
supplyingadditionalinformationifyouspecifythevCenterServerinthe--serveroptionandtheESXihost
inthe--vihostoption.
Using the --cacertsfile Option
Usingacertificatetoestablishthetrustrelationshipisthemostsecureoption.Youcanspecifythecertificate
withthe--cacertsfileparameterortheVI_CACERTFILEvariable.
Using the --thumbprint Option
Youcansupplythethumbprintforthetargetserver(ESXihostorvCenterServersystem)inthe--thumbprint
parameter(VI_THUMBPRINTvariable).
Whenyourunacommand,ESXCLIchecksfirstwhetheracertificatefileisavailable.Ifnot,ESXCLIchecks
whetherathumbprintofthetargetserverisavailable.Ifnot,anerrorlikethefollowingresults:
Connect to sof-40583-srv failed. Server SHA-1 thumbprint:
5D:01:06:63:55:9D:DF:FE:38:81:6E:2C:FA:71:BC:Usin63:82:C5:16:51 (not trusted).
Youcanrunthecommandwiththethumbprinttoestablishthetrustrelationship,oraddthethumbprintto
theVI_THUMBPRINTvariable.Forexample,usingthethumbprintoftheESXihostabove,youcanrunthe
followingcommand:
esxcli --server myESXi --username user1 --password 'my_password' --thumbprint
5D:01:06:63:55:9D:DF:FE:38:81:6E:2C:FA:71:BC:63:82:C5:16:51 storage nfs list
Using the Credential Store
YourvCLIinstallationincludesacredentialstore.Youcanmanagethecredentialstorewiththe
credstore-adminutilityapplication,whichislocatedinthe/Perl/apps/generaldirectoryinsidethe
VMwarevSphereCLIdirectory.
IMPORTANTUpdatingthecredentialstoreisatwostepprocess.Firstyouaddtheuserandpasswordforthe
server,andthenyouaddthethumbprintfortheserver.
Getting Started with vSphere Command-Line Interfaces
18 VMware, Inc.
To establish trust for a user with the credential store
1AddtheuserandpasswordforthetargetESXihosttothelocalcredentialstore.
credstore_admin.pl add --server <esxi_HOSTNAME_OR_IP> --username <user> --password <pwd>
2AddthethumbprintforthetargetESXihost.Thisthumbprintwasreturnedintheerrorwhenyou
attemptedtoconnecttothehost.
credstore_admin.pl add --server <esxi_HOSTNAME_OR_IP> --thumbprint <thumbprint>
3Ifyouareusinganondefaultcredentialstorefile,youhavetopassitinwiththe--credstoreoption.
Otherwise,thisuserwillbeabletoaccessthehostwithoutauthenticationgoingforward.
Using ESXCLI Output
ManyESXCLIcommandsgenerateoutputyoumightwanttouseinyourapplication.Youcanrunesxcli
withthe--formatterdispatcheroptionandsendtheresultingoutputasinputtoaparser.
The--formatteroptionssupportsthreevalues,csv,xml,andkeyvalueandisusedbeforeanynamespace.
esxcli --formatter=csv storage filesystem list
ListsallfilesysteminformationinCSVformat.
Youcanpipetheoutputtoafile.
esxcli --formatter=keyvalue storage filesystem list > myfilesystemlist.txt
Connection Options for vCLI Host Management Commands
YoucanrunhostmanagementcommandssuchasESXCLIcommands,vicfg‐commands,andother
commandswithseveraldifferentconnectionoptions.YoucantargethostsdirectlyortargetavCenterServer
systemandspecifythehostyouwanttomanage.IfyouaretargetingavCenterServersystem,specifythe
PlatformServicesController,whichincludesthevCenterSingleSignOnservice,forbestsecurity.
SeetheGettingStartedwithvSphereCommandLineInterfacesdocumentationforacompletelistandexamples.
Connection Options for DCLI Commands
DCLIisaCLIclienttothevCloudSuiteSDKinterfaceformanagingVMwareSDDCservices.ADCLI
commandtalkstoavCloudSuiteSDKendpointtogetthevCloudSuiteSDKcommandinformation,executes
thecommand,anddisplaysresulttotheuser.
YoucanrunDCLIcommandslocallyorfromanadministrationserver.
RunDCLIontheLinuxshellofavCenterServerVirtualAppliance.
InstallvCLIonasupportedWindowsorLinuxsystemandtargetavCenterServerwindowsinstallation
oravCenterServerVirtualAppliance.Youhavetoprovideendpointinformationtosuccessfullyrun
commands.
DCLIcommandssupportotherconnectionoptionsthanothercommandsinthecommandset.
SeetheGettingStartedwithvSphereCommandLineInterfacesdocumentationforacompletelistandexamples.
IMPORTANTAlwaysuseaformatterforconsistentoutput.
IMPORTANTForconnectionstoESXi6.0hosts,vCLIsupportsboththeIPv4protocolandtheIPv6protocol.
Forearlierversions,vCLIsupportsonlyIPv4.Inallcases,youcanconfigureIPv6onthetargethostwith
severalofthenetworkingcommands.
VMware, Inc. 19
Chapter 1 vSphere CLI Command Overviews
vCLI Host Management Commands and Lockdown Mode
Foradditionalsecurity,anadministratorcanplaceoneormorehostsmanagedbyavCenterServersystemin
lockdownmode.LockdownmodeaffectsloginprivilegesfortheESXihost.SeethevSphereSecuritydocument
inthevSphere6.0DocumentationCenterforadetaileddiscussionofnormallockdownmodeandstrict
lockdownmode,andofhowtoenableanddisablethem.
TomakechangestoESXisystemsinlockdownmode,youmustgothroughavCenterServersystemthat
managestheESXisystemastheuservpxuserandincludeboththe--serverandthe--vihostparameter..
esxcli --server MyVC --vihost MyESXi storage filesystem list
ThecommandpromptsforthevCenterServersystemusernameandpassword.
ThefollowingcommandscannotrunagainstvCenterServersystemsandarethereforenotavailablein
lockdownmode:
vifs
vicfg-user
vicfg-cfgbackup
vihostupdate
vmkfstools
IfyouhaveproblemsrunningacommandonanESXihostdirectly(withoutspecifyingavCenterServer
target),checkwhetherlockdownmodeisenabledonthathost.
Getting Started with vSphere Command-Line Interfaces
20 VMware, Inc.
VMware, Inc. 21
2
HostmanagementcommandscanstopandrebootESXihosts,backupconfigurationinformation,andmanage
hostupdates.YoucanalsouseahostmanagementcommandtomakeyourhostjoinanActiveDirectory
domainorexitfromadomain.
Thechapterincludesthefollowingtopics:
“Stopping,Rebooting,andExaminingHosts”onpage 21
“EnteringandExitingMaintenanceMode”onpage 22
“BackingUpConfigurationInformationwithvicfgcfgbackup”onpage 23
“ManagingVMkernelModules”onpage 24
“UsingvicfgauthconfigforActiveDirectoryConfiguration”onpage 25
“UpdatingHosts”onpage 26
ForinformationonupdatingESXi5.0hostswiththeesxcli softwarecommandandonchangingthehost
acceptanceleveltomatchthelevelofaVIBthatyoumightwanttouseforanupdate,seethevSphereUpgrade
documentationinthevSphere5.0DocumentationCenter.
Stopping, Rebooting, and Examining Hosts
Youcanstop,reboot,andexaminehostswithESXCLIorwithvicfg-hostops.
Stopping and Rebooting Hosts with ESXCLI
YoucanshutdownorrebootanESXihostusingthevSphereWebClientorvCLIcommands(ESXCLIor
vicfg-hostops).
ShuttingdownamanagedhostdisconnectsitfromthevCenterServersystem,butdoesnotremovethehost
fromtheinventory.Youcanshutdownasinglehostorallhostsinadatacenterorcluster.Specifyoneofthe
optionslistedin“ConnectionOptionsforvCLIHostManagementCommandsonpage 18inplaceof
<conn_options>.
Toshutdownahost,runesxcli system shutdown poweroff.Youmustspecifythe--reasonoptionand
supplyareasonfortheshutdown.A--delayoptionallowsyoutospecifyadelayinterval,inseconds.
Torebootahost,runsystem shutdown reboot. Youmustspecifythe--reasonoptionandsupplyareason
fortheshutdown.A--delayoptionallowsyoutospecifyadelayinterval,inseconds.
Stopping, Rebooting, and Examining Hosts with vicfg-hostops
YoucanshutdownorrebootanESXihostusingthevSphereWebClient,orESXCLIorthevicfg-hostops
vCLIcommand.
Managing Hosts 2
Getting Started with vSphere Command-Line Interfaces
22 VMware, Inc.
ShuttingdownamanagedhostdisconnectsitfromthevCenterServersystem,butdoesnotremovethehost
fromtheinventory.Youcanshutdownasinglehostorallhostsinadatacenterorcluster.Specifyoneofthe
optionslistedin“ConnectionOptionsforvCLIHostManagementCommandsonpage 18inplaceof
<conn_options>.
Singlehost.Runvicfg-hostopswith--operationshutdown.
Ifthehostisinmaintenancemode,runthecommandwithoutthe--forceoption.
vicfg-hostops <conn_options> --operation shutdown
Ifthehostisnotinmaintenancemode,use--forcetoshutdownthehostandallrunningvirtual
machines.
vicfg-hostops <conn_options> --operation shutdown --force
Allhostsindatacenterorcluster.Toshutdownallhostsinaclusterordatacenter,specify--cluster
or--datacenter.
vicfg-hostops <conn_options> --operation shutdown --cluster <my_cluster>
vicfg-hostops <conn_options> --operation shutdown --datacenter <my_datacenter>
Youcanrebootasinglehostorallhostsinadatacenterorcluster.
Singlehost.Runvicfg-hostopswith--operationreboot.
Ifthehostisinmaintenancemode,runthecommandwithoutthe--forceoption.
vicfg-hostops <conn_options> --operation reboot
Ifthehostisnotinmaintenancemode,use--forcetoshutdownthehostandallrunningvirtual
machines.
vicfg-hostops <conn_options> --operation reboot --force
Allhostsindatacenterorcluster.Youcanspecify--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
boottime.ThecommandalsoreturnswhethervMotionisenabledandwhetherthehostisinmaintenance
mode.
Entering and Exiting Maintenance Mode
YoucaninstructyourhosttoenterorexitmaintenancemodewithESXCLIorwithvicfg-hostops.
Entering and Exiting Maintenance Mode with ESXCLI
Youplaceahostinmaintenancemodetoserviceit,forexample,toinstallmorememory.Ahostentersor
leavesmaintenancemodeonlyastheresultofauserrequest.
esxcli system maintenanceMode setallowsyoutoenableordisablemaintenancemode.
Whenyourunthevicfg-hostopsvCLIcommand,youcanspecifyoneoftheoptionslistedin“Connection
OptionsforvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
To enter and exit maintenance mode
1Runesxcli <conn_options> system maintenanceMode set --enable true toentermaintenance
mode.
Afterallvirtualmachinesonthehosthavebeensuspendedormigrated,thehostentersmaintenance
mode.Youcannotdeployorpoweronavirtualmachineonhostsinmaintenancemode.
VMware, Inc. 23
Chapter 2 Managing Hosts
2Runesxcli <conn_options> system maintenanceMode set --enable false tohaveahost
existingmaintenancemode.
Ifyouattempttoexitmaintenancemodewhenthehostisnolongerinmaintenancemode,anerrorinforms
youthatmaintenancemodeisalreadydisabled.
Entering and Exiting Maintenance Mode with vicfg-hostops
Youplaceahostinmaintenancemodetoserviceit,forexample,toinstallmorememory.Ahostentersor
leavesmaintenancemodeonlyastheresultofauserrequest.
vicfg-hostopssuspendsvirtualmachinesbydefault,orpowersoffthevirtualmachineifyourun
vicfg-hostops --action poweroff.
ThehostisinastateofEnteringMaintenanceModeuntilallrunningvirtualmachinesaresuspendedor
migrated.Whenahostisenteringmaintenancemode,youcannotpoweronvirtualmachinesonitormigrate
virtualmachinestoit.
Whenyourunthevicfg-hostopsvCLIcommand,youcanspecifyoneoftheoptionslistedin“Connection
OptionsforvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
To enter maintenance mode
1Runvicfg-hostops <conn_options> --operation entertoentermaintenancemode.
2Runvicfg-hostops <conn_options> --operation infotocheckwhetherthehostisinmaintenance
modeorintheEnteringMaintenanceModestate.
Afterallvirtualmachinesonthehosthavebeensuspendedormigrated,thehostentersmaintenancemode.
Youcannotdeployorpoweronavirtualmachineonhostsinmaintenancemode.
Youcanputallhostsinaclusterordatacenterinmaintenancemodebyusingthe--clusteror
--datacenteroption.Donotusethoseoptionsunlesssuspendingallvirtualmachinesinthatclusterordata
centerisnoproblem.
Youcanlaterrunvicfg-hostops <conn_options> --operation exittoexitmaintenancemode.
Backing Up Configuration Information with vicfg-cfgbackup
AfteryouconfigureanESXihost,youcanbackupthehostconfigurationdata.Alwaysbackupyourhost
configurationafteryouchangetheconfigurationorupgradetheESXiimage.
Backup Tasks
Duringaconfigurationbackup,theserialnumberisbackedupwiththeconfiguration.Thenumberisrestored
whenyourestoretheconfiguration.ThenumberisnotpreservedwhenyouruntheRecoveryCD(ESXi
Embedded)orperformarepairoperation(ESXiInstallable).
Youcanbackupandrestoreconfigurationinformationasfollows.
1 Backuptheconfigurationbyusingthevicfg-cfgbackupcommand.
2RuntheRecoveryCDorrepairoperation
3Restoretheconfigurationbyusingthevicfg-cfgbackupcommand.
Whenyourestoreaconfiguration,youmustmakesurethatallvirtualmachinesonthehostarestopped.
NOTEvicfg-hostopsdoesnotworkwithVMwareDRS.Virtualmachinesarealwayssuspended.
IMPORTANTThevicfg-cfgbackupcommandisavailableonlyforESXihosts.Thecommandisnotavailable
throughavCenterServersystemconnection.NoequivalentESXCLIcommandissupported.
Getting Started with vSphere Command-Line Interfaces
24 VMware, Inc.
Backing Up Configuration Data
Youcanbackupconfigurationdatabyrunningvicfg-cfgbackupwiththe-soption.
vicfg-cfgbackup <conn_options> -s /tmp/ESXi_181842_backup.txt
Forthebackupfilename,includethenumberofthebuildthatisrunningonthehostthatyouarebackingup.
IfyouarerunningvCLIonvMA,thebackupfileissavedlocallyonvMA.Backupfilescansafelybestored
locallybecausevirtualappliancesarestoredinthe/vmfs/volumes/<datastore>directoryonthehost,
whichisseparatefromtheESXiimageandconfigurationfiles.
Restoring Configuration Data
Ifyouhavecreatedabackup,youcanlaterrestoreESXiconfigurationdata.Whenyourestoreconfiguration
data,thenumberofthebuildrunningonthehostmustbethesameasthenumberofthebuildthatwas
runningwhenyoucreatedthebackupfile.Tooverridethisrequirement,includethe-f (force)option.
To restore ESXi configuration data
1Poweroffallvirtualmachinesthatarerunningonthehostthatyouwanttorestore.
2LogintoahostonwhichvCLIisinstalled,orlogintovMA.
3Runvicfg-cfgbackupwiththe-lflagtoloadthehostconfigurationfromthespecifiedbackupfile.
Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”on
page 18inplaceof<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,youcanrunvicfg-cfgbackupfromavMAinstance.ThevMAinstancecan
runonthetargethost(thehostthatyouarebackinguporrestoring),oronaremotehost.
Torestoreahostconfiguration,youmustrunvicfg-cfgbackup fromavMAinstancerunningonaremote
host.Thehostmustbeinmaintenancemode,whichmeansallvirtualmachines(includingvMA)mustbe
suspendedonthetargethost.
Forexample,abackupoperationfortwoESXihosts(host1andhost2)withvMAdeployedonbothhostsworks
asfollows:
Tobackuponeofthehost’sconfiguration(host1orhost2),runvicfg-cfgbackupfromthevMA
appliancerunningoneitherhost1orhost2.Usethe--serveroptiontospecifythehostforwhichyou
wantbackupinformation.TheinformationisstoredonvMA.
Torestorethehost1configuration,runvicfg-cfgbackupfromthevMAappliancerunningonhost2.Use
the--serveroptiontopointtohost1torestoretheconfigurationtothathost.
Torestorethehost2configuration,runvicfg-cfgbackupfromthevMAappliancerunningonhost1.Use
the--serveroptiontopointtohost2torestoretheconfigurationtothathost.
Managing VMkernel Modules
Theesxcli system moduleandvicfg-modulecommandssupportsettingandretrievingVMkernelmodule
options.
VMware, Inc. 25
Chapter 2 Managing Hosts
vicfg-moduleandesxcli system modulecommandsareimplementationsofthedeprecated
esxcfg-moduleserviceconsolecommand.Thetwocommandssupportmostoftheoptionsesxcfg-module
supports.vicfg-moduleandesxcli system modulearecommonlyusedwhenVMwareTechnicalSupport,
aKnowledgeBasearticle,orVMwaredocumentationinstructyoutodoso.
Managing Modules with esxcli system module
NotallVMkernelmoduleshavesettablemoduleoptions.Thefollowingexampleillustrateshowtoexamine
andenableaVMkernelmodule.Specifyoneoftheconnectionoptionslistedin“ConnectionOptionsforvCLI
HostManagementCommands”onpage 18inplaceof<conn_options>.
To examine, enable, and set a VMkernel modules
1Listinformationaboutthemodule.
esxcli <conn_options> system module list -module=module_name
Thesystemreturnsthename,type,value,anddescriptionofthemodule.
2 (Optional)Listallenabledorloadedmodules.
esxcli <conn_options> system module list --enabled=true
esxcli <conn_options> system module list --loaded=true
3Enablethemodel.
esxcli <conn_options> system module set --module=module_name --enabled=true
4Settheparameter.
esxcli system module parameters set --module module_name
--parameter-string="parameter_string"
5Verifythatthemoduleisconfigured.
esxcli <conn_options> system module parameters list --module=module_name
Managing Modules with vicfg-module
NotallVMkernelmoduleshavesettablemoduleoptions.Thefollowingexampleillustrateshowtheexamine
andenableaVMkernelmodules.Specifyoneoftheconnectionoptionslistedin“ConnectionOptionsforvCLI
HostManagementCommands”onpage 18inplaceof<conn_options>.
To examine and set a VMkernel modules
1Runvicfg-module --listtolistthemodulesonthehost.
vicfg-module <conn_options> --list
2Runvicfg-module --set-optionswithconnectionoptions,theoptionstringtobepassedtoamodule,
andthemodulename.Forexample:
vicfg-module <conn_options> --set-options '<parameter_name>=<value>' <module_name>
Toretrievetheoptionstringthatisconfiguredtobepassedtoamodulewhenthemoduleisloaded,run
vicfg-module --get-options.Thisstringisnotnecessarilytheoptionstringcurrentlyinusebythe
module.
vicfg-module <conn_options> --get-options module_name
Verifiesthatamoduleisconfigured.
Using vicfg-authconfig for Active Directory Configuration
ESXicanbeintegratedwithActiveDirectory.ActiveDirectoryprovidesauthenticationforalllocalservices
andforremoteaccessthroughthevSphereWebServicesSDK,vSphereWebClient,PowerCLI,andvSphere
CLI.YoucanconfigureActiveDirectorysettingswiththevSphereWebClient,asdiscussedinthevCenter
ServerandHostManagementdocumentation,orusevicfg-autconfig.
Getting Started with vSphere Command-Line Interfaces
26 VMware, Inc.
vicfg-authconfigallowsyoutoremotelyconfigureActiveDirectorysettingsonESXihosts.Youcanlist
supportedandactiveauthenticationmechanisms,listthecurrentdomain,andjoinorpartfromanActive
Directorydomain.BeforeyourunthecommandonanESXihost,youmustpreparethehost.
To prepare ESXi hosts for Active Directory Integration
1MakesuretheESXisystemandtheActiveDirectoryserverareusingthesametimezonebyconfiguring
ESXiandADtousesameNTPserver.
TheESXisystem’stimezoneisalwayssettoUTC.
2ConfiguretheESXisystem’sDNStobeintheActiveDirectorydomain.
Youcanrunvicfg-authconfigtoaddthehosttothedomain.Auserwhorunsvicfg-authconfigto
configureActiveDirectorysettingsmusthavetheappropriateActiveDirectorypermissions,andmusthave
administrativeprivilegesontheESXihost.Youcanrunthecommanddirectlyagainstthehostoragainsta
vCenterServersystem,specifyingthehostwith--vihost.
To set up Active Directory
1InstalltheESXihost,asexplainedinthevSphereInstallationandSetupdocumentation.
2InstallWindowsActiveDirectoryonaWindowsServerthatrunsWindows2000,Windows2003,or
Windows2008.SeetheMicrosoftWebsiteforinstructionsandbestpractices.
3SynchronizetimebetweentheESXisystemandWindowsActiveDirectory(AD).
4TestthattheWindowsADServercanpingtheESXihostbyusingthehostname.
ping <ESX_hostname>
5Runvicfg-authconfigtoaddthehosttotheActiveDirectorydomain.
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.
6CheckthataSuccessfully Joined <Domain Name>messageappears.
7VerifytheESXihostisintheintendedWindowsADdomain.
vicfg-authconfig --server XXX.XXX.XXX.XXX --authscheme AD -c
YouarepromptedforausernameandpasswordfortheESXisystem.
Updating Hosts
Whenyouaddcustomdriversorpatchestoahost,theprocessiscalledanupdate.
UpdateESXi4.0andESXi4.1hostswiththevihostupdatecommand,asdiscussedinthevSphere
CommandLineInterfaceInstallationandReferenceGuideincludedinthevSphere4.1documentationset.
UpdateESXi5.0hostswithesxcli software vibcommandsdiscussedinthevSphereUpgrade
documentationincludedinthevSphere5.0documentationset.Youcannotrunthevihostupdate
commandagainstESXi5.0orlater.
UpdateESXi5.1hostswithesxcli software vibcommandsdiscussedinthevSphereUpgrade
documentationincludedinthevSphere5.1documentationset.
IMPORTANTAllhoststhatjoinActiveDirectorymustalsobemanagedbyanNTPServertoavoidissueswith
clockskewsandKerberostickets.
VMware, Inc. 27
Chapter 2 Managing Hosts
UpdateESXi5.5hostswithesxcli software vibcommandsdiscussedinthevSphereUpgrade
documentationincludedinthevSphere5.5documentationset.
UpdateESXi6.0hostswithesxcli software vibcommandsdiscussedinthevSphereUpgrade
documentationincludedinthevSphere6.0documentationset.
Getting Started with vSphere Command-Line Interfaces
28 VMware, Inc.
VMware, Inc. 27
3
ThevSphereCLIincludestwocommandsforfilemanipulation.vmkfstoolsallowsyoutomanipulateVMFS
(VirtualMachineFileSystem)andvirtualdisks.vifssupportsremoteinteractionwithfilesonyourESXihost.
Thischapterincludesthefollowingtopics:
“IntroductiontoVirtualMachineFileManagement”onpage 27
“ManagingtheVirtualMachineFileSystemwithvmkfstools”onpage 28
“UpgradingVMFS3VolumestoVMFS5”onpage 29
“ManagingVMFSVolumesonpage 29
“ReclaimingUnusedStorageSpace”onpage 31
“UsingvifstoViewandManipulateFilesonRemoteESXiHosts”onpage 32
Introduction to Virtual Machine File Management
YoucanusethevSphereWebClientorvCLIcommandstoaccessdifferenttypesofstoragedevicesthatyour
ESXihostdiscoversandtodeploydatastoresonthosedevices.
Dependingonthetypeofstorageyouuse,datastorescanbebackedbythefollowingfilesystemformats:
VirtualMachineFileSystem(VMFS).Highperformancefilesystemthatisoptimizedforstoringvirtual
machines.YourhostcandeployaVMFSdatastoreonanySCSIbasedlocalornetworkedstoragedevice,
includingFibreChannelandiSCSISANequipment.AsanalternativetousingtheVMFSdatastore,your
virtualmachinecanhavedirectaccesstorawdevicesanduseamappingfile(RDM)asaproxy.
YoumanageVMFSandRDMswiththevSphereWebClient,orthevmkfstoolscommand.
NetworkFileSystem(NFS).TheNFSclientbuiltintoESXiusestheNetworkFileSystem(NFS)protocol
overTCP/IPtoaccessadesignatedNFSvolumethatislocatedonaNASserver.TheESXihostcanmount
thevolumeanduseitforitsstorageneeds.vSpheresupportsversion3and4.1oftheNFSprotocol.
Typically,theNFSvolumeordirectoryiscreatedbyastorageadministratorandisexportedformtheNFS
server.TheNFSvolumesdonotneedtobeformattedwithalocalfilesystem,suchasVMFS.Youcan
mountthevolumesdirectlyandusethemtostoreandbootvirtualmachinesinthesamewaythatyouuse
VMFSdatastores.ThehostcanaccessadesignatedNFSvolumelocatedonanNFSserver,mountthe
volume,anduseitforanystorageneeds.
Managing Files 3
NOTESee“ManagingStorage”onpage 37forinformationaboutstoragemanipulationcommands.
NOTEDatastoresarelogicalcontainers,analogoustofilesystems,thathidespecificsofeachstoragedevice
andprovideauniformmodelforstoringvirtualmachinefiles.DatastorescanbeusedforstoringISOimages,
virtualmachinetemplates,andfloppyimages.ThevSphereWebClientusesthetermdatastoreexclusively.
ThismanualusesthetermdatastoreandVMFS(orNFS)volumetorefertothesamelogicalcontaineronthe
physicaldevice.
Getting Started with vSphere Command-Line Interfaces
28 VMware, Inc.
YoumanageNASstoragedevicesfromthevSphereWebClientorwiththeesxcli storage nfs
command.Thediagrambelowillustratesdifferenttypesofstorage,butitisforconceptualpurposesonly.
Itisnotarecommendedconfiguration.
Figure 3-1. Virtual Machines Accessing Different Types of Storage
Managing the Virtual Machine File System with vmkfstools
VMFSdatastoresprimarilyserveasrepositoriesforvirtualmachines.Youcanstoremultiplevirtualmachines
onthesameVMFSvolume.Eachvirtualmachine,encapsulatedinasetoffiles,occupiesaseparatesingle
directory.Fortheoperatingsysteminsidethevirtualmachine,VMFSpreservestheinternalfilesystem
semantics.
Inaddition,youcanusetheVMFSdatastorestostoreotherfiles,suchasvirtualmachinetemplatesandISO
images.VMFSsupportsfileandblocksizesthatenablevirtualmachinestorundataintensiveapplications,
includingdatabases,ERP,andCRM,invirtualmachines.SeethevSphereStoragedocumentation.
YouusethevmkfstoolsvCLItocreateandmanipulatevirtualdisks,filesystems,logicalvolumes,and
physicalstoragedevicesonanESXihost.Youcanusevmkfstoolstocreateandmanageavirtualmachinefile
system(VMFS)onaphysicalpartitionofadiskandtomanipulatefiles,suchasvirtualdisks,storedon
VMFS3andNFS.Youcanalsousevmkfstoolstosetupandmanagerawdevicemappings(RDMs).
ThevSphereStoragedocumentationincludesacompletereferencetothevmkfstoolscommandthatyoucan
useintheESXiShell.YoucanusemostofthesameoptionswiththevmkfstoolsvCLIcommand.Specifyone
oftheconnectionoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18
inplaceof<conn_options>.
ThefollowingoptionssupportedbythevmkfstoolsESXiShellcommandarenotsupportedbythe
vmkfstoolsvCLIcommand.
--breaklock -B
--chainConsistent -e
--eagerzero -k
--fix -x
--lock -L
iSCSI array NAS appliancefibre array
Host
VMFS
local
ethernet
SCSI
VMFS VMFS NFS
virtual
machine
virtual
machine
virtual
machine
virtual
machine
virtual
machine
SAN LAN LAN LAN
iSCSI
hardware
initiator
fibre
channel
HBA
ethernet
NIC
ethernet
NIC
software
initiator
requires TCP/IP connectivity
Key
physical
disk
datastore
virtual
disk
IMPORTANTThevmkfstoolsvCLIsupportsmostbutnotalloftheoptionsthatthevmkfstoolsESXiShell
commandsupports.SeeVMwareKnowledgeBasearticle1008194.
Youcannotrunvmkfstoolswith--serverpointingtoavCenterServersystem.
VMware, Inc. 29
Chapter 3 Managing Files
--migratevirtualdisk -M
--parseimage -Y
--punchzero -K
--snapshotdisk -I
--verbose -v
Upgrading VMFS3 Volumes to VMFS5
vSphere5.0supportsVMFS5volumes,whichhaveimprovedscalabilityandperformance.Youcanupgrade
fromVMFS3toVMFS5byusingthevSphereWebClient,thevmkfstoolsESXiShellcommand,ortheesxcli
storage vmfs upgradecommand.PassthevolumelabelorthevolumeUUIDtotheESXCLIcommand.
Managing VMFS Volumes
Differentcommandsareavailableforlisting,mounting,andunmountingVMFSvolumesandforlisting,
mounting,andunmountingVMFSsnapshotvolumes.
ManagingVMFSvolumes
esxcli storage filesystem listshowsallvolumes,mountedandunmounted,thatareresolved,
thatis,thatarenotsnapshotvolumes.
esxcli storage filesystem unmountunmountsacurrentlymountedfilesystem.Usethiscommand
forsnapshotvolumesorresolvedvolumes.
Managingsnapshotvolumes
esxcli storage vmfs snapshotcommandscanbeusedforlisting,mounting,andresignaturing
snapshotvolumes.See“MountingDatastoreswithExistingSignatures”onpage 29and“Resignaturing
VMFSCopies”onpage 30.
Managing Duplicate VMFS Datastores
EachVMFSdatastorecreatedinaLUNhasauniqueUUIDthatisstoredinthefilesystemsuperblock.When
theLUNisreplicatedorwhenasnapshotismade,theresultingLUNcopyisidentical,byteforbyte,tothe
originalLUN.Asaresult,iftheoriginalLUNcontainsaVMFSdatastorewithUUIDX,theLUNcopyappears
tocontainanidenticalVMFSdatastore,oraVMFSdatastorecopy,withthesameUUIDX.
ESXihostscandeterminewhetheraLUNcontainstheVMFSdatastorecopy,andeithermountthedatastore
copywithitsoriginalUUIDorchangetheUUIDtoresignaturethedatastore.
WhenaLUNcontainsaVMFSdatastorecopy,youcanmountthedatastorewiththeexistingsignatureor
assignanewsignature.ThevSphereStoragedocumentationdiscussesvolumeresignaturingindetail.
Mounting Datastores with Existing Signatures
YoucanmountaVMFSdatastorecopywithoutchangingitssignatureiftheoriginalisnotmounted.For
example,youcanmaintainsynchronizedcopiesofvirtualmachinesatasecondarysiteaspartofadisaster
recoveryplan.Intheeventofadisasterattheprimarysite,youcanmountthedatastorecopyandpoweron
thevirtualmachinesatthesecondarysite.
WhenyoumounttheVMFSdatastore,ESXiallowsbothreadandwriteoperationstothedatastorethatresides
ontheLUNcopy.TheLUNcopymustbewritable.Thedatastoremountsarepersistentandvalidacross
systemreboots.
IMPORTANTYoucannotupgradeVMFS3volumestoVMFS5withthevmkfstoolscommandincludedin
vSphereCLI.
IMPORTANTYoucanmountaVMFSdatastoreonlyifitdoesnotconflictwithanalreadymountedVMFS
datastorethathasthesameUUID.
Getting Started with vSphere Command-Line Interfaces
30 VMware, Inc.
Youcanmountadatastorewithvicfg-volume(see“Tomountadatastorewithvicfgvolume”onpage 30)or
withESXCLI(see“TomountadatastorewithESXCLI”onpage 30).
Mounting and Unmounting with ESXCLI
Theesxcli storage filesystemcommandssupportmountingandunmountingvolumes.Youcanalso
specifywhethertopersistthemountedvolumesacrossrebootsbyusingthe--no-persistoption.
Usetheesxcli storage filesystemcommandtolistmountedvolumes,mountnewvolumes,and
unmountavolume.Specifyoneoftheconnectionoptionslistedin“ConnectionOptionsforvCLIHost
ManagementCommandsonpage 18inplaceof<conn_options>.
To mount a datastore with ESXCLI
1Listallvolumesthathavebeendetectedassnapshots.
esxcli <conn_options> storage filesystem list
2Runesxcli storage filesystem mountwiththevolumelabelorvolumeUUID.
Bydefault,thevolumeismountedpersistently;use--no-persisttomountnonpersistently.
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.
Specifyoneoftheconnectionoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”
onpage 18inplaceof<conn_options>.
To mount a datastore with vicfg-volume
1Listallvolumesthathavebeendetectedassnapshotsorreplicas.
vicfg-volume <conn_options> --list
2Runvicfg-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
volume.Youcanalsomakethemountedvolumepersistentacrossrebootsandqueryalistofsnapshot
volumesandoriginalvolumes.
Resignaturing VMFS Copies
UsedatastoreresignaturingtoretainthedatastoredontheVMFSdatastorecopy.WhenresignaturingaVMFS
copy,theESXihostassignsanewUUIDandanewlabeltothecopy,andmountsthecopyasadatastore
distinctfromtheoriginal.BecauseESXipreventsyoufromresignaturingthemounteddatastore,unmountthe
datastorebeforeresignaturing.
Thedefaultformatofthenewlabelassignedtothedatastoreissnap-<snapID>-<oldLabel>,where
<snapID>isanintegerand<oldLabel>isthelabeloftheoriginaldatastore.
VMware, Inc. 31
Chapter 3 Managing Files
Whenyouperformdatastoreresignaturing,considerthefollowingpoints:
Datastoreresignaturingisirreversible.
TheLUNcopythatcontainstheVMFSdatastorethatyouresignatureisnolongertreatedasaLUNcopy.
Aspanneddatastorecanberesignaturedonlyifallitsextentsareonline.
Theresignaturingprocessiscrashandfaulttolerant.Iftheprocessisinterrupted,youcanresumeitlater.
YoucanmountthenewVMFSdatastorewithoutariskofitsUUIDconflictingwithUUIDsofanyother
datastore,suchasanancestororchildinahierarchyofLUNsnapshots.
YoucanresignatureaVMFScopywithESXCLI(see“ResignaturingaVMFSCopywithESXCLI”onpage 31)
orwithvicfg-volumesee“ResignaturingaVMFSCopywithvicfgvolumeonpage 31.
Resignaturing a VMFS Copy with ESXCLI
Theesxcli storage vmfs snapshotcommandssupportresignaturingasnapshotvolume.Specifyoneof
theconnectionoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18in
placeof<conn_options>.
To resignature a VMFS copy with ESXCLI
1Listunresolvedsnapshotsorreplicavolumes.
esxcli <conn_options> storage vmfs snapshot list
2 (Optional)Unmountthecopy.
esxcli <conn_options> storage filesystem unmount
3Runtheresignaturecommand.
esxcli <conn_options> storage vmfs snapshot resignature
--volume-label=<label>|--volume-uuid=<id>
Thecommandreturnstothepromptorsignalsanerror.
Afterresignaturing,youmighthavetodothefollowing:
Iftheresignatureddatastorecontainsvirtualmachines,updatereferencestotheoriginalVMFSdatastore
inthevirtualmachinefiles,including.vmx,.vmdk,.vmsd,and.vmsn.
Topoweronvirtualmachines,registerthemwiththevCenterServersystem.
Resignaturing a VMFS Copy with vicfg-volume
Youcanusevicfg-volumetomount,unmount,andresignatureVMFSvolumes.
To resignature a VMFS copy with vicfg-volume
1Makesurethecopyisnotmounted.
2Runvicfg-volumewiththeresignatureoption.
vicfg-volume <conn_options> --resignature <VMFS-UUID|label>
Thecommandreturnstothepromptorsignalsanerror.
Reclaiming Unused Storage Space
WhenVMFSdatastoresresideonthinprovisionedLUNs,youcanuseESXCLIcommandstoreclaimthe
unusedlogicalblocksofathinprovisionedLUNformattedwithVMFS.
Whenyourunthecommands,youmustspecifythevolumelabel(--volume-label)orthevolumeid
(--volume-uuid)butyoucannotspecifyboth.
Getting Started with vSphere Command-Line Interfaces
32 VMware, Inc.
Ineachiteration,thecommandissuesunmapcommandstothenumberoffilesystemblocksthatarespecified
bytheoptionalreclaim-unitargument,whichdefaultsto200.FornewlycreatedVMFS5filesystems,the
filesystemblocksizeisalways1MB.ForVMFS3filesystemsorVMFS5filesystemsthatwereupgradedfrom
VMFS3,thefilesystemblocksizecouldbeoneof1,2,4,8MB.
Thefollowingexamplesillustratehowtousethecommand.
# esxcli storage vmfs unmap --volume-label datastore1 --reclaim-unit 100
# esxcli storage vmfs unmap -l datastore1 -n 100
# esxcli storage vmfs unmap --volume-uuid 515615fb-1e65c01d-b40f-001d096dbf97 --reclaim-unit 500
# esxcli storage vmfs unmap -u 515615fb-1e65c01d-b40f-001d096dbf97 -n 500
# esxcli storage vmfs unmap -l datastore1
# esxcli storage vmfs unmap -u 515615fb-1e65c01d-b40f-001d096dbf97
Using vifs to View and Manipulate Files on Remote ESXi Hosts
Youcanusethevifsutilityfordatastorefilemanagement.
Thevifscommandperformscommonoperationssuchascopy,remove,get,andputonESXifilesand
directories.ThecommandissupportedagainstESXihostsbutnotagainstvCenterServersystems.
SomesimilaritiesbetweenvifsandDOSorUNIX/Linuxfilesystemmanagementutilitiesexist,butthereare
manydifferences.Forexample,vifsdoesnotsupportwildcardcharactersorcurrentdirectoriesand,asa
result,relativepathnames.Usevifsonlyasdocumented.
Insteadofusingthevifscommand,youcanbrowsedatastorecontentsandhostfilesbyusingaWebbrowser.
Connecttothefollowinglocation:
http://ESX_host_IP_Address/host
http://ESX_host_IP_Address/folder
YoucanviewdatacenteranddatastoredirectoriesfromthisrootURL.Forexample:
http://<ESXi_addr>/folder?dcPath=ha-datacenter
http://<ESXi_host_name>/folder?dcPath=ha-datacenter
TheESXihostpromptsforausernameandpassword.
Thevifscommandsupportsdifferentoperationsforthefollowinggroupsoffilesanddirectories.Different
operationsareavailableforeachgroup,andyouspecifylocationswithadifferentsyntax.Thebehaviordiffers
forvSphere4.xandvSphere5.0.
CAUTIONIfyoumanipulatefilesdirectly,yourvSpheresetupmightendupinaninconsistentstate.Usethe
vSphereWebClientoroneoftheothervCLIcommandstomanipulatevirtualmachineconfigurationfilesand
virtualdisks.
vSphere 4.x vSphere 5.0
Host Hostconfigurationfiles.Youmustspecifythe
file’suniquenameidentifier.
Specifyhostlocationsbyusingthe
/host/<path>syntax.
Hostconfigurationfiles.Youmustspecifythe
file’suniquenameidentifier.
Specifyhostlocationsbyusingthe
/host/<path>syntax.
Youcannotlistsubdirectoriesof/host.
VMware, Inc. 33
Chapter 3 Managing Files
Toavoidproblemswithdirectorynamesthatusespecialcharactersorspaces,enclosethepathinquotesfor
bothoperatingsystems.
Whenyourunvifs,youcanspecifytheoperationnameandargumentandoneofthestandardconnection
options.Usealiases,symboliclinks,orwrapperscriptstosimplifytheinvocationsyntax.
Options
vifscommandspecificoptionsallowyoutoretrieveanduploadfilesfromtheremotehostandperforma
numberofotheroperations.Allvifsoptionsworkondatastorefilesordirectories.Someoptionsalsowork
onhostfilesandfilesinthetempdirectory.Youmustalsospecifyconnectionoptions.
Temp The/tmpdirectoryandfilesinthatdirectory.
Specifytemplocationsbyusingthe
/tmp/dir/subdirsyntax.
Notsupported.
Datastores Datastorefilesanddirectories.Youhavetwochoicesforspecifyingadatastore:
Datastoreprefixstyle:'[ds_name] relative_path'.Forexample:
'[myStorage1] testvms/VM1/VM1.vmx'(Linux) or "[myStorage1]
testvms/VM1/VM1.vmx" (Windows)
URLstyle:/folder/dir/subdir/file?dsName=<name>.Forexample:
'/folder/testvms/VM1/VM1.vmx?dsName=myStorage1' (Linux)
"/folder/testvms/VM1/VM1.vmx?dsName=myStorage1" (Windows)
Thetwoexamplepathsrefertoavirtualmachineconfigurationfileforthevirtualmachine
VM1inthetestvms/VM1directoryofthemyStorage1datastore.
IMPORTANTTheconceptsofworkingdirectoryandlastdirectoryorfileoperatedonarenotsupportedwith
vifs.
Command Description Target Syntax
--copy
-c <source>
<target>
Copiesafileinadatastoretoanotherlocation
inadatastore.The<source>mustbearemote
sourcepath,the<target>aremotetarget
pathordirectory.
The--forceoptionreplacesexisting
destinationfiles.
Datastore
Temp
copy src_file_path
dst_directory_path
[‐‐force]
copy src_file_path
dst_file_path [‐‐force]
--dir
-D <remote_dir>
Liststhecontentsofadatastoredirectory.Datastore
Temp
dir
datastore_directory_path
--force
-F
Overwritesthedestinationfile.Usedwith
--moveand--copy.
Datastore
Temp
copy src_file_path
dst_file_path [‐‐force]
--get
-g <remote_path>
<local_path>
DownloadsafilefromtheESXihosttothe
machineonwhichyourunvCLI.This
operationusesHTTP GET.
Datastore
Host
get src_dstore_file_path
dst_local_file_path
get src_d store_dir_path
dst_local_file_path
--listdc
-C
Liststhedatacenterpathsavailableonan
ESXisystem.
Datastore
Host
--listds
-S
ListsthedatastorenamesontheESXisystem.
Whenmultipledatacentersareavailable,use
the--dc (-Z)argumenttospecifythename
ofthedatacenterfromwhichyouwanttolist
thedatastore.
Datastore
Host
vifs --listds
--mkdir
-M <remote_dir>
Createsadirectoryinadatastore.This
operationfailsiftheparentdirectoryof
dst_datastore_file_pathdoesnotexist.
Datastore
Temp
mkdir dst_directory_path
vSphere 4.x vSphere 5.0
Getting Started with vSphere Command-Line Interfaces
34 VMware, Inc.
Examples
YoucanusevifstointeractwiththeremoteESXiorvCenterServersysteminavarietyofways.Specifyone
oftheconnectionoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18
inplaceof<conn_options>.TheexamplesillustrateuseonaLinuxsystem,usedoublequotesinsteadof
singlequoteswhenonaWindowssystem.
Listing Remote Information
ListalldatacentersonavCenterServersystemwith--listdc,using--servertopointtothevCenter
Serversystem.
vifs --server <my_vc>--username administrator --password <pswd> --listdc
ListalldatastoresonavCenterServersystemwith--listds.
vifs --server <my_vc> --username administrator --password <pswd> --dc kw-dev --listds
ListalldatastoresonanESXihostwith--listds.
vifs --server <my_ESXi> --username root --password <pswd> --listds
Thecommandliststhenamesofalldatastoresonthespecifiedserver.
Youcanuseeachnamethathasbeenreturnedtorefertodatastorepathsbyusingsquarebracketnotation,
asfollows:
'[my_datastore] dir/subdir/file'
Listthecontentofadirectoryinadatastore.
vifs --server <my_ESXi> --username root --password <pswd>--dir '[Storage1]'
vifs --server <my_ESXi> --username root --password <pswd> --dir '[Storage1] WindowsXP'
Thecommandliststhedirectorycontent.Inthisexample,thecommandliststhecontentsofavirtual
machinedirectory.
Content Listing
_________________
vmware-37.log
vmware-38.log
...
vmware.log
...
winxpPro-sp2.vmdk
winxpPro-sp2.vmx
winxpPro-sp2.vmxf
...
Listthecontentsofoneofthedatastores.
--move
-m <source>
<target>
Movesafileinadatastoretoanotherlocation
inadatastore.The<source>mustbearemote
sourcepath,the<target>aremotetarget
pathordirectory.
The--forceoptionreplacesexisting
destinationfiles.
Datastore
Temp
move src_file_path
dst_directory_path
[‐‐force]
move src_file_path
dst_file_path [‐‐force]
--put
-p <local_path>
<remote_path>
Uploadsafilefromthemachineonwhichyou
runvCLItotheESXihost.Thisoperationuses
HTTP PUT.
Thiscommandcanreplaceexistinghostfiles
butcannotcreatenewfiles.
Datastore
Host
Temp
put src_local_file_path
dst_file_path
put src_local_file_path
dst_directory_path
--rm
-r <remote_path>
Deletesadatastorefile.Datastore
Temp
rm dst_file_path
--rmdir
-R <remote_dir>
Deletesadatastoredirectory.Thisoperation
failsifthedirectoryisnotempty.
Datastore
Temp
rmdir dst_directory_path
Command Description Target Syntax
VMware, Inc. 35
Chapter 3 Managing Files
vifs <conn_options> --dir '[osdc-cx700-02]'
Thecommandliststhecompletecontentsofthedatastore.
Working with Directories and Files on the Remote Server
Createanewdirectoryinadatastorewith--mkdir <remote_dir>.
vifs --server <my_ESXi> --username root --password <pswd> --mkdir '[Storage1] test'
Removeadirectorywith--rmdir <remote_dir>.
vifs --server <my_ESXi> --username root --password <pswd> --rmdir '[Storage1] test'.
Forciblyremoveadirectorywith--rmdir --force <remote_dir>.
vifs --server <my_ESXi> --username root --password <pswd> --rmdir '[Storage1] test2' --force
Updateafileontheremoteserverwith--put <local_path> <remote_path>.
vifs --server <my_ESXi> --username root --password <pswd>
--put /tmp/testfile '[Storage1] test/testfile'
Retrieveafilefromtheremoteserverwith--get <remote_path> <local_path>|<local_dir>.The
commandoverwritesthelocalfileifitexists.Ifyoudonotspecifyafilename,thefilenameoftheremote
fileisused.
vifs --server <my_ESXi> --username root --password <pswd> --get '[Storage1] test/testfile'
/tmp/tfile
vifs --server <my_ESXi> --username root --password <pswd> --get '[Storage1] test/testfile'
/tmp
Deleteafileontheremoteserverwith-rm <remote_path>.
vifs --server <my_ESXi> --username root --password <pswd> --rm '[Storage1] test2/testfile'
Forciblyremoveafileontheremoteserverwith--rm <remote_path> --force.
vifs --server <my_ESXi> --username root --password <pswd> --rm '[Storage1] test2/testfile2'
--force
Moveafilefromonelocationontheremoteservertoanotherlocationwith--move
<remote_source_path> <remote_target_path>.Ifyouspecifyafilename,thefileismovedand
renamedatthesametime.
vifs --server <my_ESXi> --username root --password <pswd> --move '[Storage1] test/tfile'
'[Storage1] newfile'
Ifthetargetfilealreadyexistsontheremoteserver,thecommandfailsunlessyouuse--force.
vifs --server <my_ESXi> --username root --password <pswd> --move '[Storage1] test/tfile2'
'[Storage1] test2/tfile' --force
Createacopyofafileontheremoteserveratadifferentlocationontheremoteserver.
vifs --server <my_ESXi> --username root --password <pswd> --copy '[Storage1] test/tfile'
'[Storage1] test/tfile2'
Ifthetargetfilealreadyexistsontheremoteserver,thecommandfailsunlessyouuse--force.
vifs --server <my_ESXi> --username root --password <pswd> --copy '[Storage1] test/tfile'
'[Storage1] test/tfile2' --force
Example Scenario
Thefollowingexamplescenarioillustratesotherusesofvifs.Specifyoneoftheconnectionoptionslistedin
“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof<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.
Getting Started with vSphere Command-Line Interfaces
36 VMware, Inc.
2Placeafilethatisonthesystemfromwhichyouarerunningthecommandsintothenewlycreated
directory.
vifs <conn_options> --put /tmp/test_doc '[osdc-cx700-03] vcli_test/test_doc'
3Moveafileintoavirtualmachinedirectory.
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/vmware.log' ~user1/vmware.log
5Cleanupbyremovingthefileanddirectoryyoucreatedearlier.
vifs <conn_options> --rm '[osdc-cx700-03] vcli_test/test_doc'
vifs <conn_options> --rmdir '[osdc-cx700-03] vcli_test'
VMware, Inc. 37
4
Avirtualmachineusesavirtualdisktostoreitsoperatingsystem,programfiles,andotherdataassociated
withitsactivities.Avirtualdiskisalargephysicalfile,orasetoffiles,thatcanbecopied,moved,archived,
andbackedup.
Tostorevirtualdiskfilesandmanipulatethefiles,ahostrequiresdedicatedstoragespace.ESXistorageis
storagespaceonavarietyofphysicalstoragesystems,localornetworked,thatahostusestostorevirtual
machinedisks.
Thischapterincludesthefollowingtopics:
“IntroductiontoStorage”onpage 37
“ExaminingLUNs”onpage 40
“DetachingDevicesandRemovingaLUN”onpage 43
“WorkingwithPermanentDeviceLoss”onpage 43
“ManagingPathsonpage 44
“ManagingPathPolicies”onpage 47
“ManagingNFS/NASDatastores”onpage 51
“MonitoringandManagingSANStorage”onpage 53
“MonitoringandManagingVirtualSANStorage”onpage 53
“MonitoringvSphereFlashReadCache”onpage 54
“MonitoringandManagingVirtualVolumesonpage 55
“MigratingVirtualMachineswithsvmotion”onpage 56
“ConfiguringFCoEAdapters”onpage 57
“ScanningStorageAdapters”onpage 58
“RetrievingSMARTInformation”onpage 58
Chapter 5,“ManagingiSCSIStorage,”onpage 59discussesiSCSIstoragemanagement.Chapter 6,“Managing
ThirdPartyStorageArrays,”onpage 87explainshowtomanagethePluggableStorageArchitecture,
includingPathSelectionPlugin(PSP)andStorageArrayTypePlugin(SATP)configuration.
ForinformationonmaskingandunmaskingpathswithESXCLI,seethevSphereStoragedocumentation.
Introduction to Storage
FibreChannelSANarrays,iSCSISANarrays,andNASarraysarewidelyusedstoragetechnologiessupported
byVMwarevSpheretomeetdifferentdatacenterstorageneeds.Thestoragearraysareconnectedtoand
sharedbetweengroupsofserversthroughstorageareanetworks.Thisarrangementallowsaggregationofthe
storageresourcesandprovidesmoreflexibilityinprovisioningthemtovirtualmachines.
Managing Storage 4
Getting Started with vSphere Command-Line Interfaces
38 VMware, Inc.
Figure 4-1. vSphere Data Center Physical Topology
How Virtual Machines Access Storage
Avirtualdiskhidesthephysicalstoragelayerfromthevirtualmachine’soperatingsystem.Regardlessofthe
typeofstoragedevicethatyourhostuses,thevirtualdiskalwaysappearstothevirtualmachineasamounted
SCSIdevice.Asaresult,youcanrunoperatingsystemsthatarenotcertifiedforspecificstorageequipment,
suchasSAN,inthevirtualmachine.
Whenavirtualmachinecommunicateswithitsvirtualdiskstoredonadatastore,itissuesSCSIcommands.
Becausedatastorescanexistonvarioustypesofphysicalstorage,thesecommandsareencapsulatedintoother
forms,dependingontheprotocolthattheESXihostusestoconnecttoastoragedevice.
Figure 42depictsfivevirtualmachinesthatusedifferenttypesofstoragetoillustratethedifferencesbetween
eachtype.
Figure 4-2. Virtual Machines Accessing Different Types of Storage
server
group 1
virtual machines
server
group 2
server
group 3
fibre channel
storage array
iSCSI
storage array
NAS
storage array
vCenter Server terminal
Web access
vSphere Client
fibre channel switch fabric / IP network
ESX/ESXi
VM VM VM
VM VM VM
iSCSI array NAS appliancefibre array
Host
VMFS
local
ethernet
SCSI
VMFS VMFS NFS
virtual
machine
virtual
machine
virtual
machine
virtual
machine
virtual
machine
SAN LAN LAN LAN
iSCSI
hardware
initiator
fibre
channel
HBA
ethernet
NIC
ethernet
NIC
software
initiator
requires TCP/IP connectivity
Key
physical
disk
datastore
virtual
disk
VMware, Inc. 39
Chapter 4 Managing Storage
YoucanusevCLIcommandstomanagethevirtualmachinefilesystemandstoragedevices.
VMFS.Usevmkfstoolstocreate,modify,andmanageVMFSvirtualdisksandrawdevicemappings.
See“ManagingtheVirtualMachineFileSystemwithvmkfstools”onpage 28foranintroductionandthe
vSphereStoragedocumentationforadetailedreference.
Datastores.Severalcommandsallowyoutomanagedatastoresandareusefulformultipleprotocols.
LUNs.Useesxcli storage coreorvicfg-scsidevscommandstodisplayavailableLUNsand
mappingsforeachVMFSvolumetoitscorrespondingpartition.See“ExaminingLUNs”onpage 40.
Pathmanagement.Useesxcli storage coreorvicfg-mpathcommandstolistinformationabout
FibreChanneloriSCSILUNsandtochangeapath’sstate.See“ManagingPaths”onpage 44.Usethe
ESXCLIcommandtoviewandmodifypathpolicies.See“ManagingPathPoliciesonpage 47.
Rescan.Useesxcli storage coreorvicfg-rescanadapter rescantoperformarescan
operationeachtimeyoureconfigureyourstoragesetup.See“ScanningStorageAdapters”on
page 58.
Storagedevices.Severalcommandsmanageonlyspecificstoragedevices.
NFSstorage.Useesxcli storage nfsorvicfg-nastomanageNASstoragedevices.See
“ManagingNFS/NASDatastores”onpage 51.
iSCSIstorage.Useesxcli iscsiorvicfg-iscsitomanagebothhardwareandsoftwareiSCSI.
See“ManagingiSCSIStorageonpage 59.
Softwaredefinedstorage.vSpheresupportsseveraltypesofsoftwaredefinedstorage.
VirtualSANstorage.Usecommandsintheesxcli vsannamespacetomanageVirtualSAN.See
“MonitoringandManagingVirtualSANStorage”onpage 53.
VirtualFlashstorage.Usecommandsintheesxcli storage vflashnamespacetomanage
VMwarevSphereFlashReadCache.
Virtualvolumes.Virtualvolumesofferadifferentlayerofabstractionthandatastores.Asaresult,
finergrainedmanagementispossible..Usecommandsintheesxcli storage vvolnamespace.
Datastores
ESXihostsusestoragespaceonavarietyofphysicalstoragesystems,includinginternalandexternaldevices
andnetworkedstorage.Ahostcandiscoverstoragedevicestowhichithasaccessandformatthemas
datastores.Eachdatastoreisaspeciallogicalcontainer,analogoustoafilesystemonalogicalvolume,where
thehostplacesvirtualdiskfilesandothervirtualmachinefiles.Datastoreshidespecificsofeachstorage
productandprovideauniformmodelforstoringvirtualmachinefiles.
Dependingonthetypeofstorageyouuse,datastorescanbebackedbythefollowingfilesystemformats:
VirtualMachineFileSystem(VMFS).Highperformancefilesystemoptimizedforstoringvirtual
machines.YourhostcandeployaVMFSdatastoreonanySCSIbasedlocalornetworkedstoragedevice,
includingFibreChannelandiSCSISANequipment.
AsanalternativetousingtheVMFSdatastore,yourvirtualmachinecanhavedirectaccesstorawdevices
anduseamappingfile(RDM)asaproxy.See“ManagingtheVirtualMachineFileSystemwith
vmkfstools”onpage 28.
NetworkFileSystem(NFS).FilesystemonaNASstoragedevice.ESXisupportsNFSversion3over
TCP/IP.ThehostcanaccessadesignatedNFSvolumelocatedonanNFSserver,mountthevolume,and
useitforanystorageneeds.
Storage Device Naming
Eachstoragedevice,orLUN,isidentifiedbyseveraldeviceidentifiernames.
Getting Started with vSphere Command-Line Interfaces
40 VMware, Inc.
Device Identifiers
Dependingonthetypeofstorage,theESXihostusesdifferentalgorithmsandconventionstogeneratean
identifierforeachstoragedevice.
SCSIINQUIRYidentifiers.ThehostusestheSCSIINQUIRYcommandtoqueryastoragedeviceand
usestheresultingdata,inparticularthePage83information,togenerateauniqueidentifier.SCSI
INQUIRYdeviceidentifiersareuniqueacrossallhosts,persistent,andhaveoneofthefollowingformats:
naa.<number>
t10.<number>
eui.<number>
TheseformatsfollowtheT10committeestandards.SeetheSCSI3documentationontheT10committe
WebsiteforinformationonPage83.
Pathbasedidentifier.IfthedevicedoesnotprovidetheinformationonPage83oftheT10committee
SCSI3documentation,thehostgeneratesanmpx.<path>name,where<path>representsthefirstpathto
thedevice,forexample,mpx.vmhba1:C0:T1:L3.ThisidentifiercanbeusedinthesamewayastheSCSI
inquiryidentifiers.
Thempx.identifieriscreatedforlocaldevicesontheassumptionthattheirpathnamesareunique.
However,thisidentifierisneitheruniquenorpersistentandcouldchangeaftereveryboot.
Typically,thepathtothedevicehasthefollowingformat:
vmhba<adapter>:C<channel>:T<target>:L<LUN>
vmbh<adapter>isthenameofthestorageadapter.Thenamereferstothephysicaladapteronthe
host,nottheSCSIcontrollerusedbythevirtualmachines.
C<channel>isthestoragechannelnumber.SoftwareiSCSIadaptersanddependenthardware
adaptersusethechannelnumbertoshowmultiplepathstothesametarget.
T<target>isthetargetnumber.Targetnumberingisdeterminedbythehostandmightchangeifthe
mappingsoftargetsthatarevisibletothehostchange.Targetsthataresharedbydifferenthosts
mightnothavethesametargetnumber.
L<LUN>istheLUNnumberthatshowsthepositionoftheLUNwithinthetarget.Thenumberis
providedbythestoragesystem.IfatargethasonlyoneLUN,theLUNnumberisalwayszero(0).
Legacy Identifiers
InadditiontotheSCSIINQUIRYormpxidentifiers,ESXigeneratesanalternativelegacyname,calledVML
name,foreachdevice.UsethedeviceUIDinstead.
Examining LUNs
ALUN(LogicalUnitNumber)isanidentifierforadiskvolumeinastoragearraytarget.
Target and Device Representation
IntheESXicontext,thetermtargetidentifiesasinglestorageunitthatahostcanaccess.Thetermsdeviceand
LUNdescribealogicalvolumethatrepresentsstoragespaceonatarget.ThetermsdeviceandLUNmeana
SCSIvolumepresentedtothehostfromastoragetarget.
DifferentstoragevendorspresenttheirstoragesystemstoESXihostsindifferentways.Somevendorspresent
asingletargetwithmultipleLUNsonit.Othervendors,especiallyiSCSIvendors,presentmultipletargets
withoneLUNeach.
VMware, Inc. 41
Chapter 4 Managing Storage
Figure 4-3. Target and LUN Representations
InFigure 43,threeLUNsareavailableineachconfiguration.Ontheleft,thehostseesonetarget,butthat
targethasthreeLUNsthatcanbeused.EachLUNrepresentsanindividualstoragevolume.Ontheright,the
hostseesthreedifferenttargets,eachhavingoneLUN.
Examining LUNs with esxcli storage core
Useesxcli storage coretodisplayinformationaboutavailableLUNsonESXi5.0.
YoucanrunoneofthefollowingcommandstoexamineLUNs.Specifyoneoftheconnectionoptionslistedin
“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
Listalllogicaldevicesknownonthissystemwithdetailedinformation.
esxcli <conn_options> storage core device list
Thecommandlistsdeviceinformationforalllogicaldevicesonthissystem.Theinformationincludesthe
name(UUID),devicetype,displayname,andmultipathingplugin.Specifythe--deviceoptiontoonly
listinformationaboutaspecificdevice.See“StorageDeviceNaming”onpage 39forbackground
information.
naa.5000c50037b3967e
Display Name: <name> (naa.5000c50037b3967e)
Has Settable Display Name: true
Size: 953869
Device Type: Direct-Access
...
naa.500000e014e7a4e0
Display Name: <name> (naa.500000e014e7a4e0)
Has Settable Display Name: true
Size: 70007
Device Type: Direct-Access
...
mpx.vmhba0:C0:T0:L0
Display Name: Local <name> CD-ROM (mpx.vmhba0:C0:T0:L0)
Has Settable Display Name: false
Size: 0
Device Type: CD-ROM
Listaspecificlogicaldevicewithitsdetailedinformation.
esxcli <conn_options> storage core device list -d mpx.vmhba32:C0:T1:L0
Listalldeviceuniqueidentifiers.
esxcli <conn_options> storage core device list
ThecommandliststheprimaryUIDforeachdevice(naa.xxxorotherprimaryname)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.
storage array
target
LUN LUN LUN
storage array
target target target
LUN LUN LUN
Getting Started with vSphere Command-Line Interfaces
42 VMware, Inc.
esxcli <conn_options> storage core path list
Examining LUNs with vicfg-scsidevs
Usevicfg-scsidevstodisplayinformationaboutavailableLUNsonESXi 4.xhosts.
YoucanrunoneofthefollowingcommandstoexamineLUNs.Specifyoneoftheconnectionoptionslistedin
“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
Listalllogicaldevicesknownonthissystemwithdetailedinformation.
vicfg-scsidevs <conn_options> --list
Thecommandlistsdeviceinformationforalllogicaldevicesonthissystem.Theinformationincludesthe
name(UUID),devicetype,displayname,andmultipathingplugin.Specifythe--deviceoptiontoonly
listinformationaboutaspecificdevice.Thefollowingexampleshowsoutputfortwodevices;theactual
listingmightincludemultipledevicesandthepreciseformatdiffersbetweenreleases.
mpx.vmhba2:C0:T1:L0
Device Type: cdrom
Size: 0 MB
Display Name: Local HL-DT-ST (mpx.vmhba2:C0:T1:L0)
Plugin: NMP
Console Device: /vmfs/devices/cdrom/mpx.vmhba2:C0:T1:L0
Devfs Path: /vmfs/devices/cdrom/mpx.vmhba2:C0: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...)
...
Listalllogicaldeviceswithabbreviatedinformation.
vicfg-scsidevs <conn_options> --compact-list
TheinformationincludesthedeviceID,devicetype,size,plugin,anddevicedisplayname.
Listalldeviceuniqueidentifiers.
vicfg-scsidevs <conn_options> --uids
ThecommandliststheprimaryUIDforeachdevice(naa.xxxorotherprimaryname)andanyotherUIDs
foreachUID(VMLname).Youcanspecify--devicetoonlylistinformationforaspecificdevice.
Listaspecificlogicaldevicewithitsdetailedinformation.
vicfg-scsidevs <conn_options> -l -d mpx.vmhba32:C0: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
IMPORTANTYoucanrunvicfg-scsidevs--queryandvicfg-scsidevs --vmfsagainstESXiversion3.5.
TheotheroptionsaresupportedonlyagainstESXiversion4.0andlater.
VMware, Inc. 43
Chapter 4 Managing Storage
Detaching Devices and Removing a LUN
BeforeyoucanremoveaLUN,youmustdetachthecorrespondingdevicebyusingthevSphereWebClient,
ortheesxcli storage core device setcommand.Detachingadevicebringsadeviceoffline.Detaching
adevicedoesnotimpactpathstates.IftheLUNisstillvisible,thepathstateisnotsettodead.
To detach a device and remove a LUN
1Migratevirtualmachinesfromthedeviceyouplantodetach.
Forinformationonmigratingvirtualmachines,seethevCenterServerandHostManagement
documentation.
2Unmountthedatastoredeployedonthedevice.See“MountingandUnmountingwithESXCLI”on
page 30.
Iftheunmountfails,ESXCLIreturnsanerror.Ifyouignorethaterror,youwillgetanerrorinstep4when
youattempttodetachadevicewithaVMFSpartitionstillinuse.
3Iftheunmountfailed,checkwhetherthedeviceisinuse.
esxcli storage core device world list -d <device>
IfaVMFSvolumeisusingthedeviceindirectly,theworldnameincludesthestringidle0.Ifavirtual
machineusesthedeviceasanRDM,thevirtualmachineprocessnameisdisplayed.Ifanyotherprocess
isusingtherawdevice,theinformationisdisplayed.
4 Detachthestoragedevice.
esxcli storage core device set -d naa.xxx... --state=off
Detachispersistentacrossrebootsanddeviceunregistration.Anydevicethatisdetachedremains
detacheduntilamanualattachoperation.Rescandoesnotbringpersistentlydetacheddevicesback
online.Apersistentlydetacheddevicecomesbackintheoffstate.
ESXimaintainsthepersistentinformationaboutthedevice’sofflinestateevenifthedeviceis
unregistered.Youcanremovethedeviceinformationbyrunningesxcli storage core device
detached remove -d naa.12.
5 (Optional)Totroubleshootthedetachoperation,listalldevicesthatweredetachedmanually.
esxcli storage core device detached list
6Performarescan.
esxcli <conn_options> storage core adapter rescan
Whenyouhavecompletedstoragereconfiguration,youcanreattachthestoragedevice,mountthedatastore,
andrestartthevirtualmachines.
To reattach the device
1 (Optional)Checkthatthedeviceisdetached.
esxcli storage core device detached list
2 Attachthedevice.
esxcli storage core device set -d naa.XXX --state=on
3Mountthedatastoreandrestartvirtualmachines.See“MountingDatastoreswithExistingSignatures”on
page 29.
Working with Permanent Device Loss
WithearlierESXireleases,anAPD(AllPathsDown)eventresultswhentheLUNbecomesunavailable.The
eventisdifficultforadministratorsbecausetheydonothaveenoughinformationaboutthestateoftheLUN
toknowwhichcorrectiveactionisappropriate.
Getting Started with vSphere Command-Line Interfaces
44 VMware, Inc.
InESXi5.0,theESXihostcandeterminewhetherthecauseofanAllPathsDown(APD)eventistemporary,or
whetherthecauseispermanentdeviceloss.APDLstatusoccurswhenthestoragearrayreturnsSCSIsense
codesindicatingthattheLUNisnolongeravailableorthatasevere,unrecoverablehardwareproblemexist
withit.ESXihasanimprovedinfrastructurethatcanspeedupoperationsofupperlayerapplicationsina
devicelossscenario.
To Remove a PDL LUN
HowyouremoveaPDLLUNdependsonwhetheritwasinuse.
IftheLUNthatgoesintoPDLisnotinusebyanyuserprocessorbytheVMkernel,theLUNdisappears
byitselfafteraPDL.
IftheLUNwasinusewhenitenteredPLD,deletetheLUNmanuallybyfollowingtheprocessdescribed
in“DetachingDevicesandRemovingaLUN”onpage 43.
To Reattach a PDL LUN
1ReturntheLUNtoworkingorder.
2Removeanyusersofthedevice.
Youcannotbringadevicebackwithoutremovingactiveusers.TheESXihostcannotknowwhetherthe
devicethatwasaddedbackhaschanged.ESXimustbeabletotreatthedevicesimilarlytoanewdevice
beingdiscovered.
3Performarescantogetthedevicebackinworkingorder.
Managing Paths
TomaintainaconstantconnectionbetweenanESXihostanditsstorage,ESXisupportsmultipathing.With
multipathingyoucanusemorethanonephysicalpathfortransferringdatabetweentheESXihostandthe
externalstoragedevice.
IncaseoffailureofanelementintheSANnetwork,suchasanHBA,switch,orcable,theESXihostcanfail
overtoanotherphysicalpath.Onsomedevices,multipathingalsooffersloadbalancing,whichredistributes
I/Oloadsbetweenmultiplepathstoreduceoreliminatepotentialbottlenecks.
ThestoragearchitectureinvSphere4.0andlatersupportsaspecialVMkernellayer,PluggableStorage
Architecture(PSA).ThePSAisanopenmodularframeworkthatcoordinatesthesimultaneousoperationof
multiplemultipathingplugins(MPPs).YoucanmanagePSAusingESXCLIcommands.See“Managing
ThirdPartyStorageArrays”onpage 87.ThissectionassumesyouareusingonlyPSApluginsincludedin
vSpherebydefault.
Multipathing with Local Storage and FC SANs
Inasimplemultipathinglocalstoragetopology,youcanuseoneESXihostwithtwoHBAs.TheESXihost
connectstoadualportlocalstoragesystemthroughtwocables.Thisconfigurationensuresfaulttoleranceif
oneoftheconnectionelementsbetweentheESXihostandthelocalstoragesystemfails.
TosupportpathswitchingwithFCSAN,theESXihosttypicallyhastwoHBAsavailablefromwhichthe
storagearraycanbereachedthroughoneormoreswitches.Alternatively,thesetupcanincludeoneHBAand
twostorageprocessorssothattheHBAcanuseadifferentpathtoreachthediskarray.
InFigure 44,multiplepathsconnecteachhostwiththestoragedevice.Forexample,ifHBA1orthelink
betweenHBA1andtheswitchfails,HBA2takesoverandprovidestheconnectionbetweentheserverandthe
switch.TheprocessofoneHBAtakingoverforanotheriscalledHBAfailover.
IMPORTANTDonotplanforAPD/PDLevents,forexample,whenyouwanttoupgradeyourhardware.
Instead,performanorderlyremovalofLUNsfromyourESXiserver,whichisdescribedin“DetachingDevices
andRemovingaLUN”onpage 43,performtheoperation,andaddtheLUNback.
VMware, Inc. 45
Chapter 4 Managing Storage
Figure 4-4. FC Multipathing
IfSP1orthelinkbetweenSP1andtheswitchbreaks,SP2takesoverandprovidestheconnectionbetweenthe
switchandthestoragedevice.ThisprocessiscalledSPfailover.ESXimultipathingsupportsHBAandSP
failover.
Afteryouhavesetupyourhardwaretosupportmultipathing,youcanusethevSphereWebClientorvCLI
commandstolistandmanagepaths.Youcanperformthefollowingtasks.
Listpathinformationwithvicfg-mpathoresxcli storage core path.See“ListingPathInformation”
onpage 45.
Changepathstatewithvicfg-mpathoresxcli storage core path.See“ChangingtheStateofaPath
onpage 46.
ChangepathpolicieswithESXCLI.See“SettingPolicyDetailsforDevicesthatUseRoundRobin”on
page 50.
MaskpathswithESXCLI.SeethevSphereStoragedocumentation.
Manipulatetherulesthatmatchpathstomultipathingpluginstonewlydiscovereddeviceswithesxcli
claimrule.See“ManagingClaimRules”onpage 95.
Runorrerunclaimrulesorunclaimpaths.See“ManagingClaimRules”onpage 95.
Rescanwithvicfg-rescan.See“ScanningStorageAdapters”onpage 58.
Listing Path Information
YoucanlistpathinformationwithESXCLIorwithvicfg-mpath.
Listing Path Information with ESXCLI
Youcanrunesxcli storage core pathtodisplayinformationaboutFibreChanneloriSCSILUNs.
Youcandisplayinformationaboutpathsbyrunningesxcli storage core path.Specifyoneoftheoptions
listedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof
<conn_options>.
Listalldeviceswiththeircorrespondingpaths,stateofthepath,adaptertype,andotherinformation.
SP2
storage array
SP1
switch switch
HBA2 HBA1 HBA3 HBA4
Host 1 Host 2
IMPORTANTUseindustrystandarddevicenames,withformateui.xxxornaa.xxxtoensureconsistency.
DonotuseVMLLUNnamesunlessdevicenamesarenotavailable.
NamesofvirtualmachineHBAsarenotguaranteedtobevalidacrossreboots.
Getting Started with vSphere Command-Line Interfaces
46 VMware, Inc.
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>
ListthestatisticsfortheSCSIpathsinthesystem.Youcanlistallpathsorlimitthedisplaytoaspecific
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 <naa.xxxxxx>
Listalladapters.
esxcli <conn_options> storage core adapter list
Rescanalladapters.
esxcli <conn_options> storage core adapter rescan
Listing Path Information with vicfg-mpath
Youcanrunvicfg-mpathtolistinformationaboutFibreChanneloriSCSILUNs.
Youcandisplayinformationaboutpathsbyrunningvicfg-mpathwithoneofthefollowingoptions.Specify
oneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplace
of<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 vmhba32:C0:T0:L0
Thereturninformationincludestheruntimename,device,devicedisplayname,adapter,adapter
identifier,targetidentifier,plugin,state,transport,andadapterandtargettransportdetails.
Listdetailedinformationforthepathsforthedevicespecifiedwith--device.
vicfg-mpath <conn_options> -l -d mpx.vmhba32:C0:T1:L0
vicfg-mpath <conn_options> --list --device naa.60060...
Changing the State of a Path
YoucanchangethestateofapathwithESXCLIorwithvicfg-mpath.
IMPORTANTUseindustrystandarddevicenames,withformateui.xxxornaa.xxxtoensureconsistency.
DonotuseVMLLUNnamesunlessdevicenamesarenotavailable.
NamesofvirtualmachineHBAsarenotguaranteedtobevalidacrossreboots.
VMware, Inc. 47
Chapter 4 Managing Storage
Changing Path State with ESXCLI
Youcantemporarilydisablepathsformaintenanceorotherreasons,andenablethepathwhenyouneedit
again.YoucandisablepathswithESXCLI.Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLI
HostManagementCommands”onpage 18inplaceof<conn_options>.
Ifyouarechangingapath’sstate,thechangeoperationfailsifI/Oisactivewhenthepathsettingischanged.
Reissuethecommand.YoumustissueatleastoneI/Ooperationbeforethechangetakeseffect.
To disable a path with ESXCLI
1 (Optional)Listalldevicesandcorrespondingpaths.
esxcli <conn_options> storage core path list
Thedisplayincludesinformationabouteachpath’sstate.
2SetthestateofaLUNpathtooff.
esxcli <conn_options> storage core path set --state off --path vmhba32:C0:T1:L0
Whenyouareready,setthepathstatetoactiveagain.
esxcli <conn_options> storage core path set --state active --path vmhba32:C0:T1:L0
Changing Path State with vicfg-mpath
Youcandisablepathswithvicfg-mpath.Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLI
HostManagementCommands”onpage 18inplaceof<conn_options>.
Ifyouarechangingapath’sstate,thechangeoperationfailsifI/Oisactivewhenthepathsettingischanged.
Reissuethecommand.YoumustissueatleastoneI/Ooperationbeforethechangetakeseffect.
To disable a path with vicfg-mpath
1 (Optional)Listalldevicesandcorrespondingpaths.
vicfg-mpath <conn_options> --list-paths
Thedisplayincludesinformationabouteachpath’sstate.
2SetthestateofaLUNpathtooff.
vicfg-mpath <conn_options> --state off --path vmhba32:C0:T1:L0
Whenyouareready,setthepathstatetoactiveagain.
vicfg-mpath <conn_options> --state active --path vmhba32:C0:T1:L0
Managing Path Policies
ForeachstoragedevicemanagedbyNMP(notPowerPath),anESXihostusesapathselectionpolicy.Ifyou
haveathirdpartyPSPinstalledonyourhost,itspolicyalsoappearsonthelist.Thefollowingpathpolicies
aresupportedbydefault.
Getting Started with vSphere Command-Line Interfaces
48 VMware, Inc.
Thetypeofarrayandthepathpolicydeterminethebehaviorofthehost.
Multipathing Considerations
Thefollowingconsiderationshelpyouwithmultipathing:
IfnoSATPisassignedtothedevicebytheclaimrules,thedefaultSATPforiSCSIorFCdevicesis
VMW_SATP_DEFAULT_AA.ThedefaultPSPisVMW_PSP_FIXED.
WhenthesystemsearchestheSATPrulestolocateaSATPforagivendevice,itsearchesthedriverrules
first.Ifthereisnomatch,thevendor/modelrulesaresearched,andfinallythetransportrulesare
searched.Ifnomatchoccurs,NMPselectsadefaultSATPforthedevice.
IfVMW_SATP_ALUAisassignedtoaspecificstoragedevice,butthedeviceisnotALUAaware,noclaim
rulematchoccursforthisdevice.ThedeviceisclaimedbythedefaultSATPbasedonthedeviceʹs
transporttype.
ThedefaultPSPforalldevicesclaimedbyVMW_SATP_ALUAisVMW_PSP_MRU.TheVMW_PSP_MRUselectsan
active/optimizedpathasreportedbytheVMW_SATP_ALUA,oranactive/unoptimizedpathifthereis
noactive/optimizedpath.Thispathisuseduntilabetterpathisavailable(MRU).Forexample,ifthe
VMW_PSP_MRUiscurrentlyusinganactive/unoptimizedpathandanactive/optimizedpathbecomes
available,theVMW_PSP_MRUwillswitchthecurrentpathtotheactive/optimizedone.
Table 4-1. Supported Path Policies
Policy Description
VMW_PSP_FIXED Thehostusesthedesignatedpreferredpath,ifithasbeenconfigured.Otherwise,thehost
selectsthefirstworkingpathdiscoveredatsystemboottime.Ifyouwantthehosttousea
particularpreferredpath,specifyitthroughthevSphereWebClient,orbyusingesxcli
storage nmp psp fixed deviceconfig set.See“ChangingPathPolicies”onpage 49.
ThedefaultpolicyforactiveactivestoragedevicesisVMW_PSP_FIXED.
Note:IfthehostusesadefaultpreferredpathandthepathʹsstatusturnstoDead,anewpath
isselectedaspreferred.However,ifyouexplicitlydesignatethepreferredpath,itwillremain
preferredevenwhenitbecomesinaccessible.
VMW_PSP_MRU Thehostselectsthepaththatitusedmostrecently.Whenthepathbecomesunavailable,the
hostselectsanalternativepath.Thehostdoesnotrevertbacktotheoriginalpathwhenthat
pathbecomesavailableagain.ThereisnopreferredpathsettingwiththeMRUpolicy.MRU
isthedefaultpolicyforactivepassivestoragedevices.
TheVMW_PSP_MRUrankingcapabilityallowsyoutoassignrankstoindividualpaths.Toset
rankstoindividualpaths,usetheesxclistoragenmppspgenericpathconfigsetcommand.
Fordetails,seetheVMwareknowledgebasearticle2003468.
VMW_PSP_RR Thehostusesanautomaticpathselectionalgorithmthatrotatesthroughallactivepaths
whenconnectingtoactivepassivearrays,orthroughallavailablepathswhenconnectingto
activeactivearrays.Automaticpathselectionimplementsloadbalancingacrossthephysical
pathsavailabletoyourhost.LoadbalancingistheprocessofspreadingI/Orequestsacross
thepaths.ThegoalistooptimizethroughputperformancesuchasI/Opersecond,megabytes
persecond,orresponsetimes.
VMW_PSP_RRisthedefaultforanumberofarraysandcanbeusedwithbothactiveactiveand
activepassivearraystoimplementloadbalancingacrosspathsfordifferentLUNs.
Table 4-2. Path Policy Effects
Policy Active/Active Array Active/Passive Array
MostRecentlyUsed Administratoractionisrequiredtofail
backafterpathfailure.
Administratoractionisrequiredtofailback
afterpathfailure.
Fixed VMkernelresumesusingthepreferred
pathwhenconnectivityisrestored.
VMkernelattemptstoresumebyusingthe
preferredpath.Thisactioncancausepath
thrashingorfailurewhenanotherSPnow
ownstheLUN.
RoundRobinNofailback. Nextpathinroundrobinschedulingis
selected.
VMware, Inc. 49
Chapter 4 Managing Storage
WhileVMW_PSP_MRUistypicallyselectedforALUAarraysbydefault,certainALUAstoragearraysneed
touseVMW_PSP_FIXED.TocheckwhetheryourstoragearrayrequiresVMW_PSP_FIXED,seetheVMware
CompatibilityGuideorcontactyourstoragevendor.WhenusingVMW_PSP_FIXEDwithALUAarrays,
unlessyouexplicitlyspecifyapreferredpath,theESXihostselectsthemostoptimalworkingpathand
designatesitasthedefaultpreferredpath.Ifthehostselectedpathbecomesunavailable,thehostselects
analternativeavailablepath.However,ifyouexplicitlydesignatethepreferredpath,itremainspreferred
nomatterwhatitsstatusis.
Bydefault,thePSAclaimrule101masksDellarraypseudodevices.Donotdeletethisrule,unlessyou
wanttounmaskthesedevices.
Changing Path Policies
YoucanchangepathpolicieswithESXCLIorwithvicfg-mpath.
Changing Path Policies with ESXCLI
YoucanchangethepathpolicywithESXCLI.Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLI
HostManagementCommands”onpage 18inplaceof<conn_options>.
To change the path policy with ESXCLI
1EnsureyourdeviceisclaimedbytheNMPplugin.OnlyNMPdevicesallowyoutochangethepathpolicy.
esxcli <conn_options> storage nmp device list
2 Retrievethelistofpathselectionpoliciesonthesystemtoseewhichvaluesarevalidforthe--pspoption
whenyousetthepathpolicy.
esxcli storage core plugin registration list --plugin-class="PSP"
3Setthepathpolicyusingesxcli.
esxcli <conn_options> storage nmp device set --device naa.xxx --psp VMW_PSP_RR
SeeTable 41,“SupportedPathPolicies,onpage 48.
4 (Optional)IfyouspecifiedtheVMW_PSP_FIXEDpolicy,youmustmakesurethepreferredpathisset
correctly.
aCheckwhichpathisthepreferredpathforadevice.
esxcli <conn_options> storage nmp psp fixed deviceconfig get --device naa.xxx
bIfnecessary,changethepreferredpath.
esxcli <conn_options> storage nmp psp fixed deviceconfig set --device naa.xxx --path
vmhba3:C0:T5:L3
Thecommandsetsthepreferredpathtovmhba3:C0:T5:L3.Runthecommandwith--defaultto
clearthepreferredpathselection.
Changing Path Policies with vicfg-mpath
Youcanchangethepathpolicywithvicfg-mpath.Specifyoneoftheoptionslistedin“ConnectionOptions
forvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
To change the path policy with vicfg-mpath
1Listallmultipathingpluginsloadedintothesystem.
vicfg-mpath <conn_options> --list-plugins
Ataminimum,thiscommandreturnsNMP(NativeMultipathingPlugin)andMASK_PATH.IfotherMPP
pluginshavebeenloaded,theyarelistedaswell.
2SetthepathpolicybyusingESXCLI.
esxcli <conn_options> nmp device set --device naa.xxx --psp VMW_PSP_RR
Getting Started with vSphere Command-Line Interfaces
50 VMware, Inc.
SeeTable 41,“SupportedPathPolicies,onpage 48.
3 (Optional)IfyouspecifiedtheVMW_PSP_FIXEDpolicy,youmustmakesurethepreferredpathisset
correctly.
aFirstcheckwhichpathisthepreferredpathforadevice.
esxcli <conn_options> storage nmp psp fixed deviceconfig get -d naa.xxxx
bIfnecessary,changethepreferredpath.
esxcli <conn_options> storage nmp psp fixed deviceconfig set --device naa.xxx --path
vmhba3:C0:T5:L3
Thecommandsetsthepreferredpathtovmhba3:C0:T5:L3
Setting Policy Details for Devices that Use Round Robin
ESXihostscanusemultipathingforfailover.Withcertainstoragedevices,ESXihostscanalsouse
multipathingforloadbalancing.Toachievebetterloadbalancingacrosspaths,administratorscanspecifythat
theESXihostshouldswitchpathsundercertaincircumstances.Differentsettableoptionsdeterminewhenthe
ESXihostswitchespathsandwhatpathsarechosen.Onlyalimitednumberofstoragearrayssupportround
robin.
Youcanuseesxcli nmp roundrobintoretrieveandsetroundrobinpathoptionsonadevicecontrolledby
theroundrobinPSP.Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagement
Commands”onpage 18inplaceof<conn_options>.
Novicfg-commandexistsforperformingtheoperations.TheESXCLIcommandsforsettingroundrobin
pathoptionshavechanged.ThecommandssupportedinESXi4.xarenolongersupported.
To view and manipulate round robin path selection settings with ESXCLI
1 RetrievepathselectionsettingsforadevicethatisusingtheroundrobinPSP.
esxcli <conn_options> storage nmp psp roundrobin deviceconfig get --device na.xxx
2Setthepathselection.Youcanspecifywhenthepathshouldchange,andwhetherunoptimizedpaths
shouldbeincluded.
Use--bytesor--iopstospecifywhenthepathshouldchange,asinthefollowingexamples:
esxcli <conn_options> storage nmp psp roundrobin deviceconfig set --type "bytes" -B 12345
--device naa.xxx
Setsthedevicespecifiedby--devicetoswitchtothenextpatheachtime12345byteshavebeensent
alongthecurrentpath.
esxcli <conn_options> storage nmp psp roundrobin deviceconfig set --type=iops --iops
4200 --device naa.xxx
Setsthedevicespecifiedby--devicetoswitchafter4200I/Ooperationshavebeenperformedona
path.
UseuseanotospecifythattheroundrobinPSPshouldincludepathsintheactive,unoptimizedstate
intheroundrobinset(1)orthatthePSPshoulduseactive,unoptimizedpathsonlyifnoactive
optimizedpathsareavailable(0).Ifyoudonotincludethisoption,thePSPincludesonlyactive
optimizedpathsintheroundrobinpathset.
Scheduling Queues for Virtual Machine I/O
Bydefault,vSphereprovidesamechanismthatcreatesschedulingqueuesforeachvirtualmachinefile.Each
filehasindividualbandwidthcontrols.ThismechanismensuresthattheI/Oforaparticularvirtualmachine
goesintoitsownseparatequeueanddoesnotinterferewiththeI/Oofothervirtualmachines.
Thiscapabilityisenabledbydefault.Youcanturnitoffbyusingtheesxcli system settings kernel set
-s isPerFileSchedModelActiveoption.
VMware, Inc. 51
Chapter 4 Managing Storage
To enable or disable per file I/O scheduling
Runesxcli system settings kernel set -s isPerFileSchedModelActive -v FALSEtodisable
perfilescheduling.
Runesxcli system settings kernel set -s isPerFileSchedModelActive -v TRUEtoenable
perfilescheduling.
Managing NFS/NAS Datastores
ESXihostscanaccessadesignatedNFSvolumelocatedonaNAS(NetworkAttachedStorage)server,can
mountthevolume,andcanuseitforitsstorageneeds.YoucanuseNFSvolumestostoreandbootvirtual
machinesinthesamewaythatyouuseVMFSdatastores.
Capabilities Supported by NFS/NAS
AnNFSclientbuiltintotheESXihypervisorusestheNetworkFileSystem(NFS)protocoloverTCP/IPto
accessadesignatedNFSvolumethatislocatedonaNASserver.TheESXihostcanmountthevolumeanduse
itforitsstorageneeds.vSpheresupportsversions3and4.1oftheNFSprotocol.
Typically,theNFSvolumeordirectoryiscreatedbyastorageadministratorandisexportedformtheNFS
server.TheNFSvolumedoesnotneedtobeformattedwithalocalfilesystem,suchasVMFS.Youcanmount
thevolumedirectlyonESXihosts,anduseittostoreandbootvirtualmachinesinthesamewaythatyouuse
VMFSdatastores.
InadditiontostoringvirtualdisksonNFSdatastores,youcanalsouseNFSasacentralrepositoryforISO
images,virtualmachinetemplates,andsoon.IfyouusethedatastoreforISOimages,youcanconnectthe
virtualmachineʹsCDROMdevicetoanISOfileonthedatastoreandinstallaguestoperatingsystemfromthe
ISOfile.
ESXihostssupportthefollowingsharedstoragecapabilitiesonNFSvolumes:
VMwarevMotionandStoragevMotion
HighAvailability(HA),FaultTolerance,andDistributedResourceScheduler(DRS)
ISOimages,whicharepresentedasCDROMstovirtualmachines
Virtualmachinesnapshots
Hostprofiles
Virtualmachineswithlargecapacityvirtualdisks,ordisksgreaterthan2TB.VirtualdiskscreatedonNFS
datastoresarethinprovisionedbydefault,unlessyouusehardwareaccelerationthatsupportsthe
ReserveSpaceoperation.NFS4.1doesnotsupporthardwareacceleration.See“HardwareAcceleration
onNASDevices”inthevSphereStoragedocumentation.
InadditiontostoringvirtualdisksonNFSdatastores,youcanalsouseNFSasacentralrepositoryforISO
images,virtualmachinetemplates,andsoon.
TouseNFSasasharedrepository,youcreateadirectoryontheNFSserverandthenmountthedirectoryasa
datastoreonallhosts.IfyouusethedatastoreforISOimages,youcanconnectthevirtualmachineʹsCDROM
devicetoanISOfileonthedatastoreandinstallaguestoperatingsystemfromtheISOfile.
Adding and Deleting NAS File Systems
Youcanlist,add,anddeleteaNASfilesystemwithESXCLIorwithvicfg-nas.
Managing NAS File Systems with ESXCLI
YoucanuseESXCLIasavCLIcommandwithconnectionoptions(see“ConnectionOptionsforvCLIHost
ManagementCommandsonpage 18)orintheESXishell.
Getting Started with vSphere Command-Line Interfaces
52 VMware, Inc.
To manage a NAS file system
1ListallknownNASfilesystems.
esxcli <conn_options> storage nfs list
ForeachNASfilesystem,thecommandliststhemountname,sharename,andhostnameandwhether
thefilesystemismounted.
IfnoNASfilesystemsareavailable,thesystemdoesnotreturnaNASfilesystemandreturnstothe
commandprompt.
2AddanewNASfilesystemtotheESXihost.SpecifytheNASserverwith--host,thevolumetousefor
themountwith--volume-name,andthesharenameontheremotesystemtouseforthisNASmount
pointwith--share.
esxcli <conn_options> storage nfs add --host=dir42.eng.vmware.com --share=/<mount_dir>
--volume-name=nfsstore-dir42
ThiscommandaddsanentrytotheknownNASfilesystemlistandsuppliesthesharenameofthenew
NASfilesystem.Youmustsupplythehostname,sharename,andvolumenameforthenewNASfile
system.
3AddasecondNASfilesystemwithreadonlyaccess.
esxcli <conn_options> storage nfs add --host=dir42.eng.vmware.com --share=/home
--volume-name=FileServerHome2 --readonly
4 DeleteoneoftheNASfilesystems.
esxcli <conn_options> storage nfs remove --volume-name=FileServerHome2
ThiscommandunmountstheNASfilesystemandremovesitfromthelistofknownfilesystems.
Managing NAS File Systems with vicfg-nas
Youcanusevicfg-nasasavCLIcommandwithconnectionoptions.See“ConnectionOptionsforvCLIHost
ManagementCommandsonpage 18.
To manage a NAS file system
1ListallknownNASfilesystems.
vicfg-nas <conn_options> -l
ForeachNASfilesystem,thecommandliststhemountname,sharename,andhostnameandwhether
thefilesystemismounted.IfnoNASfilesystemsareavailable,thesystemreturnsthefollowingmessage:
No NAS datastore found
2AddanewNASfilesystemtotheESXihost.
vicfg-nas <conn_options --add --nasserver dir42.eng.vmware.com -s /<mount_dir>
nfsstore-dir42
ThiscommandaddsanentrytotheknownNASfilesystemlistandsuppliesthesharenameofthenew
NASfilesystem.YoumustsupplythehostnameandthesharenameforthenewNASfilesystem.
3AddasecondNASfilesystemwithreadonlyaccess.
vicfg-nas <conn_options> -a -y --n esx42nas2 -s /home FileServerHome2
4 DeleteoneoftheNASfilesystems.
vicfg-nas <conn_options> -d FileServerHome1
ThiscommandunmountstheNASfilesystemandremovesitfromthelistofknownfilesystems.
VMware, Inc. 53
Chapter 4 Managing Storage
Monitoring and Managing SAN Storage
Theesxcli storage sancommandshelpadministratorstroubleshootissueswithI/Odevicesandfabric,
andincludeFibreChannel,FCoE,iSCSI,SASprotocolstatistics.Thecommandsallowyoutoretrievedevice
informationandI/Ostatisticsfromthosedevice.YoucanalsoissueLoopInitializationPrimitives(LIP)to
FC/FCoEdevicesandyoucanresetSASdevices.
ForFCandFCoEdevices,youcanretrieveFCeventssuchasRSCN,LINKUP,LINKDOWN,FrameDropandFCoE
CVL.ThecommandslogawarningintheVMkernellogifitencounterstoomanyLinkTogglingorframedrops
ThefollowingexampleexaminesandresetsSANstoragethroughaFibreChanneladapter.Insteadoffc,the
informationretrievalcommandscanalsouseiscsi,fcoe,andsas.
To monitor and manage FibreChannel SAN storage
1Listadapterattributes.
esxcli storage san fc list
2 RetrievealleventsforaFibreChannelI/Odevice.
esxcli storage san fc events get
3ClearallI/ODeviceManagementeventsforthespecifiedadapter.
esxcli storage san fc events clear --adapter adapter
4 Resettheadapter
esxcli storage san fc reset
Monitoring and Managing Virtual SAN Storage
VirtualSANisadistributedlayerofsoftwarethatrunsnativelyasapartoftheESXihypervisor.VirtualSAN
aggregateslocalordirectattachedstoragedisksofahostclusterandcreatesasinglestoragepoolshared
acrossallhostsofthecluster.
WhilesupportingVMwarefeaturesthatrequiresharedstorage,suchasHA,vMotion,andDRS,VirtualSAN
eliminatestheneedforanexternalsharedstorageandsimplifiesstorageconfigurationandvirtualmachine
provisioningactivities.
YoucanuseESXCLIcommandstoretrievevirtualSANinformation,manageVirtualSANclusters,perform
networkmanagement,addstorage,setthepolicy,andperformothermonitoringandmanagementtasks.Type
esxcli vsan --helpforacompletelistofcommands.
To retrieve Virtual SAN information
1VerifywhichVMkerneladaptersareusedforVirtualSANcommunication.
esxcli vsan network list
2ListstoragedisksthatwereclaimedbyVirtualSAN.
esxcli vsan storage list
3GetVirtualSANclusterinformation.
esxcli vsan cluster get
YoucanactivateVirtualSANwhenyoucreatehostclustersorenableVirtualSANonexistingclusters.When
enabled,VirtualSANaggregatesalllocalstoragedisksavailableonthehostsintoasingledatastoresharedby
allhosts.Youcanlaterexpandthedatastorebyaddingstoragedevicesorhoststothecluster.
YoucanrunthesecommandsintheESXiShellforahost,orthecommandaffectsthetargethostthatyou
specifyaspartofthevCLIconnectionoptions.
Getting Started with vSphere Command-Line Interfaces
54 VMware, Inc.
To manage a Virtual SAN cluster
1JointhetargethosttoagivenVirtualSANcluster.
esxcli vsan cluster join --cluster-uuid <uuid>
TheUUIDoftheclusterisrequired.
2VerifythatthetargethostisjoinedtoaVirtualSANcluster.
esxcli vsan cluster get
3RemovethetargethostfromtheVirtualSANcluster.
esxcli vsan cluster leave
To add and remove Virtual SAN storage
1Addanhdd(ordatadisk)forusebyVirtualSAN.
esxcli vsan storage add --disks <device_name>
Thecommandexpectsanemptydisk,whichwillbepartitionedorformatted.Specifyadevicename,for
example,mpx.vmhba2:C0:T1:L0.
2AddansdddiskforusebyVirtualSAN.
esxcli vsan storage add --ssd <device_name>
Thecommandexpectsanemptydisk,whichwillbepartitionedorformatted.Specifyadevicename,for
example,mpx.vmhba2:C0:T1:L0.
3ListtheVirtualSANstorageconfiguration.Youcandisplaythecompletelist,orfiltertoshowonlya
singledevice.
esxcli vsan storage list --device <device>
4Removedisksordiskgroups.
YoucanremovedisksordiskgroupsonlywhenVirtualSANisinmanualmode.Fortheautomaticdisk
claimmode,theremoveactionisnotsupported
RemoveanindividualVirtualSANdisk.
esxcli vsan storage remove --disk <device_name>
Insteadofspecifyingthedevicename,youcanspecifytheUUIDifyouincludethe--uuidoption.
Removeadiskgroup’sSSDandeachofitsbackingHDDdrivesfromVirtualSANusage.
esxcli vsan storage remove --ssd <device_name>
Insteadofspecifyingthedevicename,youcanspecifytheUUIDifyouincludethe--uuidoption.
AnySSDthatyouremovefromVirtualSANbecomesavailableforsuchfeaturesasFlashReadCache.
Monitoring vSphere Flash Read Cache
FlashReadCache™letsyouacceleratevirtualmachineperformancethroughtheuseofhostresidentflash
devicesasacache.ThevSphereStoragedocumentationdiscussesvSphereFlashReadCacheinsomedetail.
YoucanreserveaFlashReadCacheforanyindividualvirtualdisk.TheFlashReadCacheiscreatedonlywhen
avirtualmachineispoweredon,anditisdiscardedwhenavirtualmachineissuspendedorpoweredoff.
Whenyoumigrateavirtualmachineyouhavetheoptiontomigratethecache.Bydefaultthecacheismigrated
ifthevirtualflashmoduleonthesourceanddestinationhostsarecompatible.Ifyoudonotmigratethecache,
thecacheisrewarmedonthedestinationhost.Youcanchangethesizeofthecachewhileavirtualmachineis
poweredon.Inthisinstance,theexistingcacheisdiscardedandanewwritethroughcacheiscreated,which
resultsinacachewarmupperiod.Theadvantageofcreatinganewcacheisthatthecachesizecanbettermatch
theapplicationʹsactivedata.
VMware, Inc. 55
Chapter 4 Managing Storage
FlashReadCachesupportswritethroughorreadcaching.Writebackorwritecachingarenotsupported.
Datareadsaresatisfiedfromthecache,ifpresent.Datawritesaredispatchedtothebackingstorage,suchas
aSANorNAS.Alldatathatisreadfromorwrittentothebackingstorageisunconditionallystoredinthe
cache.
YoucanmanagevSphereFlashReadCachefromthevSphereWebClient.YoucanmonitorFlashReadCache
byusingcommandsintheesxcli storage vflashnamespace.Thefollowingtablelistsavailable
commands.SeethevSphereCommandLineInterfaceReferenceortheonlinehelpforalistofoptionstoeach
command.
Monitoring and Managing Virtual Volumes
TheVirtualVolumesfunctionalitychangesthestoragemanagementparadigmfrommanagingspaceinside
datastorestomanagingabstractstorageobjectshandledbystoragearrays.WithVirtualVolumes,an
individualvirtualmachine,notthedatastore,becomesaunitofstoragemanagement,whilestoragehardware
gainscompletecontrolovervirtualdiskcontent,layout,andmanagement.ThevSphereStorage
documentationdiscussesVirtualVolumesinsomedetailandexplainshowtomanagethemusingthevSphere
WebClient.
Thefollowingesxclicommandsareavailableformanagingdisplayinformationaboutvirtualvolumesandfor
unbindingallVirtualVolumesfromallvendorproviders.SeethevSphereStoragedocumentationfor
informationoncreatingVirtualVolumesandconfiguringmultipathingandSCSIbasedendpoints.
NOTENotallworkloadsbenefitwithaFlashReadCache.Theperformanceboostdependsonyourworkload
patternandworkingsetsize.Readintensiveworkloadswithworkingsetsthatfitintothecachecanbenefit
fromaFlashReadCacheconfiguration.ByconfiguringFlashReadCacheforyourreadintensiveworkloads
additionalI/Oresourcesbecomeavailableonyoursharedstorage,whichcanresultinaperformanceincrease
forotherworkloadseventhoughtheyarenotconfiguredtouseFlashReadCache
Table 4-3. Commands for Monitoring vSphere Flash Read Cache
Command Description
storage vflash cache get Getindividualvflashcacheinfo.
storage vflash cache list Listindividualvflashcaches.
storage vflash cache stats get Getvflashcachestatistics.
storage vflash cache stats reset Resetvflashcachestatistics.
storage vflash device list ListvflashSSDdevices.
storage vflash module get Getvflashmoduleinfo.
storage vflash module list Listvflashmodules.
storage vflash module stats get Getvflashmodulestatistics
Table 4-4. VVol Commands
Command Description
storage vvol daemon unbindall UnbindallVirtualVolumeinstancesfromallstorageprovidersthatare
knowntotheESXihost.
storage vvol protocolendpoint list ListtheVVolprotocolendpointscurrentlyknowntotheESXihost.
storage vvol storagecontainer list ListtheVVolstoragecontainerscurrentlyknowntotheESXhost.
storage vvol storagecontainer
restore
Restorestoragecontainersofvendorprovidersthatareregisteredonthe
host.
storage vvol vasacontext get GettheVASAcontext(VCUUID).
storage vvol vendorprovider list Listthevendorprovidersregisteredonthehost.
storage vvol vendorprovider
restore
Restorethevendorprovidersthatareregisteredonthehost.
Getting Started with vSphere Command-Line Interfaces
56 VMware, Inc.
Migrating Virtual Machines with svmotion
StoragevMotionmovesavirtualmachine’sconfigurationfile,and,optionally,itsdisks,whilethevirtual
machineisrunning.YoucanperformStoragevMotiontasksfromthevSphereWebClientorwiththe
svmotioncommand.
Youcanplacethevirtualmachineandallofitsdisksinasinglelocation,orchooseseparatelocationsforthe
virtualmachineconfigurationfileandeachvirtualdisk.Youcannotchangethevirtualmachine’sexecution
hostduringamigrationwithsvmotion.
Storage vMotion Uses
StoragevMotionhasseveralusesinadministeringyourvSphereenvironment.
UpgradeESXiwithoutvirtualmachinedowntimeinsituationswherevirtualmachinedisksmustbe
movedtosharedstoragetoallowmigrationwithvMotion.
Performstoragemaintenanceandreconfiguration.YoucanuseStoragevMotiontomovevirtual
machinesoffastoragedevicetoallowmaintenanceorreconfigurationofthestoragedevicewithout
virtualmachinedowntime.
Redistributestorageload.YoucanuseStoragevMotiontomanuallyredistributevirtualmachinesor
virtualdiskstodifferentstoragevolumestobalancecapacityorimproveperformance.
Storage vMotion Requirements and Limitations
YoucanmigratevirtualmachinediskswithStoragevMotionifthevirtualmachineanditshostmeetthe
followingresourceandconfigurationrequirements:
ForESXi5.0andlaterhosts,youcanmigratevirtualmachinesthathavesnapshots.Forearlierversionsof
ESXi,youcannotmigratevirtualmachinesthathavesnapshots.
Virtualmachinedisksmustbeinpersistentmodeorberawdevicemappings(RDMs).Forphysicaland
virtualcompatibilitymodeRDMs,youcanmigratethemappingfileonly.Forvirtualcompatibilitymode
RDMs,youcanusethevSphereWebClienttoconverttothickprovisionedorthinprovisioneddisks
duringmigrationaslongasthedestinationisnotanNFSdatastore.Youcannotusethesvmotion
commandtoperformthisconversion.
ThehostonwhichthevirtualmachineisrunningmusthavealicensethatincludesStoragevMotion.
Thehostonwhichthevirtualmachineisrunningmusthaveaccesstoboththesourceandtarget
datastores.
AparticularhostcanbeinvolvedinuptofourmigrationswithvMotionorStoragevMotionatonetime.
See“LimitsonSimultaneousMigrations”inthevCenterServerandHostManagementdocumentationfor
details.
IfyouusethevSphereWebClientformigrationwithsvmotion,thesystemperformsseveralcompatibility
checks.ThesechecksarenotsupportedbythesvmotionvCLIcommand.
Running svmotion in Interactive Mode
Youcanrunsvmotionininteractivemodeusingthe--interactiveoption.Thecommandpromptsyoufor
theinformationitneedstocompletethestoragemigration.
svmotion <conn_options> --interactive
Whenyouuse--interactive,allotheroptionsareignored.
IMPORTANTNoESXCLIcommandforStoragevMotionisavailable.
IMPORTANTWhenrespondingtotheprompts,usequotesaroundinputstringswithspecialcharacters.
VMware, Inc. 57
Chapter 4 Managing Storage
Running svmotion in Noninteractive Mode
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.
The--vmoptionspecifiesthevirtualmachineanditsdestination.Bydefault,allvirtualdisksarerelocatedto
thesamedatastoreasthevirtualmachine.Thisoptionrequiresthecurrentvirtualmachineconfigurationfile
location.See“Todeterminethepathtothevirtualmachineconfigurationfileanddiskfileonpage 57.
The--disksoptionrelocatesindividualvirtualdiskstodifferentdatastores.The--disksoptionrequiresthe
currentvirtualdiskdatastorepathasanoption.See“Todeterminethepathtothevirtualmachine
configurationfileanddiskfile”onpage 57.
To determine the path to the virtual machine configuration file and disk file
1Runvmware-cmd -ltolistallvirtualmachineconfigurationfiles(VMXfiles).
vmware-cmd -H <vc_server> -U <login_user> -P <login_password> -h <esx_host> -l
2 ChoosetheVMXfileforthevirtualmachineofinterest.
Bydefault,thevirtualdiskfilehasthesamenameastheVMXfilebuthasa.vmdkextension.
3 (Optional)UsevifstoverifythatyouareusingthecorrectVMDKfile.
To relocate a virtual machine’s storage (including disks)
1 Determinethepathtothevirtualmachineconfigurationfile.
2Runsvmotion:
svmotion
--url=https://myvc.mycorp.com/sdk --datacenter=DC1
--vm=”[storage1] myvm/myvm.vmx:new_datastore”
TheexampleisforWindows.UsesinglequotesonLinux.
To relocate a virtual machine’s configuration file, but leave virtual disks
1 Determinethepathtothevirtualdiskfilesandthevirtualmachineconfigurationfile.
2Runsvmotion,forexample:
svmotion
<conn_options>
--datacenter='My DC'
--vm='[old_datastore] myvm/myvm.vmx:new_datastore'
--disks='[old_datastore] myvm/myvm_1.vmdk:old_datastore, [old_datastore] myvm/myvm_2.vmdk:
old_datastore'
Thiscommandrelocatesthevirtualmachineʹsconfigurationfiletonew_datastore,butleavesthetwodisks
(myvm_1.vmdkandmyvm_2.vmdk)inold_datastore.TheexampleisforLinux.Usedoublequoteson
Windows.Thesquarebracketssurroundthedatastorenameanddonotindicateanoptionalelement.
Configuring FCoE Adapters
ESXicanuseFibreChanneloverEthernet(FCoE)adapterstoaccessFibreChannelstorage.
TheFCoEprotocolencapsulatesFibreChannelframesintoEthernetframes.Asaresult,yourhostdoesnot
needspecialFibreChannellinkstoconnecttoFibreChannelstorage,butcanuse10GbitlosslessEthernetto
deliverFibreChanneltraffic.
IMPORTANTWhenyourunsvmotion,--servermustpointtoavCenterServersystem.
Getting Started with vSphere Command-Line Interfaces
58 VMware, Inc.
TouseFCoE,youneedtoinstallFCoEadapters.TheadaptersthatVMwaresupportsgenerallyfallintotwo
categories,hardwareFCoEadaptersandsoftwareFCoEadapters.
HardwareFCoEAdapters.HardwareFCoEadaptersincludecompletelyoffloadedspecialized
ConvergedNetworkAdapters(CNAs)thatcontainnetworkandFibreChannelfunctionalitiesonthe
samecard.Whensuchanadapterisinstalled,yourhostdetectsandcanusebothCNAcomponents.In
thevSphereWebClient,thenetworkingcomponentappearsasastandardnetworkadapter(vmnic)and
theFibreChannelcomponentasaFCoEadapter(vmhba).YoudonothavetoconfigureahardwareFCoE
adaptertobeabletouseit.
SoftwareFCoEAdapters.AsoftwareFCoEadapterisasoftwarecodethatperformssomeoftheFCoE
processing.TheadaptercanbeusedwithanumberofNICsthatsupportpartialFCoEoffload.Unlikethe
hardwareFCoEadapter,thesoftwareadaptermustbeactivated.
Scanning Storage Adapters
Youmustperformarescanoperationeachtimeyoureconfigureyourstoragesetup.Youcanscanusingthe
vSphereWebClient,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|--typeSpecifythetypeofscantoperform.Thecommandeitherscansforallchanges(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.
Retrieving SMART Information
YoucanuseESXCLItoretrieveinformationrelatedtoSMART.SMARTisamonitoringsystemforcomputer
harddisksthatreportsinformationaboutthedisks.
esxcli storage core device smart get -d device
WhatthecommandreturnsdependsonthelevelofSMARTinformationthatthedevicesupports.Ifno
informationisavailableforaparameter,theoutputdisplaysN/A,asinthefollowingsampleoutput.
Parameter Value Threshold Worst
-----------------------------------------------------
Health Status OK N/A N/A
Media Wearout Indicator N/A N/A N/A
Write Error Count N/A N/A N/A
Read Error Count 119 6 74
Power-on Hours 57 0 57
Power Cycle Count 100 20 100
Reallocated Sector Count 100 36 100
VMware, Inc. 59
Chapter 4 Managing Storage
Raw Read Error Rate 119 6 74
Drive Temperature 38 0 49
Driver Rated Max Temperature 62 45 51
Write Sectors TOT Count 200 0 200
Read Sectors TOT Count 100 0 253
Initial Bad Block Count N/A N/A N/A
Getting Started with vSphere Command-Line Interfaces
60 VMware, Inc.
VMware, Inc. 59
53
ESXisystemsincludeiSCSItechnologytoaccessremotestorageusinganIPnetwork.YoucanusethevSphere
WebClient,commandsintheesxcliiscsinamespace,orthevicfg-iscsicommandtoconfigureboth
hardwareandsoftwareiSCSIstorageforyourESXisystem.
Thischapterincludesthefollowingtopics:
“iSCSIStorageOverview”onpage 59
“ProtectinganiSCSISAN”onpage 61
“CommandSyntaxforesxcliiscsiandvicfgiscsi”onpage 63
“iSCSIStorageSetupwithESXCLI”onpage 68
“iSCSIStorageSetupwithvicfgiscsi”onpage 73
“ListingandSettingiSCSIOptions”onpage 77
“ListingandSettingiSCSIParameters”onpage 78
“EnablingiSCSIAuthentication”onpage 82
“SettingUpPortsforiSCSIMultipathing”onpage 83
“ManagingiSCSISessions”onpage 84
SeethevSphereStoragedocumentationforadditionalinformation.
iSCSI Storage Overview
WithiSCSI,SCSIstoragecommandsthatyourvirtualmachineissuestoitsvirtualdiskareconvertedinto
TCP/IPprotocolpacketsandtransmittedtoaremotedevice,ortarget,onwhichthevirtualdiskislocated.To
thevirtualmachine,thedeviceappearsasalocallyattachedSCSIdrive.
Toaccessremotetargets,theESXihostusesiSCSIinitiators.InitiatorstransportSCSIrequestsandresponses
betweenESXiandthetargetstoragedeviceontheIPnetwork.ESXisupportsthesetypesofinitiators:
SoftwareiSCSIadapter.VMwarecodebuiltintotheVMkernel.AllowsanESXihosttoconnecttothe
iSCSIstoragedevicethroughstandardnetworkadapters.ThesoftwareinitiatorhandlesiSCSIprocessing
whilecommunicatingwiththenetworkadapter.
HardwareiSCSIadapter.OffloadsalliSCSIandnetworkprocessingfromyourhost.HardwareiSCSI
adaptersarebrokenintotwotypes.
DependenthardwareiSCSIadapter.LeveragestheVMwareiSCSImanagementandconfiguration
interfaces.
IndependenthardwareiSCSIadapter.LeveragesitsowniSCSImanagementandconfiguration
interfaces.
SeethevSphereStoragedocumentationfordetailsonsetupandfailoverscenarios.
Managing iSCSI Storage 5
vSphere Command-Line Interface Concepts and Examples
60 VMware, Inc.
YoumustconfigureiSCSIinitiatorsforthehosttoaccessanddisplayiSCSIstoragedevices.
Figure 51depictshoststhatusedifferenttypesofiSCSIinitiators.
ThehostontheleftusesanindependenthardwareiSCSIadaptertoconnecttotheiSCSIstoragesystem.
ThehostontherightusessoftwareiSCSI.
DependenthardwareiSCSIcanbeimplementedindifferentwaysandisnotshown.iSCSIstoragedevices
fromthestoragesystembecomeavailabletothehost.YoucanaccessthestoragedevicesandcreateVMFS
datastoresforyourstorageneeds.
Figure 5-1. iSCSI Storage
Discovery Sessions
AdiscoverysessionispartoftheiSCSIprotocol.Thediscoverysessionreturnsthesetoftargetsthatyoucan
accessonaniSCSIstoragesystem.ESXisystemssupportdynamicandstaticdiscovery.
Dynamicdiscovery.AlsoknownasSendTargetsdiscovery.EachtimetheESXihostcontactsaspecified
iSCSIstorageserver,itsendsaSendTargetsrequesttotheserver.Inresponse,theiSCSIstorageserver
suppliesalistofavailabletargetstotheESXihost.Monitorandmanagewithesxcli iscsi adapter
discovery sendtargetorvicfg-iscsicommands.
Staticdiscovery.TheESXihostdoesnothavetoperformdiscovery.Instead,theESXihostusestheIP
addressesordomainnamesandiSCSItargetnames(IQNorEUIformatnames)tocommunicatewiththe
iSCSItarget.Monitorandmanagewithesxcli iscsi adapter discovery statictargetor
vicfg-iscsicommands.
Foreithercase,yousetuptargetdiscoveryaddressessothattheinitiatorcandeterminewhichstorage
resourceonthenetworkisavailableforaccess.Youcandothissetupwithdynamicdiscoveryorstatic
discovery.Withdynamicdiscovery,alltargetsassociatedwithanIPaddressorhostnameandtheiSCSIname
arediscovered.Withstaticdiscovery,youmustspecifytheIPaddressorhostnameandtheiSCSInameofthe
targetyouwanttoaccess.TheiSCSIHBAmustbeinthesameVLANasbothportsoftheiSCSIarray.
IP network
hardware
iSCSI
host 1
SP
iSCSI storage
HBA2 HBA1
software
iSCSI
host 2
NIC2 NIC1
software
adapter
VMware, Inc. 61
Chapter 5 Managing iSCSI Storage
Discovery Target Names
ThetargetnameiseitheranIQNnameoranEUIname.
TheIQNnameusesthefollowingformat:
iqn.yyyy-mm.{reversed domain name}:id_string
Forexample:iqn.2007-05.com.mydomain:storage.tape.sys3.abc
TheESXihostgeneratesanIQNnameforsoftwareiSCSIanddependenthardwareiSCSIadapters.You
canchangethatdefaultIQNname.
TheEUInameisdescribedinIETFrfc3720asfollows:
TheIEEERegistrationAuthorityprovidesaserviceforassigninggloballyuniqueidentifiers[EUI].The
EUI64formatisusedtobuildaglobalidentifierinothernetworkprotocols.Forexample,FibreChannel
definesamethodofencodingitintoaWorldWideName.
Theformatiseui.followedbyanEUI64identifier(16ASCIIencodedhexadecimaldigits).
Forexample:
Type EUI-64 identifier (ASCII-encoded hexadecimal)
+--++--------------+
| || |
eui.02004567A425678D
TheIEEEEUI64iSCSInameformatcanbeusedwhenamanufacturerisregisteredwiththeIEEE
RegistrationAuthorityandusesEUI64formattedworldwideuniquenamesforitsproducts.
CheckintheUIofthestoragearraywhetheranarrayusesanIQNnameoranEUIname.
Protecting an iSCSI SAN
YouriSCSIconfigurationisonlyassecureasyourIPnetwork.Byenforcinggoodsecuritystandardswhenyou
setupyournetwork,youhelpsafeguardyouriSCSIstorage.
Protecting Transmitted Data
AprimarysecurityriskiniSCSISANsisthatanattackermightsnifftransmittedstoragedata.Neitherthe
iSCSIadapternortheESXihostiSCSIinitiatorencryptsthedatathatittransmitstoandfromthetargets,
makingthedatavulnerabletosniffingattacks.Youmustthereforetakeadditionalmeasurestoprevent
attackersfromeasilyseeingiSCSIdata.
AllowingyourvirtualmachinestosharevirtualswitchesandVLANswithyouriSCSIconfiguration
potentiallyexposesiSCSItraffictomisusebyavirtualmachineattacker.Tohelpensurethatintruderscannot
listentoiSCSItransmissions,makesurethatnoneofyourvirtualmachinescanseetheiSCSIstoragenetwork.
ProtectyoursystembygivingtheiSCSISANadedicatedvirtualswitch.
IfyouuseanindependenthardwareiSCSIadapter,makesurethattheiSCSIadapterandESXiphysical
networkadapterarenotinadvertentlyconnectedoutsidethehost.Suchaconnectionmightresultfrom
sharingaswitch.
Ifyouusedependenthardwareorsoftwareiscsiadapter,whichusesESXinetworking,configureiSCSI
storagethroughadifferentvirtualswitchthantheoneusedbyyourvirtualmachines.
YoucanalsoconfigureyouriSCSISANonitsownVLANtoimproveperformanceandsecurity.Placingyour
iSCSIconfigurationonaseparateVLANensuresthatnodevicesotherthantheiSCSIadaptercansee
transmissionswithintheiSCSISAN.WithadedicatedVLAN,networkcongestionfromothersourcescannot
interferewithiSCSItraffic.
vSphere Command-Line Interface Concepts and Examples
62 VMware, Inc.
Securing iSCSI Ports
WhenyouruniSCSIdevices,theESXihostdoesnotopenportsthatlistenfornetworkconnections.This
measurereducesthechancesthatanintrudercanbreakintotheESXihostthroughspareportsandgaincontrol
overthehost.Therefore,runningiSCSIdoesnotpresentanadditionalsecurityrisksattheESXihostendof
theconnection.
AniSCSItargetdevicemusthaveoneormoreopenTCPportstolistenforiSCSIconnections.Ifsecurity
vulnerabilitiesexistintheiSCSIdevicesoftware,yourdatacanbeatriskthroughnofaultoftheESXisystem.
Tolowerthisrisk,installallsecuritypatchesthatyourstorageequipmentmanufacturerprovidesandlimitthe
devicesconnectedtotheiSCSInetwork.
Setting iSCSI CHAP
iSCSIstoragesystemsauthenticateaninitiatorusinganameandkeypair.ESXisystemssupportChallenge
HandshakeAuthenticationProtocol(CHAP),whichVMwarerecommendsforyourSANimplementation.
TheESXihostandtheiSCSIstoragesystemmusthaveCHAPenabledandmusthavecommoncredentials.
DuringiSCSIlogin,theiSCSIstoragesystemexchangesitscredentialswiththeESXisystemandchecksthem.
YoucansetupiSCSIauthenticationbyusingthevSphereWebClient,asdiscussedinthevSphereStorage
documentationorbyusingtheesxclicommand,discussedin“EnablingiSCSIAuthentication”onpage 82.
TouseCHAPauthentication,youmustenableCHAPonboththeinitiatorsideandthestoragesystemside.
Afterauthenticationisenabled,itappliesfortargetstowhichnoconnectionhasbeenestablished,butdoesnot
applytotargetstowhichaconnectionisestablished.Afterthediscoveryaddressisset,thenewvolumesto
whichyouaddaconnectionareexposedandcanbeused.
ForsoftwareiSCSIanddependenthardwareiSCSI,ESXihostssupportperdiscoveryandpertargetCHAP
credentials.ForindependenthardwareiSCSI,ESXihostssupportonlyonesetofCHAPcredentialsper
initiator.YoucannotassigndifferentCHAPcredentialsfordifferenttargets.
WhenyouconfigureindependenthardwareiSCSIinitiators,ensurethattheCHAPconfigurationmatches
youriSCSIstorage.IfCHAPisenabledonthestoragearray,itmustbeenabledontheinitiator.IfCHAPis
enabled,youmustsetuptheCHAPauthenticationcredentialsontheESXihosttomatchthecredentialson
theiSCSIstorage.
Supported CHAP Levels
TosetCHAPlevelswithesxcli iscsi adapter setauthorvicfg-iscsi,specifyoneofthevaluesin
Table 51for<level>.OnlytwolevelsaresupportedforindependenthardwareiSCSI.
MutualCHAPissupportedforsoftwareiSCSIandfordependenthardwareiSCSI,butnotforindependent
hardwareiSCSI.
IMPORTANTEnsurethatCHAPissettochapRequiredbeforeyousetmutualCHAP,andusecompatible
levelsforCHAPandmutualCHAP.UsedifferentpasswordsforCHAPandmutualCHAPtoavoidsecurity
risks.
Table 5-1. Supported Levels for CHAP
Level Description Supported
chapProhibitedHostdoesnotuseCHAPauthentication.Ifauthenticationis
enabled,specifychapProhibitedtodisableit.
SoftwareiSCSI
DependenthardwareiSCSI
IndependenthardwareiSCSI
chapDiscouraged HostusesanonCHAPconnection,butallowsaCHAP
connectionasfallback.
SoftwareiSCSI
DependenthardwareiSCSI
chapPreferred HostusesCHAPiftheCHAPconnectionsucceeds,butuses
nonCHAPconnectionsasfallback.
SoftwareiSCSI
DependenthardwareiSCSI
IndependenthardwareiSCSI
chapRequired HostrequiressuccessfulCHAPauthentication.Theconnection
failsifCHAPnegotiationfails.
SoftwareiSCSI
DependenthardwareiSCSI
VMware, Inc. 63
Chapter 5 Managing iSCSI Storage
Returning Authentication to Default Inheritance
ThevaluesofiSCSIauthenticationsettingsassociatedwithadynamicdiscoveryaddressorastaticdiscovery
targetareinheritedfromthecorrespondingsettingsoftheparent.Forthedynamicdiscoveryaddress,the
parentistheadapter.Forthestatictarget,theparentistheadapterordiscoveryaddress.
IfyouusethevSphereWebClienttomodifyauthenticationsettings,youmustdeselecttheInheritfrom
Parentcheckboxbeforeyoucanmakeachangetothediscoveryaddressordiscoverytarget.
Ifyouusevicfg-iscsi,thevalueyousetoverridestheinheritedvalue.
Ifyouuseesxcli iscsicommands,thevalueyousetoverridestheinheritedvalue.YoucansetCHAP
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
itsinheritedvalue.Inthatcase,useoneofthefollowingcommands:
Dynamicdiscovery:esxcli iscsi adapter discovery sendtarget auth chap set --inherit
Staticdiscovery:esxcli iscsi adapter target portal auth chap set --inherit.
Command Syntax for esxcli iscsi and vicfg-iscsi
InvSphere5.0andlater,youcanmanageiSCSIstoragebyusingeitheresxcli iscsicommandsor
vicfg-iscsioptions.SeethevSphereCommandLineInterfaceReference.“esxcliiscsiCommandSyntax”on
page 63and“vicfgiscsiCommandSyntax”onpage 65provideanoverview.
esxcli iscsi Command Syntax
Theesxcli iscsicommandincludesanumberofnestednamespaces.Thefollowingtableillustratesthe
namespacehierarchy.Commandsateachlevelareincludedinbold.Manynamespacesincludeboth
commandsandnamespaces.
NOTEYoucansettargetlevelCHAPauthenticationpropertiestobeinheritedfromthesendtargetleveland
setsendtargetlevelCHAPauthenticationpropertiestobeinheritedfromtheadapterlevel.Resetting
adapterlevelpropertiesisnotsupported.
Table 5-2. esxcli iscsi Command Overview
adapter[get|list|set]auth chap[set|get]
discovery
[rediscover]
sendtarget
[add|list|remove]
auth chap[get|set]
param[get|set]
statictarget
[add|list|remove]
statusget
target[list]portal[list]auth chap[get|set]
param[get|set]
capabilitiesget
firmware[get|set]
param[get|set]
vSphere Command-Line Interface Concepts and Examples
64 VMware, Inc.
Key to esxcli iscsi Short Options
ESXCLIcommandsforiSCSImanagementconsistentlyusethesameshortoptions.Forseveraloptions,the
associatedfulloptiondependsonthecommand.
networkportal
[add|list|remove]
ipconfig[get|set]
physicalnetworkportal
[list]
param[get|set]
session[add|list|remove]connectionlist
ibftboot[get|import]
logicalnetworkportallist
pluginlist
software[get|set]
Table 5-2. esxcli iscsi Command Overview
Table 5-3. Short Options for iSCSI ESXCLI Command Options
Lower-case Option Option Upper-case Option Option Number Option
a --address, alias A --adapter 1 --dns1
c --cid 2 --dns2
d --direction D --default
f --file, force
g --gateway
i --ip I --inherit
k --key
l --level
m --method M --module
n --nic N --authname,
--name
o --option
p --plugin
s --isid, subnet,
switch
S --state, secret
v --value
VMware, Inc. 65
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>
Enablesmutualauthentication.
Youmustenableauthentication
beforeyoucanenablemutual
authentication.
-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>
Enablesauthenticationusingthe
specifiedoptions.
-A --authentication
-l <adapter_name>
--list <adapter_name>
Listssupportedauthentication
methods.
-D --discovery
-a -i <stor_ip_addr|stor_hostname[:<portnum>] <adapter_name>
--add --ip <stor_ip_addr|stor_hostname> [:<portnum>]
<adapter_name>
Addsadynamicdiscovery
address.
-D --discovery
-l <adapter_name>
--list <adapter_name>
Listsdynamicdiscovery
addresses.
-D --discovery
-r -i <stor_ip_addr|stor_hostname>[:<portnum>] <adapter_name>
--remove --ip <stor_ip_addr|stor_hostname> [:<portnum>]
<adapter_name>
Removesadynamicdiscovery
address.
-H
-l [<adapter_name>]
--list [<adapter_name>]
ListsalliSCSIadaptersora
specifiedadapter.
-L --lun
-l <adapter_name>
--list <adapter_name>
ListsLUNinformation.
vSphere Command-Line Interface Concepts and Examples
66 VMware, Inc.
-L --lun
-l -t <target_ID> <adapter_name>
--list --target_id <target_id> <adapter_name>
ListsLUNinformationfora
specifictarget.
-N --network (Independent hardware iSCSI only)
-l <adapter_name>
--list <adapter_name>
Listsnetworkproperties.
-N --network (Independent hardware iSCSI only)
-i <ip_addr> <adapter_name>
--ip <ip_addr> <vmhba>
SetstheHBAIPv4addressto
ip_addr.
-N --network (Independent hardware iSCSI only)
-s <subnet_mask> <adapter_name>
--subnetmask <subnet_mask> <adapter_name>
SetstheHBAnetworkmaskto
subnet_mask.
-N --network (Independent hardware iSCSI only)
-g <default_gateway> <adapter_name>
--gateway <default_gateway> <adapter_name>
SetstheHBAgatewayto
default_gateway.
-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>
SetstheIPaddress,subnetmask,
anddefaultgatewayinone
command.
-p --pnp (Independent hardware iSCSI only)
-l <adapter_name>
--list <adapter_name>
Listsphysicalnetworkportal
options.
-p --pnp (Independent hardware iSCSI only)
-M <mtu_size> <adapter_name>
--mtu <mtu-size> <adapter_name>
Setsphysicalnetworkportal
options.
-I --iscsiname
-a <alias_name> <adapter_name>
--alias <alias_name> <adapter_name>
SetstheiSCSIinitiatoralias.
-I --iscsiname
-n <iscsi_name> <adapter_name>
--name <iscsi_name> <adapter_name>
SetstheiSCSIinitiatorname.
-I --iscsiname
-l <adapter_name>
--list <adapter_name>
ListsiSCSIinitiatoroptions.
-M --mtu
-p -M <mtu_size> <adapter_name>
--pnp --mtu <mtu-size> <adapter_name>
SetsMTUsize.Usedwiththe
--pnpoption.
-S --static
-l <adapter_name>
--list <adapter_name>
Listsstaticdiscoveryaddresses.
-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.
Table 5-4. Options for vicfg-iscsi (Continued)
Option Suboptions Description
VMware, Inc. 67
Chapter 5 Managing iSCSI Storage
-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>
Addsastaticdiscoveryaddress.
-P --phba
-l <adapter_name>
--list <adapter_name>
Listsexternal,vendorspecific
propertiesofaniSCSIadapter.
-T --target
-l <adapter_name>
--list <adapter_name>
Liststargetinformation.
-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>
ListsiSCSIparameter
information.
-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>
ListsiSCSIparameterdetails.
-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>
SetsiSCSIparameters.
-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>
Returnsparametersindiscovery
targetorsendtargettodefault
inheritancebehavior.
-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
adapterlevel.Usedwiththe
--authenticationoption.
Table 5-4. Options for vicfg-iscsi (Continued)
Option Suboptions Description
vSphere Command-Line Interface Concepts and Examples
68 VMware, Inc.
iSCSI Storage Setup with ESXCLI
YoucansetupiSCSIstorageusingvSphereWebClient,commandsintheesxcli iscsinamespace,or
vicfg-iscsicommands(see“iSCSIStorageSetupwithvicfgiscsi”onpage 73).
Setting Up Software iSCSI with ESXCLI
SoftwareiSCSIsetuprequiresseveraltasks.Foreachtask,seethediscussionofthecorrespondingcommand
inthischapterorthereferenceinformationavailablefromesxcli iscsi --helpandtheVMware
DocumentationCenter.Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagement
Commands”onpage 18inplaceof<conn_options>
1EnablesoftwareiSCSI.
esxcli <conn_options> iscsi software set --enabled=true
2Checkwhetheranetworkportal,thatis,aboundport,existsforiSCSItraffic.
esxcli <conn_options> iscsi adapter list
3Ifnoadapterexists,addone.SoftwareiSCSIdoesnotrequireportbinding,butrequiresthatatleastone
VMkernelNICisavailableandcanbeusedasaniSCSINIC.Youcannametheadapterasyouaddit.
esxcli <conn_options> iscsi networkportal add -n <portal_name> -A <vmhba>
4 (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>
6Addadynamicdiscoveryaddressorastaticdiscoveryaddress.
Thetwotypesoftargetdifferasfollows:
Withdynamicdiscovery,allstoragetargetsassociatedwithahostnameorIPaddressarediscovered.
Yourunthefollowingcommand.
esxcli <conn_options> iscsi adapter discovery sendtarget add --address=<ip/dns[:port]>
--adapter=<adapter_name>
Withstaticdiscovery,youmustspecifythehostnameorIPaddressandtheiSCSInameofthestorage
target.Yourunthefollowingcommand.
esxcli <conn_options> iscsi adapter discovery statictarget add --address=<ip/dns[:port]>
--adapter=<adapter_name> --name=<target_name>
Whenyoulaterremoveadiscoveryaddress,itmightstillbedisplayedastheparentofastatictarget.You
canaddthediscoveryaddressandrescantodisplaythecorrectparentforthestatictargets.
7 (Optional)SettheauthenticationinformationforCHAP(see“SettingiSCSICHAP”onpage 62and
“EnablingiSCSIAuthentication”onpage 82).YoucansetpertargetCHAPforstatictargets,peradapter
CHAP,orapplythecommandtothediscoveryaddress.
VMware, Inc. 69
Chapter 5 Managing iSCSI Storage
Table 51,“SupportedLevelsforCHAP,”onpage 62listswhateachsupportedleveldoes.
Forexample:
esxcli <conn_options> iscsi adapter auth chap set --direction=uni --chap_username=<name>
--chap_password=<pwd> --level=preferred --secret=uni_secret --adapter=vmhba33
8 (Optional)SettheauthenticationinformationformutualCHAPbyrunningesxcli iscsi adapter
auth chap set againwith--directionsettomutualandadifferentauthenticationusernameand
secret.
9 (Optional)SetiSCSIparameters.
See“ListingandSettingiSCSIParameters”onpage 78
10 Aftersetupiscomplete,performrediscoveryandrescanallstoragedevices.Forexample:
esxcli <conn_options> iscsi adapter discovery rediscover
esxcli <conn_options> storage core adapter rescan --adapter=vmhba36
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>
Discoverylevel
CHAP
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>
Targetlevel
CHAP
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>
Adapterlevel
CHAP
esxcli iscsi adapter auth chap set --direction=mutual
--mchap_username=<name2> --mchap_password=<pwd2>
--level=[prohibited required] --secret=<string2>
--adapter=<vmhba>
Discoverylevel
CHAP
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>
Targetlevel
CHAP
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>
IMPORTANTYouareresponsibleformakingsurethatCHAPissetbeforeyousetmutualCHAP,andfor
usingcompatiblelevelsforCHAPandmutualCHAP.
Adapterlevel
parameters
esxcli iscsi adapter param set --adapter=<vmhba> --key=<key>
--value=<value>
Discoverylevel
parameters
esxcli iscsi adapter discovery sendtarget param set --adapter=<vmhba>
--key=<key> --value=<value>
--address=<sendtarget_address>
Targetlevel
parameters
esxcli iscsi adapter target portal param set --adapter=<vmhba>
--key=<key> --value=<value> --address=<address>
--name=<iqn.name>
vSphere Command-Line Interface Concepts and Examples
70 VMware, Inc.
11 (Optional)IfyouwanttomakeadditionaliSCSIloginparameterchanges(see“ListingandSettingiSCSI
Parametersonpage 78),youmustlogoutofthecorrespondingiSCSIsessionandlogbackin.
aRunesxcli iscsi session removetologout.
bRunesxcli iscsi session addorrescantheadaptertoaddthesessionback.
Setting Up Dependent Hardware iSCSI with ESXCLI
DependenthardwareiSCSIsetuprequiresseveralhighleveltasks.Foreachtask,seethediscussionofthe
correspondingcommandinthischapterorthereferenceinformationavailablefromesxcli iscsi --help
andtheVMwareDocumentationCenter.Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLI
HostManagementCommands”onpage 18inplaceof<conn_options>.
1 DeterminetheiSCSIadaptertypeandretrievetheiSCSIadapterID.
esxcli <conn_options> iscsi adapter list
2 (Optional)SettheiSCSInameandalias.
esxcli <conn_options> iscsi adapter set --adapter <adapter_name> --name=<name>
esxcli <conn_options> iscsi adapter set --adapter <adapter_name> --alias=<alias>
3Setupportbindingbyfollowingthesesteps:
aIdentifytheVMkernelportofthedependenthardwareiSCSIadapter.
esxcli <conn_options> iscsi logicalnetworkportal list --adapter=<adapter_name>
b ConnectthedependenthardwareiSCSIinitiatortotheiSCSIVMkernelportsbyrunningthe
followingcommandforeachport.
esxcli <conn_options> iscsi networkportal add --nic=<bound_vmknic>
--adapter=<iscsi_adapter>
cVerifythattheportswereaddedtothedependenthardwareiSCSIinitiator.
esxcli <conn_options> iscsi physicalnetworkportal list --adapter=<adapter_name>
4Addadynamicdiscoveryaddressorastaticdiscoveryaddress.
Thetwotypesoftargetdifferasfollows:
Withdynamicdiscovery,allstoragetargetsassociatedwithahostnameorIPaddressarediscovered.
Yourunthefollowingcommand.
esxcli <conn_options> iscsi adapter discovery sendtarget add --address=<ip/dns[:port]>
--adapter=<adapter_name>
Withstaticdiscovery,youmustspecifythehostnameorIPaddressandtheiSCSInameofthestorage
target.Yourunthefollowingcommand.
esxcli <conn_options> iscsi adapter discovery statictarget add --address=<ip/dns[:port]>
--adapter=<adapter_name> --name=<target_name>
Whenyoulaterremoveadiscoveryaddress,itmightstillbedisplayedastheparentofastatictarget.You
canaddthediscoveryaddressandrescantodisplaythecorrectparentforthestatictargets.
5 (Optional)SettheauthenticationinformationforCHAP(see“SettingiSCSICHAP”onpage 62and
“EnablingiSCSIAuthentication”onpage 82).YoucansetpertargetCHAPforstatictargets,peradapter
CHAP,orapplythecommandtothediscoveryaddress.
VMware, Inc. 71
Chapter 5 Managing iSCSI Storage
Table 51,“SupportedLevelsforCHAP,”onpage 62listswhateachsupportedleveldoes.
Forexample:
esxcli <conn_options> iscsi adapter auth chap set --direction=uni --chap_username=<name>
--chap_password=<pwd> --level=preferred --secret=uni_secret --adapter=vmhba33
6 (Optional)SettheauthenticationinformationformutualCHAPbyrunningesxcli iscsi adapter
auth chap set againwith--directionsettomutualandadifferentauthenticationusernameand
secret.
7 (Optional)SetiSCSIparameters.
See“ListingandSettingiSCSIParameters”onpage 78
8Aftersetupiscomplete,performrediscoveryandrescanallstoragedevices.Forexample:
esxcli <conn_options> iscsi adapter discovery rediscover
esxcli <conn_options> storage core adapter rescan --adapter=vmhba36
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>
Discoverylevel
CHAP
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>
Targetlevel
CHAP
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>
Adapterlevel
CHAP
esxcli iscsi adapter auth chap set --direction=mutual
--mchap_username=<name> --mchap_password=<pwd>
--level=[prohibited required] --secret=<string2>
--adapter=<vmhba>
Discoverylevel
CHAP
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>
Targetlevel
CHAP
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>
IMPORTANTYouareresponsibleformakingsurethatCHAPissetbeforeyousetmutualCHAP,andfor
usingcompatiblelevelsforCHAPandmutualCHAP.
Adapterlevel
parameters
esxcli iscsi adapter param set --adapter=<vmhba> --key=<key>
--value=<value>
Discoverylevel
parameters
esxcli iscsi adapter discovery sendtarget param set --adapter=<vmhba>
--key=<key> --value=<value>
--address=<sendtarget_address>
Targetlevel
parameters
esxcli iscsi adapter target portal param set --adapter=<vmhba>
--key=<key> --value=<value> --address=<address>
--name=<iqn.name>
vSphere Command-Line Interface Concepts and Examples
72 VMware, Inc.
9 (Optional)IfyouwanttomakeadditionaliSCSIloginparameterchanges(see“ListingandSettingiSCSI
Parametersonpage 78),youmustlogoutofthecorrespondingiSCSIsessionandlogbackin.
aRunesxcli iscsi session removetologout.
bRunesxcli iscsi session addorrescantheadaptertoaddthesessionback.
Setting Up Independent Hardware iSCSI with ESXCLI
WithindependenthardwarebasediSCSIstorage,youuseaspecializedthirdpartyadaptercapableof
accessingiSCSIstorageoverTCP/IP.ThisiSCSIinitiatorhandlesalliSCSIandnetworkprocessingand
managementforyourESXisystem.
YoumustinstallandconfiguretheindependenthardwareiSCSIadapterforyourhostbeforeyoucanaccess
theiSCSIstoragedevice.Forinstallationinformation,seevendordocumentation.
HardwareiSCSIsetuprequiresanumberofhighleveltasks.Foreachtask,seethediscussionofthe
correspondingcommandlineoptioninthischapterorthereferenceinformation.Specifyoneoftheoptions
listedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof
<conn_options>.
1 DeterminetheiSCSIadaptertypeandretrievetheiSCSIadapterID.
esxcli <conn_options> iscsi adapter list
2Configurethehardwareinitiator(HBA)byrunningesxcli iscsi networkportal ipconfig withone
ormoreofthefollowingoptions.
3 (Optional)SettheiSCSInameandalias.
esxcli <conn_options> iscsi adapter set --adapter <adapter_name> --name=<name>
esxcli <conn_options> iscsi adapter set --adapter <adapter_name> --alias=<alias>
4Addadynamicdiscoveryaddressorastaticdiscoveryaddress.
Thetwotypesoftargetdifferasfollows:
Withdynamicdiscovery,allstoragetargetsassociatedwithahostnameorIPaddressarediscovered.
Yourunthefollowingcommand.
esxcli <conn_options> iscsi adapter discovery sendtarget add --address=<ip/dns[:port]>
--adapter=<adapter_name>
Withstaticdiscovery,youmustspecifythehostnameorIPaddressandtheiSCSInameofthestorage
target.Yourunthefollowingcommand.
esxcli <conn_options> iscsi adapter discovery statictarget add --address=<ip/dns[:port]>
5 (Optional)SettheauthenticationinformationforCHAP(see“SettingiSCSICHAP”onpage 62and
“EnablingiSCSIAuthentication”onpage 82).YoucansetpertargetCHAPforstatictargets,peradapter
CHAP,orapplythecommandtothediscoveryaddress.
-A|--adapter=<str> iSCSIadaptername.(required).
-1|--dns1=<str> iSCSInetworkportalprimaryDNSaddress.
-2|--dns2=<str> iSCSInetworkportalsecondaryDNSaddress.
-g|--gateway=<str> iSCSInetworkportalgatewayaddress.
-i|--ip=<str> iSCSInetworkportalIPaddress(required).
-n|--nic=<str> iSCSInetworkportal(vmknic).
-s|--subnet=<str> iSCSInetworkportalsubnetmask(required).
VMware, Inc. 73
Chapter 5 Managing iSCSI Storage
Table 51,“SupportedLevelsforCHAP,”onpage 62listswhateachsupportedleveldoes.
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.
See“ListingandSettingiSCSIParameters”onpage 78
7Aftersetupiscomplete,runesxcli storage core adapter rescan --adapter=<iscsi_adapter>
torescanallstoragedevices.
8Aftersetupiscomplete,performrediscoveryandrescanallstoragedevices.Forexample:
esxcli <conn_options> iscsi adapter discovery rediscover
esxcli <conn_options> storage core adapter rescan --adapter=vmhba36
iSCSI Storage Setup with vicfg-iscsi
YoucansetupiSCSIstorageusingthevSphereWebClient,commandsintheesxcli iscsinamespace(see
“iSCSIStorageSetupwithESXCLI”onpage 68)orthevicfg-iscsicommand.
Setting Up Software iSCSI with vicfg-iscsi
SoftwareiSCSIsetuprequiresanumberofhighleveltasks.Foreachtask,seethediscussionofthe
correspondingcommandlineoptioninthischapterorthereferenceinformation.Specifyoneoftheoptions
listedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof
<conn_options>.
1 DeterminetheHBAtypeandretrievetheHBAID.
vicfg-iscsi <conn_options> --adapter --list
2EnablesoftwareiSCSIfortheHBA.
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>
Discoverylevel
CHAP
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>
Targetlevel
CHAP
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>
Adapterlevel
parameters
esxcli iscsi adapter param set --adapter=<vmhba> --key=<key>
--value=<value>
Discoverylevel
parameters
esxcli iscsi adapter discovery sendtarget param set --adapter=<vmhba>
--key=<key> --value=<value>
--address=<sendtarget_address>
Targetlevel
parameters
esxcli iscsi adapter target portal param set --adapter=<vmhba>
--key=<key> --value=<value> --address=<address>
--name=<iqn.name>
vSphere Command-Line Interface Concepts and Examples
74 VMware, Inc.
vicfg-iscsi <conn_options> --swiscsi --enable
3 (Optional)Checkthestatus.
vicfg-iscsi <conn_options> --swiscsi --list
ThesystemprintsSoftware iSCSI is enabledorSoftware iSCSI is not enabled.
4 (Optional)SettheiSCSInameandalias.
vicfg-iscsi <conn_options> -I -n <iscsi_name> <adapter_name>
vicfg-iscsi <conn_options> --iscsiname --name <iscsi_name> <adapter_name>
vicfg-iscsi <conn_options> -I -a <alias_name> <adapter_name>
vicfg-iscsi <conn_options> --iscsiname --alias <alias_name> <adapter_name>
5Addadynamicdiscoveryaddressorastaticdiscoveryaddress.
Thetwotypesoftargetdifferasfollows:
Withdynamicdiscovery,allstoragetargetsassociatedwithahostnameorIPaddressarediscovered.
Yourunthefollowingcommand:
vicfg-iscsi <conn_options> --discovery --add --ip <ip_addr | domain_name> <adapter_name>
Withstaticdiscovery,youmustspecifythehostnameorIPaddressandtheiSCSInameofthestorage
target.Yourunthefollowingcommand:
vicfg-iscsi <conn_options> --static --add --ip <ip_addr | domain_name>
--name <iscsi_name> <adapter_name>
Whenyoulaterremoveadiscoveryaddress,itmightstillbedisplayedastheparentofastatictarget.You
canaddthediscoveryaddressandrescantodisplaythecorrectparentforthestatictargets.
6 (Optional)SettheauthenticationinformationforCHAP(see“SettingiSCSICHAP”onpage 62and
“EnablingiSCSIAuthentication”onpage 82).
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.
7 (Optional)SettheauthenticationinformationformutualCHAPbyrunningvicfg-iscsi -Aagainwith
the-boptionandadifferentauthenticationusernameandpassword.
For<level>,specifychapProhibitedorchapRequired.
chapProhibitedThehostdoesnotuseCHAPauthentication.Ifauthenticationisenabled,specify
chapProhibitedtodisableit.
chapRequiredThehostrequiressuccessfulCHAPauthentication.TheconnectionfailsifCHAP
negotiationfails.YoucansetthisvalueformutualCHAPonlyifCHAPissettochapRequired.
For<auth_method>,CHAPistheonlyvalidvalue.
8 (Optional)SetiSCSIparametersbyrunningvicfg-iscsi -W.
Option Result
-iand‐n CommandappliestopertargetCHAPforstatictargets.
Only‐i Commandappliestothediscoveryaddress.
Neither-inor‐n CommandappliestoperadapterCHAP.
IMPORTANTYouareresponsibleformakingsurethatCHAPissetbeforeyousetmutualCHAP,andfor
usingcompatiblelevelsforCHAPandmutualCHAP.
VMware, Inc. 75
Chapter 5 Managing iSCSI Storage
9Aftersetupiscomplete,runvicfg-rescantorescanallstoragedevices.
Setting Up Dependent Hardware iSCSI with vicfg-iscsi
DependenthardwareiSCSIsetuprequiresanumberofhighleveltasks.Foreachtask,seethediscussionof
thecorrespondingcommandlineoptioninthischapter,orthereferenceinformation.Specifyoneofthe
optionslistedin“ConnectionOptionsforvCLIHostManagementCommandsonpage 18inplaceof
<conn_options>.
1 DeterminetheHBAtypeandretrievetheHBAID.
vicf-iscsi <conn_options> --adapter --list
2 (Optional)SettheiSCSInameandalias.
vicfg-iscsi <conn_options> -I -n <iscsi_name> <adapter_name>
vicfg-iscsi <conn_options> --iscsiname --name <iscsi_name> <adapter_name>
vicfg-iscsi <conn_options> -I -a <alias_name> <adapter_name>
vicfg-iscsi <conn_options> --iscsiname --alias <alias_name> <adapter_name>
3Setupportbindingbyfollowingthesesteps:
aIdentifytheVMkernelportofthedependenthardwareiSCSIadapter.
esxcli <conn_options> swiscsi vmknic list -d <vmhba>
b ConnectthedependenthardwareiSCSIinitiatortotheiSCSIVMkernelportsbyrunningthe
followingcommandforeachport.
esxcli <conn_options> swiscsi nic add -n <port_name> -d <vmhba>
cVerifythattheportswereaddedtothedependenthardwareiSCSIinitiator.
esxcli <conn_options> swiscsi nic list -d <vmhba>
dRescanthedependenthardwareSCSIinitiator.
vicfg-rescan <conn_options> <vmhba>
4Addadynamicdiscoveryaddressorastaticdiscoveryaddress.
Thetwotypesoftargetdifferasfollows:
Withdynamicdiscovery,allstoragetargetsassociatedwithahostnameorIPaddressarediscovered.
Yourunthefollowingcommand:
vicfg-iscsi <conn_options> --discovery --add --ip <ip_addr | domain_name> <adapter_name>
Withstaticdiscovery,youmustspecifythehostnameorIPaddressandtheiSCSInameofthestorage
target.Yourunthefollowingcommand:
vicfg-iscsi <conn_options> --static --add --ip <ip_addr | domain_name>
--name <iscsi_name> <adapter_name>
Whenyoulaterremoveadiscoveryaddress,itmightstillbedisplayedastheparentofastatictarget.You
canaddthediscoveryaddressandrescantodisplaythecorrectparentforthestatictargets.
5 (Optional)SettheauthenticationinformationforCHAP(see“SettingiSCSICHAP”onpage 62and
“EnablingiSCSIAuthentication”onpage 82).
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.
vSphere Command-Line Interface Concepts and Examples
76 VMware, Inc.
6 (Optional)SettheauthenticationinformationformutualCHAPbyrunningvicfg-iscsi -Aagainwith
the-boptionandadifferentauthenticationusernameandpassword.
For<level>,specifychapProhibitedorchapRequired.
chapProhibitedThehostdoesnotuseCHAPauthentication.Ifauthenticationisenabled,specify
chapProhibitedtodisableit.
chapRequiredThehostrequiressuccessfulCHAPauthentication.TheconnectionfailsifCHAP
negotiationfails.YoucansetthisvalueformutualCHAPonlyifCHAPissettochapRequired.
For<auth_method>,CHAPistheonlyvalidvalue.
7 (Optional)SetiSCSIparametersbyrunningvicfg-iscsi -W.
8Aftersetupiscomplete,runvicfg-rescantorescanallstoragedevices.
Setting Up Independent Hardware iSCSI with vicfg-iscsi
WithindependenthardwarebasediSCSIstorage,youuseaspecializedthirdpartyadaptercapableof
accessingiSCSIstorageoverTCP/IP.ThisiSCSIinitiatorhandlesalliSCSIandnetworkprocessingand
managementforyourESXisystem.
YoumustinstallandconfiguretheindependenthardwareiSCSIadapterforyourhostbeforeyoucanaccess
theiSCSIstoragedevice.Forinstallationinformation,seevendordocumentation.
HardwareiSCSIsetuprequiresanumberofhighleveltasks.Foreachtask,seethediscussionofthe
correspondingcommandlineoptioninthischapter,themanpage(Linux),orthereferenceinformation.
Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18
inplaceof<conn_options>.
1 DeterminetheHBAtypeandretrievetheHBAID.
vicf-iscsi <conn_options> --adapter --list
2Configurethehardwareinitiator(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>
3 (Optional)SettheiSCSInameandalias.
vicfg-iscsi <conn_options> -I -n <iscsi_name> <adapter_name>
vicfg-iscsi <conn_options> --iscsiname --name <iscsi_name> <adapter_name>
vicfg-iscsi <conn_options> -I -a <alias_name> <adapter_name>
Option Result
-iand‐n CommandappliestopertargetCHAPforstatictargets.
Only‐i Commandappliestothediscoveryaddress.
Neither-inor‐n CommandappliestoperadapterCHAP.
IMPORTANTYouareresponsibleformakingsurethatCHAPissetbeforeyousetmutualCHAP,andfor
usingcompatiblelevelsforCHAPandmutualCHAP.
VMware, Inc. 77
Chapter 5 Managing iSCSI Storage
vicfg-iscsi <conn_options> --iscsiname --alias <alias_name> <adapter_name>
4Addadynamicdiscoveryaddressorastaticdiscoveryaddress.
Thetwotypesoftargetdifferasfollows:
Withdynamicdiscovery,allstoragetargetsassociatedwithanIPaddressarediscovered.Runthe
followingcommand:
vicfg-iscsi <conn_options> --discovery --add --ip <ip_addr> <adapter_name>
Withstaticdiscovery,youmustspecifytheIPaddressandtheiSCSInameofthestoragetargettobe
added.Runthefollowingcommand:
vicfg-iscsi <conn_options> --static --add --ip <ip_addr>
--name <iscsi_name> <adapter_name>
Whenyoulaterremoveadiscoveryaddress,itmightstillbedisplayedastheparentofastatictarget.You
canlateraddthediscoveryaddressandrescantodisplaythecorrectparentforthestatictargets.
5 (Optional)SettheauthenticationinformationforCHAPbyrunningvicfg-iscsi -A.
Youcansettheinformationforperadapter,perdiscovery,andpertargetCHAP.See“SettingiSCSI
CHAP”onpage 62and“EnablingiSCSIAuthentication”onpage 82.
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.
MutualCHAPisnotsupportedforindependenthardwareiSCSIstorage.
6 (Optional)SetadditionaliSCSIparametersbyrunningvicfg-iscsi -W.
7Aftersetupiscomplete,callvicfg-rescantorescanallstoragedevices.
Listing and Setting iSCSI Options
YoucanlistandsetiSCSIoptionswithESXCLIorwithvicfg-iscsi.Youcanalsomanageparameters.See
“ListingandSettingiSCSIParameters”onpage 78.
Listing iSCSI Options with ESXCLI
Useesxcli iscsi informationretrievalcommandstolistexternalHBAproperties,informationabout
targets,andLUNs.Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagement
Commands”onpage 18inplaceof<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.
Option Result
-iand‐n CommandappliestopertargetCHAPforstatictargets.
Only‐i Commandappliestothediscoveryaddress.
Neither-inor‐n CommandappliestoperadapterCHAP.
vSphere Command-Line Interface Concepts and Examples
78 VMware, Inc.
Setting MTU with ESXCLI
IfyouwanttochangetheMTUusedforyouriSCSIstorage,youmustmakethechangeintwoplaces.
Runesxcli network vswitch standard settochangetheMTUofthevirtualswitch.
Runesxcli network ip interface settochangetheMTUofthenetworkinterface.
Listing and Setting iSCSI Options with vicfg-iscsi
Usevicfg-iscsiinformationretrievaloptionstolistexternalHBAproperties,informationabouttargets,and
LUNs.Youcanusethefollowingvicfg-iscsioptionstolistiSCSIparameters.Specifyoneoftheoptions
listedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof
<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)andalias.See“DiscoveryTargetNames”onpage 61.
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
devices.Youalsousethisoptionwith--mtu.
vicfg-iscsi <conn_options> -p -l <adapter_name>
vicfg-iscsi <conn_options> --pnp --list <adapter_name>
ThesystemreturnsinformationabouttheMACaddress,MTU,andcurrenttransferrate.
Runvicfg-iscsi -I -ltolistinformationabouttheiSCSIinitiator.ESXisystemsuseasoftwarebased
iSCSIinitiatorintheVMkerneltoconnecttostorage.ThecommandreturnstheiSCSIname,aliasname,
andaliassettablebitfortheinitiator.
vicfg-iscsi <conn_options> -I -l vmhba42
Runvicfg-iscsi -p -MtosettheMTUfortheadapter.Youspecifythesizeandadaptername.
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.
VMware, Inc. 79
Chapter 5 Managing iSCSI Storage
Listing and Setting iSCSI Parameters with ESXCLI
YoucanretrieveandsetiSCSIparametersbyrunningoneofthefollowingcommands.
Table 56listsallsettableparameters.TheseparametersarealsodescribedintheIETFrfc3720.Youcanrun
esxcli iscsi adapter param gettodeterminewhetheraparameterissettableornot.
TheparametersinTable 56applytosoftwareiSCSIanddependenthardwareiSCSI.
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>”).
Adapterlevel
parameters
esxcli iscsi adapter param set --adapter=<vmhba> --key=<key> --value=<value>
Targetlevel
parameters
esxcli iscsi adapter target portal param set --adapter=<vmhba> --key=<key>
--value=<value> --address=<address> --name=<iqn.name>
Discoverylevel
parameters
esxcli iscsi adapter discovery sendtarget param set --adapter=<vmhba>
--key=<key> --value=<value> --address=<address>
Table 5-5. Settable iSCSI Parameters
Parameter Description
DataDigestType Increasesdataintegrity.Whendatadigestisenabled,thesystemperformsachecksumover
eachPDUsdatapartandverifiesusingtheCRC32Calgorithm.
Note:SystemsthatuseIntelNehalemprocessorsoffloadtheiSCSIdigestcalculationsfor
softwareiSCSI,thusreducingtheimpactonperformance.
ValidvaluesaredigestProhibited,digestDiscouraged,digestPreferred,or
digestRequired.
HeaderDigest Increasesdataintegrity.Whenheaderdigestisenabled,thesystemperformsachecksumover
theheaderpartofeachiSCSIProtocolDataUnit(PDU)andverifiesusingtheCRC32C
algorithm.
MaxOutstandingR2T MaxOutstandingR2TdefinestheReadytoTransfer(R2T)PDUsthatcanbeintransitionbefore
anacknowledgementPDUisreceived.
FirstBurstLength MaximumamountofunsoliciteddataaniSCSIinitiatorcansendtothetargetduringthe
executionofasingleSCSIcommand,inbytes.
MaxBurstLength MaximumSCSIdatapayloadinaDataInorasolicitedDataOutiSCSIsequence,inbytes.
MaxRecvDataSegLen Maximumdatasegmentlength,inbytes,thatcanbereceivedinaniSCSIPDU.
NoopOutInterval Timeinterval,inseconds,betweenNOPOutrequestssentfromyouriSCSIinitiatortoaniSCSI
target.TheNOPOutrequestsserveasthepingmechanismtoverifythataconnectionbetween
theiSCSIinitiatorandtheiSCSItargetisactive.
Supportedonlyattheinitiatorlevel.
NoopOutTimeout Amountoftime,inseconds,thatcanlapsebeforeyourhostreceivesaNOPInmessage.The
messageissentbytheiSCSItargetinresponsetotheNOPOutrequest.Whenthe
NoopTimeoutlimitisexceeded,theinitiatorterminatesthecurrentsessionandstartsanew
one.
Supportedonlyattheinitiatorlevel.
RecoveryTimeout Amountoftime,inseconds,thatcanlapsewhileasessionrecoveryisperformed.Ifthetimeout
exceedsitslimit,theiSCSIinitiatorterminatesthesession.
DelayedAck Allowssystemstodelayacknowledgmentofreceiveddatapackets.
vSphere Command-Line Interface Concepts and Examples
80 VMware, Inc.
Returning Parameters to Default Inheritance
ThevaluesofiSCSIparametersassociatedwithadynamicdiscoveryaddressorastaticdiscoverytargetare
inheritedfromthecorrespondingsettingsoftheparent.Forthedynamicdiscoveryaddress,theparentisthe
adapter.Forthestatictarget,theparentistheadapterordiscoveryaddress.
IfyouusethevSphereWebClienttomodifyauthenticationsettings,youdeselecttheInheritfromParent
checkboxbeforeyoucanmakeachangetothediscoveryaddressordiscoverytarget.
Ifyouuseesxcli iscsi,thevalueyousetoverridestheinheritedvalue.
Inheritanceisrelevantonlyifyouwanttoreturnadynamicdiscoveryaddressorastaticdiscoverytargetto
itsinheritedvalue.Inthatcase,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 -W.Table 56listsallsettableparameters.
TheseparametersarealsodescribedintheIETFrfc3720.Youcanalsorunvicfg-iscsi --parameter
--list --detailstodeterminewhetheraparameterissettableornot.
TheparametersinTable 56applytosoftwareiSCSIanddependenthardwareiSCSI.
Table 5-6. Settable iSCSI Parameters
Parameter Description
DataDigestType Increasesdataintegrity.Whendatadigestisenabled,thesystemperformsachecksumover
eachPDUsdatapartandverifiesusingtheCRC32Calgorithm.
Note:SystemsthatuseIntelNehalemprocessorsoffloadtheiSCSIdigestcalculationsfor
softwareiSCSI,thusreducingtheimpactonperformance.
ValidvaluesaredigestProhibited,digestDiscouraged,digestPreferred,or
digestRequired.
HeaderDigest Increasesdataintegrity.Whenheaderdigestisenabled,thesystemperformsachecksumover
theheaderpartofeachiSCSIProtocolDataUnit(PDU)andverifiesusingtheCRC32C
algorithm.
MaxOutstandingR2T MaxOutstandingR2TdefinestheReadytoTransfer(R2T)PDUsthatcanbeintransitionbefore
anacknowledgementPDUisreceived.
FirstBurstLength MaximumamountofunsoliciteddataaniSCSIinitiatorcansendtothetargetduringthe
executionofasingleSCSIcommand,inbytes.
MaxBurstLength MaximumSCSIdatapayloadinaDataInorasolicitedDataOutiSCSIsequence,inbytes.
MaxRecvDataSegLen Maximumdatasegmentlength,inbytes,thatcanbereceivedinaniSCSIPDU.
NoopOutInterval Timeinterval,inseconds,betweenNOPOutrequestssentfromyouriSCSIinitiatortoaniSCSI
target.TheNOPOutrequestsserveasthepingmechanismtoverifythataconnectionbetween
theiSCSIinitiatorandtheiSCSItargetisactive.
Supportedonlyattheinitiatorlevel.
NoopOutTimeout Amountoftime,inseconds,thatcanlapsebeforeyourhostreceivesaNOPInmessage.The
messageissentbytheiSCSItargetinresponsetotheNOPOutrequest.Whenthe
NoopTimeoutlimitisexceeded,theinitiatorterminatesthecurrentsessionandstartsanew
one.
Supportedonlyattheinitiatorlevel.
RecoveryTimeout Amountoftime,inseconds,thatcanlapsewhileasessionrecoveryisperformed.Ifthetimeout
exceedsitslimit,theiSCSIinitiatorterminatesthesession.
DelayedAck Allowssystemstodelayacknowledgmentofreceiveddatapackets.
VMware, Inc. 81
Chapter 5 Managing iSCSI Storage
Youcanusethefollowingvicfg-iscsioptionstolistparameteroptions.Specifyoneoftheoptionslistedin
“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof<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.
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.
Ifspecialcharactersareinthe<name>=<value>sequence,forexample,ifyouaddaspace,youmustsurround
thesequencewithdoublequotes(“<name> = <value>”).
Returning Parameters to Default Inheritance
ThevaluesofiSCSIparametersassociatedwithadynamicdiscoveryaddressorastaticdiscoverytargetare
inheritedfromthecorrespondingsettingsoftheparent.Forthedynamicdiscoveryaddress,theparentisthe
adapter.Forthestatictarget,theparentistheadapterordiscoveryaddress.
IfyouusethevSphereWebClienttomodifyauthenticationsettings,youdeselecttheInheritfromParent
checkboxbeforeyoucanmakeachangetothediscoveryaddressordiscoverytarget.
Ifyouusevicfg-iscsi,thevalueyousetoverridestheinheritedvalue.
Inheritanceisrelevantonlyifyouwanttoreturnadynamicdiscoveryaddressorastaticdiscoverytargetto
itsinheritedvalue.Inthatcase,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>
Option Result
-iand‐n Commandappliestostatictargets.
Only‐i Commandappliestothediscoveryaddress.
Neither-inor‐n Commandappliestoperadapterparameters.
Option Result
-iand‐nCommandappliestopertargetCHAPforstatictargets.
Only‐iCommandappliestothediscoveryaddress.
Neither-inor‐nCommandappliestoperadapterCHAP.
vSphere Command-Line Interface Concepts and Examples
82 VMware, Inc.
Enabling iSCSI Authentication
YoucanenableiSCSIauthenticationwithESXCLIorwithvicfg-iscsi.
Enabling iSCSI Authentication with ESXCLI
Theesxcli iscsi adapter authcommandsenableiSCSIauthentication.Mutualauthenticationis
supportedforsoftwareiSCSIanddependenthardwareiSCSI,butnotforindependenthardwareiSCSI(see
“SettingiSCSICHAPonpage 62).
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
2 (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.
prohibitedThehostdoesnotuseCHAPauthentication.Ifauthenticationisenabled,specify
chapProhibitedtodisableit.
requiredThehostrequiressuccessfulCHAPauthentication.TheconnectionfailsifCHAP
negotiationfails.YoucansetthisvalueformutualCHAPonlyifCHAPissettochapRequired.
Fordirection,specifymutual.
To enable mutual authentication
1Enableauthentication.
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.
2ListpossibleVMkernelNICstobind.
esxcli <conn_options> iscsi logicalnetworkportal list
IMPORTANTYouareresponsibleformakingsurethatCHAPissetbeforeyousetmutualCHAP,andfor
usingcompatiblelevelsforCHAPandmutualCHAP.UseadifferentsecretinCHAPandmutualCHAP.
VMware, Inc. 83
Chapter 5 Managing iSCSI Storage
3Enablemutualauthentication.
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.
CHAPandmutualCHAPusedifferentusernamesandpasswords.Thesecondusernameand
passwordaresupportedformutualauthenticationonthestorageside.
CHAPandmutualCHAPusecompatibleCHAPlevels.
4Aftersetupiscomplete,performrediscoveryandrescanallstoragedevices.Forexample:
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 -coptionsenableiSCSIauthentication.Mutualauthenticationissupportedforsoftware
iSCSIanddependenthardwareiSCSI,butnotforindependenthardwareiSCSI.See“SettingiSCSICHAP”on
page 62.
To enable mutual authentication
1EnableauthenticationontheESXihost.
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.
2EnablemutualauthenticationontheESXihost.
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.
CHAPandmutualCHAPusedifferentusernamesandpasswords.Thesecondusernameand
passwordaresupportedformutualauthenticationonthestorageside.
CHAPandmutualCHAPusecompatibleCHAPlevels.
3Aftersetupiscomplete,performrediscoveryandrescanallstoragedevices.
Setting Up Ports for iSCSI Multipathing
Withportbinding,youcreateaseparateVMkernelportforeachphysicalNICusing1:1mapping.Youcanadd
allnetworkadapterandVMkernelportpairstoasinglevSwitch.ThevSphereStoragedocumentationexplains
indetailhowtospecifyportbinding.
Youcannotsetupportsformultipathingbyusingvicfg-iscsi.
Intheexamplesbelow,specifyoneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagement
Commands”onpage 18inplaceof<conn_options>.
IMPORTANTTheESX/ESXi4.xESXCLIcommandsforsettingupiSCSIarenolongersupported.
vSphere Command-Line Interface Concepts and Examples
84 VMware, Inc.
To specify port binding
1FindoutwhichuplinksareavailableforusewithiSCSIadapters.
esxcli <conn_options> iscsi physicalnetworkportal list --adapter=<adapter_name>
2 ConnectthesoftwareiSCSIordependenthardwareiSCSIinitiatortotheiSCSIVMkernelportsby
runningthefollowingcommandforeachport.
esxcli <conn_options> iscsi networkportal nic add --adapter=<adapter_name> --nic=<bound_nic>
3VerifythattheportswereaddedtotheiSCSIinitiatorbyrunningthefollowingcommand:
esxcli <conn_options> iscsi networkportal list --adapter=<adapter_name>
4 (Optional)IfthereareactiveiSCSIsessionsbetweenyourhostandtargets,discontinuethem.See
“RemovingiSCSISessions”onpage 85.
5RescantheiSCSIinitiator.
esxcli <conn_options> storage core adapter rescan --adapter <iscsi adapter>
6TodisconnecttheiSCSIinitiatorfromtheports,runthefollowingcommand.
esxcli <conn_options> iscsi networkportal remove --adapter=<adapter_name> --nic=<bound_nic>
Managing iSCSI Sessions
Tocommunicatewitheachother,iSCSIinitiatorsandtargetsestablishiSCSIsessions.Youcanuseesxcli
iscsi sessiontolistandmanageiSCSIsessionsforsoftwareiSCSIanddependenthardwareiSCSI.
Introduction to iSCSI Session Management
Bydefault,softwareiSCSIanddependenthardwareiSCSIinitiatorsstartoneiSCSIsessionbetweeneach
initiatorportandeachtargetport.IfyouriSCSIinitiatorortargethasmorethanoneport,yourhostcan
establishmultiplesessions.Thedefaultnumberofsessionsforeachtargetequalsthenumberofportsonthe
iSCSIadaptertimesthenumberoftargetports.Youcandisplayallcurrentsessionstoanalyzeanddebug
them.Youmightaddsessionstothedefaultforseveralreasons.
Cloningsessions.SomeiSCSIarrayssupportmultiplesessionsbetweentheiSCSIadapterandtarget
ports.Ifyoucloneanexistingsessionononeofthesearrays,thearraypresentsmoredatapathsforyour
adapter.Duplicatesessionsdonotpersistacrossreboot.Additionalsessionstothetargetmighthave
performancebenefits,buttheresultofcloningdependsentirelyonthearray.Youmustlogoutfroman
iSCSIsessionifyouwanttocloneasession.Youcanusetheesxcli iscsi session addcommandto
cloneasession.
EnablingHeaderandDataDigest.IfyouareloggedintoasessionandwanttoenabletheHeaderand
DataDigestparameters,youmustsettheparameter,removethesession,andaddthesessionbackforthe
parameterchangetotakeeffect.YoumustlogoutfromaniSCSIsessionifyouwanttocloneasession.
Establishingtargetspecificsessions.Youcanestablishasessiontoaspecifictargetport.Thiscanbe
usefulifyourhostconnectstoasingleportstoragesystemthat,bydefault,presentsonlyonetargetport
toyourinitiator,butcanredirectadditionalsessionstoadifferenttargetport.Establishinganewsession
betweenyouriSCSIinitiatorandanothertargetportcreatesanadditionalpathtothestoragesystem.
Thefollowingexamplescenariousestheavailablecommands.Runesxcli iscsi session --helpandeach
commandwith--helpforreferenceinformation.Theexampleusesaconfigurationfiletologintothehost.
Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18
inplaceof<conn_options>.
CAUTIONSomestoragesystemsdonotsupportmultiplesessionsfromthesameinitiatornameorendpoint.
AttemptstocreatemultiplesessionstosuchtargetscanresultinunpredictablebehaviorofyouriSCSI
environment.
VMware, Inc. 85
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 sessiontologintoasession.Specifyoneoftheoptionslistedin“Connection
OptionsforvCLIHostManagementCommands”onpage 18inplaceof<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=iqn.xxx --adapter=vmhba36
AddduplicatesessionswithtargetandsessionIDsincurrentsoftwareiSCSIordependenthardware
iSCSIconfiguration.
esxcli <conn_options> iscsi session add --name=<iqn.xxxx> --isid=<session_id>
--adapter=<iscsi_adapter>
iqn.xxxxisthetargetIQN,whichyoucandeterminebylistingallsessions.session_idisthesession’s
iSCSIID.Forexample:
esxcli --config /host-config-file iscsi session add -name=iqn.xxx --isid='00:02:3d:00:00:01'
--adapter=vmhba36
Removing iSCSI Sessions
Youcanuseesxcli iscsi sessiontoremoveiSCSIsessions.Specifyoneoftheoptionslistedin
“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof<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=iqn.xxx --adapter=vmhba38
IMPORTANTTheESX/ESXi4.xESXCLIcommandsformanagingiSCSIsessionsarenotsupportedagainst
ESXi5.0hosts.
vSphere Command-Line Interface Concepts and Examples
86 VMware, Inc.
RemovesessionsfromthecurrentsoftwareiSCSIordependenthardwareiSCSIconfigurationwithtarget
andsessionID.
esxcli <conn_options> iscsi session remove --name=<iqn.xxxx> --isid=<session id>
--adapter=<iscsi_adapter>
iqn.xxxxisthetargetIQN,whichyoucandeterminebylistingallsessions.session_idisthesession’s
iSCSIID.
Forexample:
esxcli --config /host-config-file iscsi session remove --name=iqn.xxx
--session='00:02:3d:01:00:01' --adapter=vmhba36
VMware, Inc. 87
6
VMwarepartnersandcustomerscanoptimizeperformanceoftheirstoragearraysinconjunctionwith
VMwarevSphereusingVMwarePSA(pluggablestoragearchitecture).Theesxcli storage core
namespacemanagesVMwarePSAandtheesxcli storage nmpnamespacemanagestheVMwareNMP
plugin.
ThevSphereStoragedocumentationdiscussesPSAfunctionalityindetailandexplainshowtousethevSphere
ClientorthevSphereWebClienttomanagethePSA,theassociatednativemultipathingplugin(NMP)and
thirdpartyplugins.
Thischapterusesthefollowingacronyms.
Thischapterincludesthesetopics:
“ManagingNMPwithesxclistoragenmp”onpage 87
“PathClaimingwithesxclistoragecoreclaiming”onpage 93
“ManagingClaimRules”onpage 95
Managing NMP with esxcli storage nmp
TheNMP(NativeMultipathingPlugin)isanextensiblemultipathingmodulethatESXisupportsbydefault.
Youcanuseesxcli storage nmptomanagedevicesassociatedwithNMPandtosetpathpolicies.
TheNMPsupportsallstoragearrayslistedontheVMwarestorageHardwareCompatibilityList(HCL)and
providesapathselectionalgorithmbasedonthearraytype.TheNMPassociatesasetofphysicalpathswith
astoragedevice(LUN).AStorageArrayTypePlugin(SATP)determineshowpathfailoverishandledfora
specificstoragearray.APathSelectionPlugin(PSP)determineswhichphysicalpathisusedtoissueanI/O
requesttoastoragedevice.SATPsandPSPsarepluginswithintheNMPplugin.
Device Management with esxcli storage nmp device
ThedeviceoptionperformsoperationsondevicescurrentlyclaimedbytheVMwareNMPplugin.
Managing Third-Party Storage Arrays 6
Acronym Meaning
PSA PluggableStorageArchitecture.
NMP NativeMultipathingPlugin.GenericVMwaremultipathingmodule.
PSP PathSelectionPlugin.Handlespathselectionforagivendevice.
SATPStorageArrayTypePlugin.Handlespathfailoverforagivenstoragearray.
Getting Started with vSphere Command-Line Interfaces
88 VMware, Inc.
esxcli storage nmp device list
ThelistcommandliststhedevicescontrolledbyVMwareNMPandshowstheSATPandPSPinformation
associatedwitheachdevice.ToshowthepathsclaimedbyNMP,runesxcli storage nmp path listto
listinformationforalldevices,orforjustonedevicewiththe--deviceoption.
esxcli storage nmp device set
ThesetcommandsetsthePathSelectionPolicy(PSP)foradevicetooneofthepoliciesloadedonthesystem.
AnydevicecanusethePSPassignedtotheSATPhandlingthatdevice,oryoucanrunesxcli storage nmp
device set --device naa.xxx --psp <psp>tospecificallyoverridethePSPassignedtothedevice.
IfadevicedoesnothaveaspecificPSPset,italwaysusesthePSPassignedtotheSATP.IfthedefaultPSP
fortheSATPchanges,thePSPassignedtothedevicechangesonlyafterrebootorafteradeviceis
reclaimed.Adeviceisreclaimedwhenyouunclaimallpathsforthedeviceandreclaimthepaths.
Ifyouuseesxcli storage nmp device settooverridetheSATPsdefaultPSPwithaspecificPSP,the
PSPchangesimmediatelyandremainstheuserdefinedPSPacrossreboots.AchangeintheSATP’sPSP
hasnoeffect.
Usethe--defaultoptiontoreturnthedevicetousingtheSATP’sPSP.
TosetthepathpolicyforthespecifieddevicetoVMW_PSP_FIXED,runthefollowingcommand:
esxcli <conn_options> storage nmp device set --device naa.xxx --psp VMW_PSP_FIXED
Listing Paths with esxcli storage nmp path
UsethepathoptiontolistpathsclaimedbyNMP.Bydefault,thecommanddisplaysinformationaboutall
pathsonalldevices.Youcanfilterinthefollowingways:
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.
Options Description
--device <device>
-d <device>
Filterstheoutputofthecommandtoshowinformationaboutasingledevice.Defaultisall
devices.
Options Description
--default
-E
SetsthePSPbacktothedefaultfortheSATPassignedtothisdevice.
--device <device>
-d <device>
DevicetosetthePSPfor.
--psp <PSP>
-P <PSP>
PSPtoassigntothespecifieddevice.Callesxcli storage nmp psp listtodisplayall
currentlyavailablePSPs.SeeTable 41,“SupportedPathPolicies,”onpage 48.
SeevSphereStorageforadiscussionofpathpolicies.
IMPORTANTWhenusedwiththirdpartyPSPs,thesyntaxdependsonthethirdpartyPSPimplementation.
VMware, Inc. 89
Chapter 6 Managing Third-Party Storage Arrays
Retrieving PSP Information
Theesxcli storage nmp pspgeneric deviceconfig getandesxcli storage nmp pspgeneric
pathconfig getcommandretrievesPSPconfigurationparameters.ThetypeofPSPdetermineswhich
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 vmhba4:C1: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 setcommandssupportfuturethirdpartyPSAexpansion.ThesetconfigcommandsetsPSP
configurationparametersforthosethirdpartyextensions.
Useesxcli storage nmp roundrobin setconfigforotherpathpolicyconfiguration.See“Customizing
RoundRobinSetup”onpage 90.
Youcanrunesxcli storage nmp psp generic deviceconfig set --device=<device>tospecifyPSP
informationforadevice,andesxcli storage nmp psp generic pathconfig set --path=<path>to
specifyPSPinformationforapath.Foreachcommand,use--configtosetthespecifiedconfigurationstring.
Fixed Path Selection Policy Operations
ThefixedoptiongetsandsetsthepreferredpathpolicyforNMPdevicesconfiguredtouseVMW_PSP_FIXED.
Retrieving the Preferred Path
Theesxclistoragenmp fixed deviceconfig getcommandretrievesthepreferredpathonaspecified
devicethatisusingNMPandtheVMW_PSP_FIXEDPSP.
NOTEThepreciseresultsofthesecommandsdependonthethirdpartyextension.Seetheextension
documentationforinformation.
Options Description
--config <config_string>
-c <config_string>
Configurationstringtosetforthedeviceorpathspecifiedby--deviceor--path.See
Table 41,“SupportedPathPolicies,”onpage 48.
--device <device>
-d <device>
Deviceforwhichyouwanttocustomizethepathpolicy.
--path <path>
-p <path>
Pathforwhichyouwanttocustomizethepathpolicy.
Getting Started with vSphere Command-Line Interfaces
90 VMware, Inc.
Toreturnthepathconfiguredasthepreferredpathforthespecifieddevice,runthefollowingcommand.
Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18
inplaceof<conn_options>.
esxcli <conn_options> storage nmp fixed deviceconfig get --device naa.xxx
Setting the Preferred Path
Theesxcli storage nmp fixed deviceconfig setcommandsetsthepreferredpathonaspecifieddevice
thatisusingNMPandtheVMW_PSP_FIXEDpathpolicy.
Tosetthepreferredpathforthespecifieddevicetovmhba3:C0:T5:L3,runthefollowingcommand.Specify
oneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplace
of<conn_options>.
esxcli <conn_options> storage nmp fixed deviceconfig set --device naa.xxx --path vmhba3:C0:T5:L3
Customizing Round Robin Setup
Theesxcli storage nmp psp roundrobincommandssetsroundrobinpathoptionsonadevicecontrolled
bytheVMW_PSP_RRPSP.Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagement
Commands”onpage 18inplaceof<conn_options>.
To specify and customize round robin path policies
1Setthepathpolicytoroundrobin.
esxcli <conn_options> storage nmp device set --device naa.xxx --psp VMW_PSP_RR
2Specifywhentoswitchpaths.
YoucanchoosethenumberofI/Ooperations,numberofbytes,andsoon.Forexample:
esxcli <conn_options> storage nmp psp roundrobin deviceconfig set --type "bytes" -B 12345
--device naa.xxx
Setsthedevicespecifiedby--devicetoswitchtothenextpatheachtime12345byteshavebeensent
alongthecurrentpath.
esxcli <conn_options> storage nmp psp roundrobin deviceconfig set --type=iops --iops 4200
--device naa.xxx
Setsthedevicespecifiedby--devicetoswitchafter4200I/Ooperationshavebeenperformedonapath.
Retrieving Path Selection Settings
Theesxcli storage nmp psp roundrobin deviceconfig get commandretrievespathselectionsettings
foradevicethatisusingtheroundrobinPSP.Youcanspecifythedevicetoretrievetheinformationfor.
Options Description
--device <device>
-d <device>
Deviceforwhichyouwanttogetthepreferredpath.Thisdevicemustbecontrolledbythe
VMW_PSP_FIXEDPSP.
Options Description
--device <device>
-d <device>
Deviceforwhichyouwanttosetthepreferredpath.Thisdevicemustbecontrolledbythe
VMW_PSP_FIXEDPSP.
Useesxcli storage nmp device --listtolistthepoliciesforalldevices.
--path <path>
-p <path>
Pathtosetasthepreferredpathforthespecifieddevice.
Options Description
-d <device>
--device <device>
Devicetogetroundrobinpropertiesfor.
VMware, Inc. 91
Chapter 6 Managing Third-Party Storage Arrays
Specifying Conditions for Path Changes
Theesxcli storage nmp psp roundrobin deviceconfig setcommandspecifiesunderwhichconditions
adevicethatisusingtheVMW_PSP_RRPSPchangestoadifferentpath.Youcanuse--bytesor--iopsto
specifywhenthepathshouldchange.
Managing SATPs
Theesxcli storage nmp satpcommandsmanageSATPs.Youcanusethesecommandstoperformthe
followingtasks:
Retrieveandsetconfigurationparameters
AddandremoverulesfromthelistofclaimrulesforaspecifiedSATP
SetthedefaultPSPforaspecifiedSATP
ListSATPsthatarecurrentlyloadedintoNMPandtheassociatedclaimrules
ThedefaultSATPforanactiveactiveFCarraywithavendorandmodelnotlistedintheSATPrulesis
VMW_SATP_DEFAULT_AA.
Retrieving Information About SATPs
Theesxcli storage nmp satplistcommandliststheSATPsthatarecurrentlyavailabletotheNMP
systemanddisplaysinformationaboutthoseSATPs.Thiscommandsupportsnooptionsanddisplays
informationabouttheseSATPs.
esxcli <conn_options> storage nmp satp list
Therule listcommandliststheclaimrulesforSATPs.
esxcli <conn_options> storage nmp satp rule list
Adding SATP Rules
Claimrulesspecifythatastoragedevicethatusesacertaindriverortransportorhasacertainvendorormodel
shoulduseacertainSATP.Theesxcli storage nmp satp rule addcommandaddsarulethatperforms
suchamappingtothelistofclaimrules.Theoptionsyouspecifydefinetherule.Forexample,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”
Options Description
--bytes
-B
NumberofbytestosendalongonepathforthisdevicebeforethePSPswitchestothenextpath.
Youcanusethisoptiononlywhen--typeissettobytes.
--device
-d
Devicetosetroundrobinpropertiesfor.Thisdevicemustbecontrolledbytheroundrobin
(VMW_PSP_RR)PSP.
--iops
-I
NumberofI/OoperationstosendalongonepathforthisdevicebeforethePSPswitchestothe
nextpath.Youcanusethisoptiononlywhen--typeissettoiops.
--type
-t
Typeofroundrobinpathswitchingtoenableforthisdevice.Thefollowingvaluesfortypeare
supported:
bytes:Setthetriggerforpathswitchingbasedonthenumberofbytessentdownapath.
default:Setthetriggerforpathswitchingbacktodefaultvalues.
iops:SetthetriggerforpathswitchingbasedonthenumberofI/Ooperationsonapath.
Anequalsign(=)beforethetypeordoublequotesaroundthetypeareoptional.
--useANO
-U
Ifsetto1,theroundrobinPSPincludespathsintheactive,unoptimizedstateintheroundrobin
set.Ifsetto0,thePSPusesactive,unoptimizedpathsonlyifnoactiveoptimizedpathsare
available.Otherwise,thePSPincludesonlyactiveoptimizedpathsintheroundrobinpathset.
Getting Started with vSphere Command-Line Interfaces
92 VMware, Inc.
ThefollowingexamplesillustrateaddingSATPrules.Specifyoneoftheoptionslistedin“ConnectionOptions
forvCLIHostManagementCommands”onpage 18inplaceof<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"
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 removecommandremovesanexistingSATPrule.Theoptionsyou
specifydefinetheruletoremove.Theoptionslistedfor“A d d i n g SATPRules”onpage 91aresupported.
Option Description
--driver
-D
DriverstringtosetwhenaddingtheSATPclaimrule.
--device
-d
DevicetosetwhenaddingSATPclaimrules.Devicerulesaremutuallyexclusivewith
vendor/modelanddriverrules.
--force
-f
Forceclaimrulestoignorevaliditychecksandinstalltheruleevenifchecksfail.
--model
-M
ModelstringtosetwhenaddingtheSATPclaimrule.Canbethemodelnameorapattern
^mod*,whichmatchesalldevicesthatstartwithmod.Thatis,thepatternsuccessfullymatches
mod1andmodz,butnotmymod1.
Thecommandsupportsthestart/end(^)andwildcard(*)functionalitybutnootherregular
expressions.
--transport
-R
TransportstringtosetwhenaddingtheSATPclaimrule.DescribesthetypeofstorageHBA,
forexample,iscsiorfc.
--vendor
-V
VendorstringtosetwhenaddingtheSATPclaimrule.
--satp
-s
SATPforwhichtheruleisadded.
--claim-option
-c
ClaimoptionstringtosetwhenaddingtheSATPclaimrule.
--description
-e
DescriptionstringtosetwhenaddingtheSATPclaimrule.
--option
-o
OptionstringtosetwhenaddingtheSATPclaimrule.Surroundtheoptionstringindouble
quotes,anduseaspace,notacomma,whenspecifyingmorethanoneoption.
“enable_local enable_ssd”.
--psp
-P
DefaultPSPfortheSATPclaimrule.
--psp-option
-O
PSPoptionsfortheSATPclaimrule.
--type
-t
SettheclaimtypewhenaddingaSATPclaimrule.
VMware, Inc. 93
Chapter 6 Managing Third-Party Storage Arrays
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 getcommandsretrieveperdeviceorperpathSATPconfigurationparameters.Youcannot
retrievepathsordevicesforallSATPs,youmustretrievetheinformationonepathoronedeviceatatime.
UsethiscommandtoretrieveperdeviceorperpathSATPconfigurationparameters,andtoseewhetheryou
cansetcertainconfigurationparametersforadeviceorpath.
Forexampleesxcli storage nmp satp generic deviceconfig get --device naa.xxxmightreturn
SATP VMW_SATP_LSI does not support device configuration.
esxcli storage nmp satp generic pathconfig get -path vmhba1:C0:T0:L8mightreturnINIT,AVT
OFF,v5.4,DUAL ACTIVE,ESX FAILOVER
Theesxcli storage nmp satp generic deviceconfigsetandesxcli storage nmp satp generic
pathconfig set commandssetconfigurationparametersforSATPsthatareloadedintothesystem,ifthey
supportdeviceconfiguration.YoucansetperpathorperdeviceSATPconfigurationparameters.
TheconfigurationstringsmightvarybySATP.VMwaresupportsafixedsetofconfigurationstringsfora
subsetofitsSATPs.Thestringsmightchangeinfuturereleases.
Runesxcli storage nmp device set --default --device=<device> tosetthePSPforthespecified
devicebacktothedefaultfortheassignedSATPforthisdevice.
Path Claiming with esxcli storage core claiming
Theesxcli storage core claimingnamespaceincludesanumberoftroubleshootingcommands.These
commandsarenotpersistentandareusefulonlytodeveloperswhoarewritingPSApluginsor
troubleshootingasystem.IfI/Oisactiveonthepath,unclaimandreclaimactionsfail.
IMPORTANTThecommandpassestheconfigurationstringtotheSATPassociatedwiththatdeviceorpath.
Options Description
--config
-c
Configurationstringtosetforthepathspecifiedby--pathorthedevicespecifiedby--device.
YoucansettheconfigurationforthefollowingSATPs:
VMW_SATP_ALUA_CX
VMW_SATP_ALUA
VMW_SATP_CX
VMW_SATP_INV
Youcanspecifyoneofthefollowingdeviceconfigurationstrings:
navireg_onstartsautomaticregistrationofthedevicewithNavisphere.
navireg_offstopstheautomaticregistrationofthedevice.
ipfilter_onstopsthesendingofthehostnameforNavisphereregistration.Usedifhostis
knownaslocalhost.
ipfilter_offenablesthesendingofthehostnameduringNavisphereregistration.
--device
-d
DevicetosetSATPconfigurationfor.NotallSATPssupportthesetconfigoptionondevices.
--path
-p
PathtosetSATPconfigurationfor.NotallSATPssupportthesetconfigoptiononpaths.
IMPORTANTThehelpforesxcli storage core claiming includestheautoclaimcommand.Donotuse
thiscommandunlessinstructedtodosobyVMwaresupportstaff.
Getting Started with vSphere Command-Line Interfaces
94 VMware, Inc.
Using the Reclaim Troubleshooting Command
Theesxcli storage core claiming reclaimtroubleshootingcommandisintendedforPSAplugin
developersoradministratorswhotroubleshootPSAplugins.Thecommandproceedsasfollows.
Attemptstounclaimallpathstoadevice.
Runstheloadedclaimrulesoneachoftheunclaimedpathstoreclaimthosepaths.
Itisnormalforthiscommandtofailifadeviceisinuse.
Unclaiming Paths or Sets of Paths
Theesxcli storage core claiming unclaimcommandunclaimsapathorsetofpaths,disassociating
thosepathsfromaPSAplugin.Thecommandsfailsifthedeviceisinuse.
Youcanunclaimonlyactivepathswithnooutstandingrequests.YoucannotunclaimtheESXiUSBpartition
ordeviceswithVMFSvolumesonthem.Itisthereforenormalforthiscommandtofail,especiallywhenyou
specifyapluginoradaptertounclaim.
Unclaimingdoesnotpersist.Periodicpathclaimingreclaimsunclaimedpathsunlessclaimrulesare
configuredtomaskapath.SeethevSphereStoragedocumentationfordetails.
IMPORTANTThereclaimcommandunclaimspathsassociatedwithadevice.
YoucannotusethecommandtoreclaimpathscurrentlyassociatedwiththeMASK_PATHpluginbecause
--deviceistheonlyoptionforreclaimandMASK_PATHpathsarenotassociatedwithadevice.
YoucanusethecommandtounclaimpathsforadeviceandhavethosepathsreclaimedbytheMASK_PATH
plugin.
Options Description
--device <device>
-d <device>
Nameofthedeviceonwhichallpathsarereclaimed.
--help Displaysthehelpmessage.
IMPORTANTTheunclaimcommandunclaimspathsassociatedwithadevice.Youcanusethiscommandto
unclaimpathsassociatedwiththeMASK_PATHpluginbutcannotusethe‐‐deviceoptiontounclaimthose
paths.
Options Description
--adapter <adapter>
-A <adapter>
If--typeissettolocation,specifiesthenameoftheHBAforthepathsthatyouwant
tounclaim.Ifyoudonotspecifythisoption,unclaimingrunsonpathsfromall
adapters.
--channel <channel>
-C <channel>
If--typeissettolocation,specifiestheSCSIchannelnumberforthepathsthatyou
wanttounclaim.Ifyoudonotspecifythisoption,unclaimingrunsonpathsfromall
channels.
--claimrule-class <cl>
-c <cl>
Claimruleclasstouseinthisoperation.YoucanspecifyMP(Multipathing),Filter,or
VAAI.Multipathingisthedefault.FilterisusedonlyforVAAI.Specifyclaimrulesfor
bothVAAI_FILTERandVAAIplugintouseit.
--device <device>
-d <device>
If--typeissettodevice,attemptstounclaimallpathstothespecifieddevice.Ifthere
areactiveI/Ooperationsonthespecifieddevice,atleastonepathcannotbeunclaimed.
--driver <driver>
-D <driver>
If--typeisdriver,unclaimsallpathsspecifiedbythisHBAdriver.
--lun <lun_number>
-L <lun_number>
If--typeislocation,specifiestheSCSILUNforthepathstounclaim.Ifyoudonot
specify--lun,unclaimingrunsonpathswithanyLUNnumber.
--model <model>
-m <model>
If--typeisvendor,attemptstounclaimallpathstodeviceswithspecificmodel
information(formultipathingplugins)orunclaimthedeviceitself(forfilterplugins).If
thereareactiveI/Ooperationsonthisdevice,atleastonepathfailstounclaim.
VMware, Inc. 95
Chapter 6 Managing Third-Party Storage Arrays
Thefollowingtroubleshootingcommandtriestounclaimallpathsonvmhba1.
esxcli <conn_options> storage core claiming unclaim --type location -A vmhba1
Runvicfg-mpath <conn_options> -ltoverifythatthecommandsucceeded.
Ifapathisthelastpathtoadevicethatwasinuse,oraifapathwasveryrecentlyinuse,theunclaimoperation
mightfail.Anerrorisloggedthatnotallpathscouldbeunclaimed.Stopprocessesthatmightusethedevice
andwait15secondstoletthedevicebequiesced.Retrythecommand.
Managing Claim Rules
ThePSAusesclaimrulestodeterminewhichmultipathingmoduleshouldclaimthepathstoaparticular
deviceandtomanagethedevice.esxclistorage core claimrulemanagesclaimrules.
ClaimrulemodificationcommandsdonotoperateontheVMkerneldirectly.Insteadtheyoperateonthe
configurationfilebyaddingandremovingrules.Specifyoneoftheoptionslistedin“ConnectionOptionsfor
vCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
To change the current claim rules in the VMkernel
1Runoneormoreoftheesxcli storage coreclaimrulemodificationcommands(add,remove,or
move).
2Runesxcli storage core claimrule loadtoreplacethecurrentrulesintheVMkernelwiththe
modifiedrulesfromtheconfigurationfile.
Youcanalsorunesxcli storage core plugin listtolistallloadedplugins.
Adding Claim Rules
Theesxcli storage core claimrule addcommandaddsaclaimruletothesetofclaimrulesonthe
system.YoucanusethiscommandtoaddnewclaimrulesortomaskapathusingtheMASK_PATHclaimrule.
Youmustloadtherulesafteryouaddthem.
--path <path>
-p <path>
If--typeispath,unclaimsapathspecifiedbyitspathUIDorruntimename.
--plugin <plugin>
-P
If--typeisplugin,unclaimsallpathsforaspecifiedmultipathplugin.
<plugin>canbeanyvalidPSApluginonthesystem.BydefaultonlyNMPand
MASK_PATHareavailable,butadditionalpluginsmightbeinstalled.
--target <target>
-T <target>
If--typeislocation,unclaimsthepathswiththeSCSItargetnumberspecifiedby
target.Ifyoudonotspecify--target,unclaimingrunsonpathsfromalltargets.
--type <type>
-t <type>
Typeofunclaimoperationtoperform.Validvaluesarelocation,path,driver,
device,plugin,andvendor.
--vendor <vendor>
-v <vendor>
If--typeisvendor,attemptstounclaimallpathstodeviceswithspecificvendorinfo
formultipathingpluginsorunclaimthedeviceitselfforfilterplugins.Ifthereareany
activeI/Ooperationsonthisdevice,atleastonepathfailstounclaim
Options Description
Options Description
--adapter <adapter>
-A <adapter>
Adapterofthepathstouse.Validonlyif--typeislocation.
--autoassign
-u
Addsaclaimrulebasedonitscharacteristics.Therulenumberisnotrequired.
--channel <channel>
-C <channel>
Channelofthepathstouse.Validonlyif--typeislocation.
Getting Started with vSphere Command-Line Interfaces
96 VMware, Inc.
Claimrulesarenumberedasfollows.
Rules0–100arereservedforinternalusebyVMware.
Rules101–65435areavailableforgeneraluse.Anythirdpartymultipathingpluginsinstalledonyour
systemuseclaimrulesinthisrange.Bydefault,thePSAclaimrule101masksDellarraypseudodevices.
Donotremovethisrule,unlessyouwanttounmaskthesedevices.
--claimrule-class <cl>
-c <cl>
Claimruleclasstouseinthisoperation.YoucanspecifyMP(default),Filter,orVAAI.
Toconfigurehardwareaccelerationforanewarray,addtwoclaimrules,oneforthe
VAAIfilterandanotherfortheVAAIplugin.SeevSphereStoragefordetailed
instructions.
--driver <driver>
-D <driver>
DriverfortheHBAofthepathstouse.Validonlyif--typeisdriver.
--force
-f
Forceclaimrulestoignorevaliditychecksandinstalltherule.
--lun <lun_number>
-L <lun_number>
LUNofthepathstouse.Validonlyif--typeislocation.
--model <model>
-M <model>
Modelofthepathstouse.Validonlyif--typeisvendor.
ValidvaluesarevaluesoftheModelstringfromtheSCSIinquirystring.Run
vicfg-scsidevs <conn_options> -loneachdevicetoseemodelstringvalues.
--plugin
-P
PSAplugintouse.Currently,thevaluesareNMPorMASK_PATH,butthirdpartiescan
shiptheirownPSApluginsinthefuture.
MASK_PATHreferstothepluginMASK_PATH_PLUGIN.Thecommandaddsclaimrules
forthispluginiftheuserwantstomaskthepath.
ESX3.5includestheMaskLUNsadvancedconfigurationoption.Thisoptionisnot
availableinESX/ESXi4.xandESXi5.0.Ithasbeenreplacedbythe
MASK_PATH_PLUGIN.YoucanaddaclaimrulethatcausestheMASK_PATH_PLUGINto
claimthepathtomaskapathorLUNfromthehost.SeethevSphereStorage
documentationfordetails.
--rule <rule_ID>
-r <rule_ID>
RuleIDtouse.Runesxcli storage core claimrule listtoseetheruleID.The
ruleIDindicatestheorderinwhichtheclaimruleistobeevaluated.Userdefined
claimrulesareevaluatedinnumericorderstartingwith101.
--target <target>
-T <target>
Targetofthepathstouse.Validonlyif--typeislocation.
--transport <transport>
-R <transport>
Transportofthepathstouse.Validonlyif--typeistransport.Thefollowingvalues
aresupported:
blockblockstorage
fcFibreChannel
iscsivendoriSCSI
iscsinotcurrentlyused
ideIDEstorage
sasSASstorage
sataSATAstorage
usbUSBstorage
parallelparallel
unknown
--type <type>
-t <type>
Typeofmatchingtousefortheoperation.Validvaluesarevendor,location,driver,
andtransport.
--vendor
-V
Vendorofthepathstouse.Validonlyif--typeisvendor.
ValidvaluesarevaluesofthevendorstringfromtheSCSIinquirystring.Run
vicfg-scsidevs <conn_options> -loneachdevicetoseevendorstringvalues.
--wwnn WorldWideNodeNumberforthetargettouseinthisoperation.
--wwpn WorldWidePortNumberforthetargettouseinthisoperation.
Options Description
VMware, Inc. 97
Chapter 6 Managing Third-Party Storage Arrays
Rules65436–65535arereservedforinternalusebyVMware.
Whenclaimingapath,thePSArunsthroughtherulesstartingfromthelowestnumberanddeterminesisa
pathmatchestheclaimrulespecification.IfthePSAfindsamatch,itgivesthepathtothecorresponding
plugin.Thisisworthnoticingbecauseagivenpathmightmatchseveralclaimrules.
Thefollowingexamplesillustrateaddingclaimrules.Specifyoneoftheoptionslistedin“ConnectionOptions
forvCLIHostManagementCommands”onpage 18inplaceof<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)toclaimruleformat.ThecommandwritestheconvertedlistanderasestheoldLUN
maskdata.Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”
onpage 18inplaceof<conn_options>.
To convert ESX 3.5 format LUN masks to claim rule format
1Run
esxcli storage core claimrule convertwithoutoptions.
ThatcallreturnsNo /adv/Disk/MaskLUNs config entry to convertordisplaysthelistofclaimrules
thatwouldresultfromtheconversion.Forexample:
2Runesxcli storage core claimrule convert --committoactuallycommitthechange.
WhenyouconvertLUNmaskingtotheclaimruleformatafteranupgradefromESX/ESXi3.5toESX/ESXi4.x,
thiscommandconvertsthe/adv/Disk/MaskLUNsadvancedconfigurationentryintheesx.conffiletoclaim
ruleswithMASK_PATHastheplugin.
Rule Plugin HbaName Controller Target LUN
120 MASK_PATH vmhba11 0 0 11
121 MASK_PATH vmhba11 0 0 10
122 MASK_PATH vmhba4 0 2 1
IMPORTANTThisconversiondoesnotworkforallinputMaskLUNvariations.Forexample,roleconversion
forsoftwareiSCSILUNsisnotsupported.
Inspectthelistofgeneratedclaimrulescarefullybeforeyoucommitthembyusing--commit.
Table 6-1. esxcli storage core claimrule convert Options
Options Description
--commit
-C
ForcesLUNmaskconfigurationchangestobesaved.Ifyoucallthecommandwithoutthis
parameter,changesarenotsaved,andyoucanfirstinspectthegeneratedclaimrules.
Getting Started with vSphere Command-Line Interfaces
98 VMware, Inc.
Removing Claim Rules
Theesxcli storage core claimrule removecommandremovesaclaimrulefromthesetofclaimrules
onthesystem.
Thefollowingexampleremovesrule1015.
esxcli <conn_options> storage core claimrule remove -r 1015
Listing Claim Rules
Thelistcommandlistsallclaimrulesonthesystem.Youcanspecifytheclaimruleclassasanargument.
Youcanrunthecommandasfollows.Theequalsignisoptional,sobothformsofthecommandhavethesame
result.Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”on
page 18inplaceof<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 loadcommandloadsclaimrulesfromtheesx.confconfiguration
fileintotheVMkernel.Developersandexperiencedstorageadministratorsmightusethiscommandforboot
timeconfiguration.
Thiscommandhasnooptions;italwaysloadsallclaimrulesfromesx.conf.
Moving Claim Rules
Theesxcli storage core claimrule movecommandmovesaclaimrulefromoneruleIDtoanother.
Thefollowingexamplerenamesrule1016torule1015andremovesrule1016.Specifyoneoftheoptionslisted
in“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
esxcli <conn_options> storage core claimrule move -r 1015 -n 1016
IMPORTANTBydefault,thePSAclaimrule101masksDellarraypseudodevices.Donotremovethisrule,
unlessyouwanttounmaskthesedevices.
Option Description
--rule <rule_ID>
-r <rule_ID>
IDoftheruletoberemoved.Runesxcli storage core claimrule listtoseetheruleID.
Option Description
--claimrule-class <cl>
-c <cl>
Claimruleclasstouseinthisoperation.YoucanspecifyMP(Multipathing),Filter,or
VAAI.Multipathingisthedefault.FilterisusedonlyforVAAI.Specifyclaimrulesfor
bothVAAI_FILTERandVAAIplugintouseit.SeevSphereStorageforinformationabout
VAAI.
Options Description
--claimrule-class <cl>
-c <cl>
Claimruleclasstouseinthisoperation.
--new-rule <rule_ID>
-n <rule_ID>
NewruleIDyouwanttogivetotherulespecifiedbythe--ruleoption.
--rule <rule_ID>
-r <rule_ID>
IDoftheruletoberemoved.Runesxcli storage core claimrule listtodisplay
theruleID.
VMware, Inc. 99
Chapter 6 Managing Third-Party Storage Arrays
Running Path Claiming Rules
Theesxcli storage core claimrule runcommandrunspathclaimingrules.Runthiscommandapply
claimrulesthatareloaded.Ifyoudonotcallrun,thesystemchecksforclaimruleupdateseveryfiveminutes
andappliesthem.Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagement
Commands”onpage 18inplaceof<conn_options>.
To load and apply claim rules
1Modifyrulesandloadthem.
esxcli <conn_options> storage core claimrule load
2Quiescethedevicesthatusepathsforwhichyouwanttochangetheruleandunclaimthosepaths.
esxcli <conn_options> storage core claiming unclaim --device=<device>
3Runpathclaimingrules.
esxcli <conn_options> storage core claimrule run
Thiscommandisalsousedfortroubleshootingandboottimeconfiguration.
Options Description
--adapter <adapter>
-A <adapter>
If--typeislocation,nameoftheHBAforthepathstoruntheclaimruleson.To
runclaimrulesonpathsfromalladapters,omitthisoption.
--channel <channel>
-C <channel>
If--typeislocation,valueoftheSCSIchannelnumberforthepathstorunthe
claimruleson.Torunclaimrulesonpathswithanychannelnumber,omitthis
option.
--claimrule-class
-c
Claimruleclasstouseinthisoperation.
--lun <lun>
-L <lun>
If--typeislocation,valueoftheSCSILUNforthepathstorunclaimruleson.To
runclaimrulesonpathswithanyLUN,omitthisoption.
--path <path_UID>
-p <path_UID>
If--typeispath,thisoptionindicatestheuniquepathidentifier(UID)orthe
runtimenameofapathtorunclaimruleson.
--target <target>
-T <target>
If--typeislocation,valueoftheSCSItargetnumberforthepathstorunclaim
ruleson.Torunclaimrulesonpathswithanytargetnumber,omitthisoption
--type
<location|path|all>
-t <location|path|all>
Typeofclaimtoperform.Bydefault,usesall,whichmeansclaimrulesrunwithout
restrictiontospecificpathsorSCSIaddresses.Validvaluesarelocation,path,and
all.
--wait
-w
Youcanusethisoptiononlyifyoualsouse--typeall.
Iftheoptionisincluded,theclaimwaitsforpathstosettlebeforerunningtheclaim
operation.Inthatcase,thesystemdoesnotstarttheclaimingprocessuntilitislikely
thatallpathsonthesystemhaveappearedbeforestartingtheclaimprocess.
Aftertheclaimingprocesshasstarted,thecommanddoesnotreturnuntildevice
registrationhascompleted.
Ifyouaddorremovepathsduringtheclaimingorthediscoveryprocess,thisoption
mightnotworkcorrectly.
Getting Started with vSphere Command-Line Interfaces
100 VMware, Inc.
VMware, Inc. 101
7
AnESXisystemgrantsaccesstoitsresourceswhenaknownuserwithappropriatepermissionslogsontothe
systemwithapasswordthatmatchestheonestoredforthatuser.YoucanusethevSphereClientorthe
vSphereSDKforallusermanagementtasks.YoucannotcreateESXiuserswiththevSphereWebClient.
Youcanusethevicfg-usercommandtocreate,modify,delete,andlistlocaldirectaccessusersonanESXi
host.YoucannotrunthiscommandagainstavCenterServersystem.
Thischapterincludesthefollowingtopics:
“UsersinthevSphereEnvironment”onpage 101
“vicfguserCommandSyntax”onpage 101
“ManagingUserswithvicfguseronpage 102
AssigningPermissionswithESXCLI”onpage 104
Users in the vSphere Environment
Users,androlescontrolwhohasaccesstovSpherecomponentsandwhatactionseachusercanperform.User
managementisdiscussedindetailinthevSphereSecuritydocumentation.
vCenterServerandESXisystemsauthenticateauserwithacombinationofusername,password,and
permissions.Serversandhostsmaintainlistsofauthorizedusersandthepermissionsassignedtoeachuser.
Privilegesdefinebasicindividualrightsthatarerequiredtoperformactionsandretrieveinformation.ESXi
andvCenterServerusesetsofprivileges,orroles,tocontrolwhichuserscanaccessparticularvSphereobjects.
ESXiandvCenterServerprovideasetofpreestablishedroles.
TheprivilegesandrolesassignedonanESXihostareseparatefromtheprivilegesandrolesassignedona
vCenterServersystem.WhenyoumanageahostbyusingvCenterServersystem,onlytheprivilegesandroles
assignedthroughthevCenterServersystemareavailable.Ifyouconnectdirectlytothehostbyusingthe
vSphereClient,onlytheprivilegesandrolesassigneddirectlyonthehostareavailable.YoucannotcreateESXi
userswiththevSphereWebClient.
vicfg-user Command Syntax
Thevicfg-usersyntaxdiffersfromothervCLIcommands.Youspecifyoperationsasfollows:
vicfg-user <conn_options> -e <user> -o <add|modify|delete|list>
Ifyoucreateauserwithoutspecifyingtherole(--role),theuserhasnopermissions.Youcannotchangethe
usersrole,youcanonlychangetheuserspermission.
Managing Users 7
IMPORTANTStartingwithvSphere5.1,youcannolongermanagegroupswithvicfg-user.
IMPORTANTYoucannotusevicfg-usertocreateroles.Youcanmanagesystemdefinedroles.
Getting Started with vSphere Command-Line Interfaces
102 VMware, Inc.
Options
Thevicfg-usercommandspecificoptionsmanipulateusers.Youmustalsospecifyconnectionoptions.See
“ConnectionOptionsforvCLIHostManagementCommands”onpage 18.
Managing Users with vicfg-user
AuserisanindividualauthorizedtologintoanESXiorvCenterServersystem.
vSpheredoesnotexplicitlyrestrictuserswiththesameauthenticationcredentialsfromaccessingandtaking
actionwithinthevSphereenvironmentsimultaneously.
YoumanageusersdefinedonthevCenterServersystemandusersdefinedonindividualhostsseparately.
ManageusersdefinedonESXiwiththevSphereClient,thevSphereWebServicesSDK,orvicfg-user.
ManagevCenterServeruserswiththevSphereClient,thevSphereWebClient,orthevSphereWeb
ServicesSDK.
EveniftheuserlistsofahostandavCenterServersystemappeartohavecommonusers(forinstance,auser
calleddevuser),theseusersareseparateuserswiththesamename.TheattributesofdevuserinvCenter
Server,includingpermissions,passwords,andsoforth,areseparatefromtheattributesofdevuserontheESXi
host.IfyoulogintovCenterServerasdevuser,youmighthavepermissiontoviewanddeletefilesfroma
datastore.IfyoulogintoanESXihostasdevuser,youmightnothavethesepermissions.
UsersauthorizedtoworkdirectlyonanESXihostareaddedtotheinternaluserlistwhenESXiisinstalledor
canbeaddedbyasystemadministratorafterinstallation.Youcanusevicfg-usertoaddusers,removeusers,
changepasswords,andconfigurepermissions.
IMPORTANTIfyoucreateauserwiththevSphereClient,youcannotmakechangestothatuserwiththe
vicfg-usercommand.
Option Description
--adduser <user_list>
-u <user_list>
Addsthespecifiedusers.Takesacommaseparatedlistofusers.
--entity <user>
-e <user>
Entitytoperformtheoperationon.StartingwithvSphere5.1,entityis
alwaysuser.
--login <login_id>
-l <login_id>
LoginIDoftheuser.
--newpassword <p_wd>
-p <p_wd>
Passwordforthetargetuser.
--newuserid <UUID>
-i <UUID>
NewUUIDforthetargetuser.
--newusername <name>
-n <name>
Newusernameforthetargetuser.
--operation
-o
Operationtoperform.Specifyadd,modify,delete,orlist.
--role <admin|read-only|no-access>
-r <admin|read-only|no-access>
Roleforthetargetuser.Specifyoneofadmin,read-only,orno-access.
Usersthatyoucreatewithoutassigningpermissionshavenopermissions.
--shell
-s
Grantshellaccesstothetargetuser.Defaultisnoshellaccess.Usethis
commandtochangethedefaultortorevokeshellaccessrightsafterthey
havebeengranted.
Validvaluesareyesandno.
ThisoptionisnotsupportedagainstvSphere5.0systems.Theoptionis
supportedonlyagainstESX.TheoptionisnotsupportedagainstESXi.
IMPORTANTYoucannotmodifyuserscreatedwiththevSphereClientwiththevicfg-usercommand.
VMware, Inc. 103
Chapter 7 Managing Users
EachESXihosthasseveraldefaultusers:
Therootuserhasfulladministrativeprivileges.Administratorsusethisloginanditsassociatedpassword
tologintoahostthroughthevSphereClient.Rootuserscancontrolallaspectsofthehostthattheyare
loggedonto.Rootuserscanmanipulatepermissions,creatingusers(onESXihostsonly),workingwith
events,andsoon.
ThevpxuseruserisavCenterServerentitywithrootrightsontheESXihost,allowingittomanage
activitiesforthathost.ThesystemcreatesvpxuserwhenanESXihostisattachedtovCenterServer.
vpxuserisnotpresentontheESXihostunlessthehostisbeingmanagedthroughvCenterServer.
Otherusersmightbedefinedbythesystem,dependingonthenetworkingsetupandotherfactors.
Thefollowingexamplescenarioillustratessomeofthetasksthatyoucanperform.Specifyoneoftheoptions
listedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof
<conn_options>.
To create, modify, and delete users
1Listtheexistingusers.
vicfg-user <conn_options> -e user -o list
Thelistdisplaysallusersthatarepredefinedbythesystemandallusersthatwereaddedlater.
2Addanewuser,specifyingaloginIDandpassword.
vicfg-user <conn_options> -e user -o add -l user27 -p 27_password
Thecommandcreatestheuser.Bydefault,thecommandautogeneratesaUIDfortheuser.
3ListtheusersagaintoverifythatthenewuserwasaddedandaUIDwasgenerated.
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
4Modifythepasswordforuseruser27.
vicfg-user <conn_options> -e user -o modify -l user27 -p 27_password2
ThesystemmightreturnUpdated user user27 successfully.
5Assignreadonlyprivilegestotheuser(whocurrentlyhasnoaccess).
vicfg-user <conn_options> -e user -o modify -l user27 --role read-only
Thesystempromptswhetheryouwanttochangethepassword,whichmightbeadvisableiftheuserdoes
notcurrentlyhaveapassword.Answeryorn.Thesystemthenupdatestheuser.
Updated user user27 successfully.
Assigned the role read-only
CAUTIONSeetheAuthenticationandUserManagementchapterofvSphereSecurityforinformationaboutroot
usersbeforeyoumakeanychangestothedefaultusers.Mistakesregardingrootuserscanhaveseriousaccess
consequences.
IMPORTANTThecommandlistsamaximumof100users.
Getting Started with vSphere Command-Line Interfaces
104 VMware, Inc.
6RemovetheuserwithloginIDuser27.
vicfg-user <conn_options> -e user -o delete -l user27
Thesystemremovestheuserandprintsamessage.
Removed the user user27 successfully.
Assigning Permissions with ESXCLI
StartingwithvSphere6.0,asetofESXCLIcommandsallowsyouto:
Givepermissionstolocalusersandgroupsbyassigningthemoneofthepredefinedroles.
GivepermissionstoActiveDirectoryuserandgroupsifyourESXihosthasbeenjoinedtoanActive
Directorydomainbyassigningthemoneofthepredefinedroles.
Youcanlist,remove,andsetpermissionsforauserorgroup,asshowninthefollowingexample.
1Listpermissions.
esxcli system permission list
Thesystemdisplayspermissioninformation.Thesecondcolumnindicateswhethertheinformationisfor
auserorgroup.
Principal Is Group Role
-----------------------------------
ABCDEFGH\esx^admins true Admin
dcui false Admin
root false Admin
vpxuser false Admin
test1 false ReadOnly
2Setpermissionsforauserorgroup.SpecifytheIDoftheuserorgroup,andsetthe--groupoptionto
truetoindicateagroup.Specifyoneofthreeroles,Admin,ReadOnlyandNoAccess.
excli system permission set --id test1 -r ReadOnly
3Removepermissionsforauserorgroup.
esxcli permission remove --id test1
Youcanmanageaccountswiththefollowingcommands:
esxcli system account add
esxcli system account set
esxcli system account list
esxcli system account remove
IMPORTANTWhenyoumanagelocalusersonyourESXihost,youarenotaffectingthevCenterusers.
VMware, Inc. 105
8
YoucanmanagevirtualmachineswiththevSphereWebClientorthevmware-cmdvCLIcommand.Using
vmware-cmdyoucanregisterandunregistervirtualmachines,retrievevirtualmachineinformation,manage
snapshots,turnthevirtualmachineonandoff,addandremovevirtualdevices,andpromptforuserinput.
Thechapterincludesthesetopics:
“vmwarecmdOverview”onpage 105
“ListingandRegisteringVirtualMachines”onpage 106
“RetrievingVirtualMachineAttributes”onpage 107
“ManagingVirtualMachineSnapshotswithvmwarecmd”onpage 108
“PoweringVirtualMachinesOnandOffonpage 109
“ConnectingandDisconnectingVirtualDevices”onpage 110
“WorkingwiththeAnswerVMAPI”onpage 111
“ForciblyStoppingVirtualMachineswithEXCLI”onpage 111
SomevirtualmachinemanagementutilityapplicationsareincludedinthevSphereSDKforPerl.
ThevSpherePowerCLIcmdlets,whichyoucaninstallforusewithMicrosoftPowerShell,managemany
aspectsofvirtualmachines.
vmware-cmd Overview
vmware-cmdwasincludedinearlierversionoftheESXServiceConsole.Avmware-cmdcommandhasbeen
availableinthevCLIpackagesinceESXiversion3.0.
Olderversionsofvmware-cmdsupportasetofconnectionoptionsandgeneraloptionsthatdifferfromthe
optionsinothervCLIcommands.Thevmware-cmdvCLIcommandsupportstheseoptions.ThevCLI
commandalsosupportsthestandardvCLI--server,--username,--password,and--vihostoptions.
vmware-cmddoesnotsupportotherconnectionoptions.
Managing Virtual Machines 8
IMPORTANTvmware-cmdisnotavailableintheESXiShell.Runthevmware-cmdvCLIcommandinstead.
IMPORTANTvmware-cmdisalegacytoolandsupportstheusageofVMFSpathsforvirtualmachine
configurationfiles.Asarule,usedatastorepathstoaccessvirtualmachineconfigurationfiles.
Getting Started with vSphere Command-Line Interfaces
106 VMware, Inc.
Connection Options for vmware-cmd
Thevmware-cmdvCLIcommandsupportsonlythefollowingconnectionoptions.OthervCLIconnection
optionsarenotsupported,forexample,youcannotusevariablesbecausethecorrespondingoptionisnot
supported.
General Options for vmware-cmd
Thevmware-cmdvCLIcommandsupportsthefollowinggeneraloptions.
Format for Specifying Virtual Machines
Whenyourunvmware-cmd,thevirtualmachinepathisusuallyrequired.Youcanspecifythevirtualmachine
usingoneofthefollowingformats:
Datastoreprefixstyle:'[ds_name] relative_path',forexample:
'[myStorage1] testvms/VM1/VM1.vmx'(Linux)
"[myStorage1] testvms/VM1/VM1.vmx" (Windows)
UUIDbasedpath: folder/subfolder/file,forexample:
'/vmfs/volumes/mystorage/testvms/VM1/VM1.vmx'(Linux)
"/vmfs/volumes/mystorage/testvms/VM1/VM1.vmx"(Windows)
Listing and Registering Virtual Machines
RegisteringorunregisteringavirtualmachinemeansaddingthevirtualmachinetothevCenterServerorESXi
inventoryorremovingthevirtualmachine.
ThefollowingexamplescenariolistsallregisteredvirtualmachinesonavCenterServer,unregistersavirtual
machine,andreregistersthevirtualmachine.
Option Description
--server <host>
-H <host>
TargetESXiorvCenterServersystem.
--vihost <target>
-h <target>
Whenyourunvmware-cmdwiththe-HoptionpointingtoavCenterServersystem,use
--vihosttospecifytheESXihosttorunthecommandagainst.
-O <port> Alternativeconnectionport.Thedefaultportnumberis902.
‐‐username <username>
-U <username>
Userwhoisauthorizedtologintothehostspecifiedby--serveror--vihost.
‐‐password <password>
-P <password>
Passwordfortheuserspecifiedby-U.
-Q <protocol> Protocoltouse,eitherhttporhttps.Defaultishttps.
Option Description
--help Printsahelpmessagethatliststheoptionsforthiscommand.
-q Runsinquietmodewithminimaloutput.Theoutputdoesnotdisplaythespecifiedoperationand
arguments.
-v Runsinverbosemode.
IMPORTANTIfyouregisteravirtualmachinewithavCenterServersystem,andthenremoveitfromtheESXi
host,anorphanedvirtualmachineresults.Callvmware-cmd -s unregisterwiththevCenterServersystem
asthetargettoresolvetheissue.
VMware, Inc. 107
Chapter 8 Managing Virtual Machines
To list, unregister, and register virtual machines
1Runvmware-cmd -ltolistallregisteredvirtualmachinesonaserver.
vmware-cmd -H <vc_server> -U <login_user> -P <login_password> --vihost <esx_host> -l
ThecommandliststheVMXfileforeachvirtualmachine.
/vmfs/volumes/<storage>/winxpPro-sp2/winxpPro-sp2.vmx
/vmfs/volumes/<storage>/RHEL-lsi/RHEL-lsi.vmx
/vmfs/volumes/<storage>/VIMA0809/VIMA0809.vmx
.....
2Runvmware-cmd -s unregistertoremoveavirtualmachinefromtheinventory.
vmware-cmd -H <vc_server> -U <login_user> -P <login_password> --vihost <esx_host>
-s unregister /vmfs/volumes/Storage2/testvm/testvm.vmx
Thesystemreturns0toindicatesuccess,1toindicatefailure.
3Runvmware-cmd -lagaintoverifythatthevirtualmachinewasremovedfromtheinventory.
4Runvmware-cmd -s registertoaddthevirtualmachinebacktotheinventory.
vmware-cmd -H <vc_server> -U <login_user -P <login_password --vihost <esx_host> -s register
/vmfs/volumes/Storage2/testvm/testvm.vmx
Thesystemreturns0toindicatesuccess,1toindicatefailure.
Retrieving Virtual Machine Attributes
vmware-cmdincludesoptionsforretrievinginformationaboutavirtualmachine.Eachoptionrequiresthat
youspecifythevirtualmachinepath(see“FormatforSpecifyingVirtualMachines”onpage 106).Youmust
alsospecifyconnectionoptions,whichdifferfromothervCLIcommands(see“ConnectionOptionsfor
vmwarecmd”onpage 106).
Youcanusevmware-cmdoptionstoretrieveanumberofdifferentvirtualmachineattributes.Foracomplete
listofoptions,seethevSphereCLIReference.
Theguestinfooptionallowsyoutoretrieveinformationabouttheguestoperatingsystem.Forexample,
youcanretrievethenumberofremoteconsolesallowedbyavirtualmachinebyusingguestinforwith
theRemoteDisplay.maxConnectionsvariable.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx getguestinfo RemoteDisplay.maxConnections
TheHardeningGuideincludesadditionalinformationaboutvariablesyoucanuseinconjunctionwith
guestinfo.Acompletelistisnotavailable.
Thegetuptimeoptionretrievestheuptimeoftheguestoperatingsystemonthevirtualmachine,in
seconds.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx getuptime
getuptime() = 17921
Thegetproductinfo productoptionliststheVMwareproductthatthevirtualmachinerunson.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx getproductinfo product
NOTEWhenyourunagainstavCenterServersystem,youmustspecifythedatacenterandtheresource
pooltoregisterthevirtualmachinein.Thedefaultdatacenterisha-datacenterandthedefaultresource
poolisResources.
WhenyourunagainstanESXihost,youusuallydonotspecifytheresourcepoolanddatacenter.
However,iftwovirtualmachineswiththesamenameexistintworesourcepools,youmustspecifythe
resourcepool.
Getting Started with vSphere Command-Line Interfaces
108 VMware, Inc.
Thereturnvalueisesx(VMwareESX),embeddedESX(VMwareESXi),orunknown.
Thegetproductinfo platformoptionliststheplatformthatthevirtualmachinerunson.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx getproductinfo platform
Thereturnvalueiswin32-x86(x86basedWindowssystem),linux-x86(x86basedLinuxsystem),or
vmnix-x86(x86basedESXimicrokernel).
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/testvm.vmx getstate
getstate() = on
ThegettoolslastactiveoptionindicateswhetherVMwareToolsisinstalledandwhethertheguest
operatingsystemisrespondingnormally.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx gettoolslastactive
Thecommandreturnsanintegerindicatinghowmuchtimehaspassed,inseconds,sincethelast
heartbeatwasdetectedfromtheVMwareToolsservice.Thisvalueisinitializedtozerowhenavirtual
machinepowerson.Thevaluestaysatzerountilthefirstheartbeatisdetected.Afterthefirstheartbeat,
thevalueisalwaysgreaterthanzerountilthevirtualmachineispowercycledagain.Thecommand
returnsoneofthefollowingvalues:
0VMwareToolsisnotinstalledornotrunning.
1Guestoperatingsystemisrespondingnormally.
5Intermittentheartbeat.Theremightbeaproblemwiththeguestoperatingsystem.
100Noheartbeat.Guestoperatingsystemmighthavestoppedresponding.
Managing Virtual Machine Snapshots with vmware-cmd
Asnapshotcapturestheentirestateofthevirtualmachineatthetimeyoutakethesnapshot.
Virtualmachinestateincludesthefollowingaspectsofthevirtualmachine.
Memorystate.Contentsofthevirtualmachine’smemory.
Settingsstate.Virtualmachinesettings.
Diskstate.Stateofallthevirtualmachine’svirtualdisks.
Whenyoureverttoasnapshot,youreturntheseitemstothestatetheywereinatthetimethatyoutookthe
snapshot.Ifyouwantthevirtualmachinetoberunningortobeshutdownwhenyoustartit,makesurethat
itisinthatstatewhenyoutakethesnapshot.
Youcanusesnapshotsasrestorationpointswhenyouinstallupdatepackages,orduringabranchingprocess,
suchasinstallingdifferentversionsofaprogram.Takingsnapshotsensuresthateachinstallationbeginsfrom
anidenticalbaseline.ThevSphereVirtualMachineAdministrationdocumentationdiscussessnapshotsindetail.
NOTEYouusuallyusethevmware-cmd guestinfooptiononlywhenVMwareSupportinstructsyoutodo
so.Thecommandisthereforenotdiscussedinthisdocument.
IMPORTANTUsethevSphereWebClienttoreverttoanamedsnapshot.vmware-cmdonlysupportsreverting
tothecurrentsnapshot.
VMware, Inc. 109
Chapter 8 Managing Virtual Machines
Taking Virtual Machine Snapshots
Youcantakeasnapshotwhileavirtualmachineisrunning,shutdown,orsuspended.Ifyouareintheprocess
ofsuspendingavirtualmachine,waituntilthesuspendoperationhasfinishedbeforetakingasnapshot.
Ifavirtualmachinehasmultipledisksindifferentdiskmodes,youmustshutdownthevirtualmachinebefore
takingasnapshot.Forexample,ifyouhaveaspecialpurposeconfigurationthatrequiresyoutousean
independentdisk,youmustshutdownthevirtualmachinebeforetakingasnapshot.
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/testvm.vmx stop soft
2 (Optional)Checkthattheshutdownoperationhasbeencompleted.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx getstate
3Runvmware-cmdwiththecreatesnapshotoption.
Youmustspecifythedescription,quiesceflag(0or1)andmemoryflag(0or1).
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx createsnapshot VM1Aug09
‘test snapshot August 09’ 0 0
4Checkthatthevirtualmachinehasasnapshotbyusingthehassnapshotoption.
Thecallreturns1ifthevirtualmachinehasasnapshotandreturns0otherwise.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx hassnapshot
hassnapshot () = 1
Reverting and Removing Snapshots
Youcanusevmware-cmdtoreverttothecurrentsnapshotortoremoveasnapshot.
Runvmware-cmdwiththerevertsnapshotoptiontoreverttothecurrentsnapshot.Ifnosnapshotexists,the
commanddoesnothingandleavesthevirtualmachinestateunchanged.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx revertsnapshot
Runvmware-cmdwiththeremovesnapshotsoptiontoremoveallsnapshotsassociatedwithavirtual
machine.Ifnosnapshotexists,thecommanddoesnothing.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx removesnapshots
Powering Virtual Machines On and Off
Youcanstart,reboot,stop,andsuspendvirtualmachinesbyusingvmware-cmd.Youmustsupplyavaluefor
thepowerop_modeflag,whichcanbesoftorhard.
IMPORTANTYoucannotusevmware-cmdtoreverttoanamedsnapshot.UsethevSphereWebClienttorevert
toanamedsnapshot.
IMPORTANTYoumusthavethecurrentversionofVMwareToolsinstalledandrunningintheguestoperating
systemtouseasoftpoweroperation.
Getting Started with vSphere Command-Line Interfaces
110 VMware, Inc.
Softpoweroperations.Whenyouspecifysoftasthepowerop_modevalue,theresultofthecalldepends
ontheoperation.
Hardpoweroperations.vmware-cmdimmediatelyandunconditionallyshutsdown,resets,orsuspends
thevirtualmachine.
Thefollowingexamplesillustratehowtousevmware-cmd.
Start.Usethestartoptiontopoweronavirtualmachineortoresumeasuspendedvirtualmachine.The
powerop_mode,eitherhardorsoft,isrequired.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx start soft
Reset.Whenyouresetthevirtualmachinewiththesoftpower_opmode(thedefault),theguest
operatingsystemisshutdownbeforethereset.
IfVMwareToolsisnotcurrentlyinstalledonthevirtualmachine,youcanperformonlyahardreset
operation.
aCheckthatVMwaretoolsisinstalledsothatyoucanresetthevirtualmachinewiththedefault
power_opmode,whichissoft.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx gettoolslastactive
See“RetrievingVirtualMachineAttributes”onpage 107.
bUsetheresetoptiontoshutdownandrestartthevirtualmachine.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx reset soft
Suspend.Youhavetwooptionsforsuspendingavirtualmachine.
Thesuspendoptionwiththehardpoweropmodeunconditionallyshutsdownavirtualmachine.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx suspend hard
Thesuspendoptionwiththesoftpoweropmoderunsscriptsthatresultinagracefulshutdownof
theguestoperatingsystemandshutsdownthevirtualmachine.VMwareToolsmustbeinstalledfor
softpowerop_mode.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx suspend soft
Connecting and Disconnecting Virtual Devices
Thevmware-commandoptionsconnectdeviceanddisconnectdeviceallowyoutoconnectthefollowing
typesofdevicestoyourvirtualmachinesandtodisconnectthem:
Networkadapters
CD/DVDdrives
Floppydrives
Thesedevicesmustalreadybedefinedinthevirtualmachinevirtualhardwarelist.
Operation Result
Stop vmware-cmdattemptstoshutdowntheguestoperatingsystemandpowersoffthevirtualmachine.
Reset vmware-cmdattemptstoshutdowntheguestoperatingsystemandrebootsthevirtualmachine.
Suspend vmware-cmdattemptstorunascriptintheguestoperatingsystembeforesuspendingthevirtual
machine.
VMware, Inc. 111
Chapter 8 Managing Virtual Machines
ThecommandoptionsconnectanddisconnectadefinedISOorFLPfileoraphysicaldeviceonthehost.After
youconnectadevice,itscontentcanbeaccessedfromtheGuestOS.Fornetworkadapters,theoptionsconnect
thevirtualNICtoitsdefinedportgroupordisconnecttheNIC.Thisisequivalenttoselectingordeselecting
theConnectedcheckboxinthevSphereWebClient.
Youcanconnectordisconnectdevicesifthefollowingconditionsaremet:
Thevirtualmachinehasaguestoperatingsystemthatsupportshotplugfunctionality.SeetheOperating
SystemInstallationdocumentation.
Thevirtualmachineisusinghardwareversion7orlater.
Thevirtualmachineispoweredon
Thefollowingexamplesillustrateconnectinganddisconnectingavirtualdevice.Devicenamesarecase
sensitive.
TheconnectdeviceoptionconnectsthevirtualIDEdeviceCD/DVDDrive2tothespecifiedvirtual
machine.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx connectdevice "CD/DVD drive 2"
Thedisconnectdeviceoptiondisconnectsthevirtualdevice.
vmware-cmd -H <vc_system> -U <user> -P <password> --vihost <esx_host>
/vmfs/volumes/Storage2/testvm/testvm.vmx disconnectdevice "CD/DVD drive 2"
Working with the AnswerVM API
TheAnswerVMAPIallowsuserstoprovideinputtoquestions,therebyallowingblockedvirtualmachine
operationstocomplete.Thevmware-cmd --answeroptionallowsyoutoaccesstheinput.Youmightusethis
optionwhenyouwanttoconfigureavirtualmachinebasedonausers’sinput.Forexample:
1Theuserclonesavirtualmachineandprovidesthedefaultvirtualdisktype.
2Whentheuserpowersonthevirtualmachine,itpromptsforthedesiredvirtualdisktype.
Forcibly Stopping Virtual Machines with EXCLI
Insomecases,virtualmachinesdonotrespondtothenormalshutdownorstopcommands.Inthesecases,it
mightbenecessarytoforciblyshutdownthevirtualmachines.Forciblyshuttingdownavirtualmachine
mightresultinguestoperatingsystemdatalossandissimilartopullingthepowercableonaphysical
machine.
Youcanforciblystopvirtualmachinesthatarenotrespondingtonormalstopoperationwiththeesxcli vm
process killcommand.Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLIHost
ManagementCommandsonpage 18inplaceof<conn_options>.
To forcibly stop a virtual machine
1ListallrunningvirtualmachinesonthesystemtoseetheWorldIDofthevirtualmachinethatyouwant
tostop.
esxcli <conn_options> vm process list
2Stopthevirtualmachinebyrunningthefollowingcommand.
esxcli <conn_options> vm process kill --type <kill_type> --world-id <ID>
Thecommandsupportsthree--typeoptions.Trythetypessequentially(softbeforehard,hardbefore
force).Thefollowingtypesaresupportedthroughthe--typeoption:
soft.GivestheVMXprocessachancetoshutdowncleanly(likekillorkill -SIGTERM)
NOTEThetermsCD/DVD drive,Floppy drive.andNetwork adapter arecasesensitive.
Getting Started with vSphere Command-Line Interfaces
112 VMware, Inc.
hard.StopstheVMXprocessimmediately(likekill -9orkill -SIGKILL)
force.StopstheVMXprocesswhenotheroptionsdonotwork.
Ifallthreeoptionsdonotwork,rebootyourESXihosttoresolvetheissue.
VMware, Inc. 113
9
ThevSphereCLInetworkingcommandsallowyoutomanagethevSpherenetworkservices.Youcanconnect
virtualmachinestothephysicalnetworkandtoeachotherandconfigurevSpherestandardswitches.Limited
configurationofvSpheredistributedswitchesisalsosupported.YoucanalsosetupyourvSphere
environmenttoworkwithexternalnetworkssuchasSNMPorNTP.
Thischapterincludesthefollowingtopics:
“IntroductiontovSphereNetworking”onpage 113
“RetrievingBasicNetworkingInformation”onpage 115
“NetworkTroubleshooting”onpage 116
“SettingUpvSphereNetworkingwithvSphereStandardSwitches”onpage 117
“SettingUpvSphereNetworkingwithvSphereDistributedSwitch”onpage 128
“ManagingStandardNetworkingServicesinthevSphereEnvironment”onpage 128
“SettingtheDNSConfiguration”onpage 128
“A d d i n g andStartinganNTPServeronpage 131
“ManagingtheIPGateway”onpage 131
“SettingUpIPsec”onpage 132
“ManagingtheESXiFirewall”onpage 135
“MonitoringVXLAN”onpage 136
Introduction to vSphere Networking
AtthecoreofvSphereNetworkingarevirtualswitches.vSpheresupportsstandardswitches(VSS)and
distributedswitches(VDS).Eachvirtualswitchhasapresetnumberofportsandoneormoreportgroups.
Virtualswitchesallowyourvirtualmachinestoconnecttoeachotherandtoconnecttotheoutsideworld.
Whentwoormorevirtualmachinesareconnectedtothesamevirtualswitch,andthosevirtualmachines
arealsoonthesameportgrouporVLAN,networktrafficbetweenthemisroutedlocally.
Whenvirtualmachinesareconnectedtoavirtualswitchthatisconnectedtoanuplinkadapter,each
virtualmachinecanaccesstheexternalnetworkthroughthatuplink.Theadaptercanbeanuplink
connectedtoastandardswitchoradistributeduplinkportconnectedtoadistributedswitch.
VirtualswitchesallowyourESXihosttomigratevirtualmachineswithVMwarevMotionandtouseIPstorage
throughVMkernelnetworkinterfaces.
UsingvMotion,youcanmigraterunningvirtualmachineswithnodowntime.YoucanenablevMotion
withvicfg-vmknic --enable-vmotion.YoucannotenablevMotionwithESXCLI.
Managing vSphere Networking 9
Getting Started with vSphere Command-Line Interfaces
114 VMware, Inc.
IPstoragereferstoanyformofstoragethatusesTCP/IPnetworkcommunicationasitsfoundationand
includesiSCSIandNFSforESXi.Becausethesestoragetypesarenetworkbased,theycanusethesame
VMkernelinterfaceandportgroup.
ThenetworkservicesthattheVMkernelprovides(iSCSI,NFS,andvMotion)useaTCP/IPstackinthe
VMkernel.TheVMkernelTCP/IPstackisalsoseparatefromtheguestoperatingsystem’snetworkstack.Each
ofthesestacksaccessesvariousnetworksbyattachingtooneormoreportgroupsononeormorevirtual
switches.
Networking Using vSphere Standard Switches
vSpherestandardswitchesallowyoutoconnectvirtualmachinestotheoutsideworld.
Figure 9-1. Networking with vSphere Standard Switches
Figure 91showstherelationshipbetweenthephysicalandvirtualnetworkelements.Thenumbersmatch
thoseinthefigure.
AssociatedwitheachESXihostareoneormoreuplinkadapters(1).Uplinkadaptersrepresentthe
physicalswitchestheESXihostusestoconnecttothenetwork.Youcanmanageuplinkadaptersusingthe
esxcli network nicorvicfg-nicsvCLIcommand.See“ManagingUplinkAdapters”onpage 122.
Eachuplinkadapterisconnectedtoastandardswitch(2).Youcanmanageastandardswitchand
associateitwithuplinkadaptersbyusingtheesxcli network vswitchorvicfg-vswitchvCLI
command.See“SettingUpVirtualSwitchesandAssociatingaSwitchwithaNetworkInterface”on
page 117.
Associatedwiththestandardswitchareportgroups(3).Portgroupisauniqueconceptinthevirtual
environment.Youcanconfigureportgroupstoenforcepoliciesthatprovideenhancednetworking
security,networksegmentation,betterperformance,highavailability,andtrafficmanagement.Youcan
usetheesxcli network vswitch standard portgrouporvicfg-vswitchcommandtoassociatea
standardswitchwithaportgroup,andtheesxcli network ip interfaceorvicfg-vmkniccommand
toassociateaportgroupwithaVMkernelnetworkinterface.
TheVMkernelTCP/IPnetworkingstacksupportsiSCSI,NFS,andvMotionandhasanassociated
VMkernelnetworkinterface.YouconfigureVMkernelnetworkinterfaceswithesxcli network ip
interfaceorvicfg-vmknic.See“A d d i n g andModifyingVMkernelNetworkInterfaces”onpage 125.
SeparateVMkernelnetworkinterfacesareoftenusedforseparatetasks,forexample,youmightdevote
oneVMkernelNetworkinterfacecardtovMotiononly.VirtualmachinesruntheirownsystemsTCP/IP
stacksandconnecttotheVMkernelattheEthernetlevelthroughvirtualswitches.
physical network adapters
Host1
Host1
Host2
Host2
port
groups
Network
C
VM VM VM VM
VM
vSphere Standard Switch
ABCDE
vSphere Standard Switch
ABCDE
virtual
physical
physical network
1
2
3
VMware, Inc. 115
Chapter 9 Managing vSphere Networking
Networking Using vSphere Distributed Switches
Whenyouwanttoconnectavirtualmachinetotheoutsideworld,youcanuseastandardswitchora
distributedswitch.Withadistributedswitch,thevirtualmachinecanmaintainitsnetworksettingsevenifthe
virtualmachineismigratedtoadifferenthost.
Figure 9-2. Networking with vSphere Distributed Switches
Eachphysicalnetworkadapter(1)onthehostispairedwithadistributeduplinkport(2),which
representstheuplinktothevirtualmachine.Withdistributedswitches,thevirtualmachinenolonger
dependsonthehost’sphysicaluplinkbutonthe(virtual)uplinkport.Youmanageauplinkports
primarilyusingthevSphereWebClient,orvSphereAPIs.
Thedistributedswitchitself(3)functionsasasinglevirtualswitchacrossallassociatedhosts.Becausethe
switchisnotassociatedwithasinglehost,virtualmachinescanmaintainconsistentnetwork
configurationastheymigratefromonehosttoanother.
Likeastandardswitch,eachdistributedswitchisanetworkhubthatvirtualmachinescanuse.A
distributedswitchcanroutetrafficinternallybetweenvirtualmachinesorlinktoanexternalnetworkby
connectingtophysicalnetworkadapters.YoucreateadistributedswitchusingthethevSphereWeb
ClientUI,butcanmanagesomeaspectsofadistributedswitchwithvicfg-vswitch.Youcanlist
distributedvirtualswitcheswiththeesxcli network vswitchcommand.See“SettingUpVirtual
SwitchesandAssociatingaSwitchwithaNetworkInterface”onpage 117.
Retrieving Basic Networking Information
ServiceconsolecommandsforretrievingnetworkinginformationarenotincludedintheESXiShell.Youcan
insteaduseESXCLIcommandsdirectlyintheshellorusevCLIcommands.
OnESXi5.0,ifconfiginformationshouldbetheinformationoftheVMkernelNICthatattachestothe
ManagementNetworkportgroup.YoucanretrieveinformationbyusingESXCLIcommands.
esxcli <conn_options> network ip interface list
esxcli <conn_options> network ip interface ipv4 get -n vmk<X>
esxcli <conn_options> network ip interface ipv6 get -n vmk<X>
esxcli <conn_options> network ip interface ipv6 address list
ForinformationcorrespondingtotheLinuxnetstatcommand,usethefollowingESXCLIcommand.
esxcli <conn_options> network ip connection list
physical network adapters
Host1
Host1
Host2
Host2
Network
C
VM VM VM VM
VM
vSphere Distributed Switch
uplink uplink
ABCDEFGH I J
virtual
distributed port group
physical
physical network
1
2
4
3
Getting Started with vSphere Command-Line Interfaces
116 VMware, Inc.
Youcanalsopingindividualhostswiththeesxcli network diag pingcommand.Thecommandincludes
optionsforusingICMPv4orICMPv6packetrequests,specifyinganinterfacetouse,specifyingtheinterval,
andsoon.
Network Troubleshooting
YoucanusevCLInetworkcommandstoviewnetworkstatisticsandtroubleshootyournetworkingsetup.The
nestedhierarchyofcommandsallowsyoutodrilldowntopotentialtroublespots.
1Listallvirtualmachinenetworksonahost.
esxcli network vm list
ThecommandreturnsforeachvirtualmachinetheWorldID,name,numberofports,andnetworks,asin
thefollowingexample.
World ID Name Num Ports Networks
----------------------------------------------------
10374 ubuntu-server-11.04-1 2 VM Network, dvportgroup-19
10375 ubuntu-server-11.04-2 2 VM Network, dvportgroup-19
10376 ubuntu-server-11.04-3 2 VM Network, dvportgroup-19
10408 ubuntu-server-11.04-4 3 VM Network, VM Network 10Gbps, dvportgroup-19
2ListtheportsforoneoftheVMsbyspecifyingitsWorldID.
esxcli network vm port list -w 10408
Thecommandreturnsportinformation,asinthefollowingexample.
Port:
Port ID: XXXXXXXX
vSwitch: vSwitch0
Portgroup: VM Network
DVPort ID:
MAC Address: 00:XX:XX:aa:XX:XX
IP Address: 10.XXX.XXX.XXX
Team Uplink: vmnic0
Uplink Port ID: 12345678
Active Filters:
3 Retrievetheswitchstatisticsforaport.
esxcli network port stats get -p 12345678
Thecommandreturnsdetailedstatistics,asinthefollowingexample.
Packet statistics for port 12345678:
Packets received: 517631
Packets sent: 18937
Bytes received: 100471874
Bytes sent: 1527233
Broadcast packets received: 474160
Broadcast packets sent: 107
Multicast packets received: 8020
Multicast packets sent: 8
Unicast packets received: 35451
Unicast packets sent: 18822
Receive packets dropped: 45
Transmit packets dropped: 0
4 Retrievethefilterinformationfortheport.
esxcli network port filter stats get -p 12345678
Thecommandreturnsdetailedstatistics,asinthefollowingexample.
Filter statistics for dvfilter-test:
Filter direction: Receive
Packets in: 202080
Packets out: 202080
Packets dropped: 0
VMware, Inc. 117
Chapter 9 Managing vSphere Networking
Packets filtered: 0
Packets faulted: 0
Packets queued: 0
Packets injected: 0
Packet errors: 0
5 RetrievecompletestatisticsforaNIC.
esxcli network nic stats get -n vmnic0
6GetaperVLANpackedbreakdownonaNIC.
esxcli network nic vlan stats get -n vmnic0
ThecommandreturnsthenumberofpacketssentandreceivedfortheVLANyouspecified.
Setting Up vSphere Networking with vSphere Standard Switches
Youcansetupyourvirtualnetworkbyperformingthesetasks.
7 Createormanipulatevirtualswitchesusingesxcli network vswitchorvicfg-vswitch.Bydefault,
eachESXihosthasonevirtualswitch,vSwitch0.Youcancreateadditionalvirtualswitchesormanage
existingswitches.See“SettingUpVirtualSwitchesandAssociatingaSwitchwithaNetworkInterface”
onpage 117.
8 (Optional)Makechangestotheuplinkadapterusingesxcli network vswitch standard uplinkor
vicfg-nics.See“ManagingUplinkAdapters”onpage 122.
9 (Optional)Useesxcli network vswitch standard portgrouporvicfg-vswitchtoaddportgroups
tothevirtualswitch.See“ManagingPortGroupswithvicfgvswitch”onpage 120.
10 (Optional)Useesxcli network vswitch standard portgroup setorvicfg-vswitchtoestablish
VLANsbyassociatingportgroupswithVLANIDs.See“SettingthePortGroupVLANIDwith
vicfgvswitch”onpage 122.
11 Useesxcli network ip interfaceorvicfg-vmknictoconfiguretheVMkernelnetworkinterfaces.
See“A d d i n g andModifyingVMkernelNetworkInterfacesonpage 125.
Setting Up Virtual Switches and Associating a Switch with a Network Interface
AvirtualswitchmodelsaphysicalEthernetswitch.Youcanmanagevirtualswitchesandportgroupsbyusing
thevSphereWebClient(seethevSphereNetworkingdocumentation)orbyusingvSphereCLIcommands.
Youcancreateamaximumof127virtualswitchesonasingleESXihost.Bydefault,eachESXihosthasasingle
virtualswitchcalledvSwitch0.Bydefault,avirtualswitchhas56logicalports.SeetheConfiguration
MaximumsdocumentonthevSpheredocumentationmainpagefordetails.Portsconnecttothevirtual
machinesandtheESXiphysicalnetworkadapters.
YoucanconnectonevirtualmachinenetworkadaptertoeachportbyusingthevSphereWebClientUI.
Youcanconnecttheuplinkadaptertothevirtualswitchesbyusingvicfg-vswitchoresxcli network
vswitch standard uplink.See“LinkingandUnlinkingUplinkAdapterswithvicfgvswitch”on
page 124.
Whentwoormorevirtualmachinesareconnectedtothesamevirtualswitch,networktrafficbetweenthemis
routedlocally.Ifanuplinkadapterisattachedtothevirtualswitch,eachvirtualmachinecanaccessthe
externalnetworkthattheadapterisconnectedto.
Thissectiondiscussesworkinginastandardswitchenvironment.See“NetworkingUsingvSphere
DistributedSwitches”onpage 115forinformationaboutdistributedswitchenvironments.
Getting Started with vSphere Command-Line Interfaces
118 VMware, Inc.
Whenworkingwithvirtualswitchesandportgroups,performthefollowingtasks:
1Findoutwhichvirtualswitchesareavailableand(optionally)whattheassociatedMTUandCDP(Cisco
DiscoveryProtocol)settingsare.See“RetrievingInformationaboutVirtualSwitcheswithESXCLI”on
page 118and“RetrievingInformationaboutVirtualSwitcheswithvicfgvswitch”onpage 118.
2Addavirtualswitch.See“A d d i n g andDeletingVirtualSwitcheswithESXCLI”onpage 119and“A d d i n g
andDeletingVirtualSwitcheswithvicfgvswitch”onpage 119.
3Foranewlyaddedswitch,performthesetasks:
aAddaportgroup.See“ManagingPortGroupswithESXCLI”onpage 120and“ManagingPort
Groupswithvicfgvswitch”onpage 120.
b (Optional)SettheportgroupVLANID.See“SettingthePortGroupVLANIDwithESXCLI”on
page 121and“SettingthePortGroupVLANIDwithvicfgvswitch”onpage 122.
cAddanuplinkadapter.See“LinkingandUnlinkingUplinkAdapterswithESXCLI”onpage 124and
“LinkingandUnlinkingUplinkAdapterswithvicfgvswitch”onpage 124.
d (Optional)ChangetheMTUorCDPsettings.See“SettingSwitchAttributeswithesxclinetwork
vswitchstandard”onpage 119and“SettingSwitchAttributeswithvicfgvswitch”onpage 120.
Retrieving Information About Virtual Switches
YoucanretrieveinformationaboutvirtualswitchesbyusingESXCLIorvicfg-vswitch.Specifyoneofthe
optionslistedin“ConnectionOptionsforvCLIHostManagementCommandsonpage 18inplaceof
<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,andotherinformation.TheoutputincludesinformationaboutCDPsettingsfor
thevirtualswitch.Thepreciseinformationdependsonthetargetsystem.Thedefaultportgroupsare
Management NetworkandVM Network.
Listthenetworkpolicysettings(securitypolicy,trafficshapingpolicy,andfailoverpolicy)forthevirtual
switch.Thefollowingcommandsaresupported.
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
Youcanretrieveinformationaboutvirtualswitchesbyusingthevcifg-vswitchcommand.Specifyoneof
theoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof
<conn_options>.
CheckwhethervSwitch1exists.
vicfg-vswitch <conn_options> -c vSwitch1
Listallvirtualswitchesandassociatedportgroups.
vicfg-vswitch <conn_options> -l
Thecommandprintsinformationaboutthevirtualswitch,whichmightincludeitsname,numberof
ports,MTU,portgroups,andotherinformation.ThedefaultportgroupsareManagement Networkand
VM Network.
RetrievethecurrentCDP(CiscoDiscoveryProtocol)settingforthisvirtualswitch.
VMware, Inc. 119
Chapter 9 Managing vSphere Networking
IfCDPisenabledonavirtualswitch,ESXiadministratorscanfindoutwhichCiscoswitchportis
connectedtowhichvirtualswitchuplink.CDPisalinklevelprotocolthatsupportsdiscoveryof
CDPawarenetworkhardwareateitherendofadirectconnection.CDPisbitforwardedthrough
switches.CDPisasimpleadvertisementprotocolwhichbeaconsinformationabouttheswitchorhostand
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 namespace.Specify
oneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplace
of<conn_options>.
Addavirtualswitch.
esxcli <conn_options> network vswitch standard add --vswitch-name=vSwitch42
Youcanspecifythenumberofportgroupswhileaddingthevirtualswitch.Ifyoudonotspecifyavalue,
thedefaultvalueisused.Thesystemwideportcountcannotbegreaterthan4096.
esxcli <conn_options> network vswitch standard add --vswitch-name=vSwitch42 --ports=8
Afteryouhaveaddedavirtualswitch,youcansetswitchattributes(“SettingSwitchAttributeswithesxcli
networkvswitchstandard”onpage 119)andaddoneormoreuplinkadapters(“LinkingandUnlinking
UplinkAdapterswithESXCLI”onpage 124).
Deleteavirtualswitch.
esxcli <conn_options> network vswitch standard remove --vswitch-name=vSwitch42
YoucannotdeleteavirtualswitchifanyportsontheswitcharestillinusebyVMkernelnetworksor
virtualmachines.Runesxcli network vswitch standard list todeterminewhetheravirtualswitch
isinuse.
Adding and Deleting Virtual Switches with vicfg-vswitch
Youcanaddanddeletevirtualswitchesusingthe--add|-aand--delete|-doptions.Specifyoneofthe
optionslistedin“ConnectionOptionsforvCLIHostManagementCommandsonpage 18inplaceof
<conn_options>.
Addavirtualswitch.
vicfg-vswitch <conn_options> --add vSwitch2
Afteryouhaveaddedavirtualswitch,youcansetswitchattributes(“SettingSwitchAttributeswith
vicfgvswitch”onpage 120)andaddoneormoreuplinkadapters(“LinkingandUnlinkingUplink
Adapterswithvicfgvswitch”onpage 124).
Deleteavirtualswitch.
vicfg-vswitch <conn_options> --delete vSwitch1
YoucannotdeleteavirtualswitchifanyportsontheswitcharestillinusebyVMkernelnetworks,virtual
machines,orvswifs.Runvicfg-vswitch --listtodeterminewhetheravirtualswitchisinuse.
Setting Switch Attributes with esxcli network vswitch standard
Youcansetthemaximumtransmissionunit(MTU)andCDPstatusforavirtualswitch.TheCDPstatusshows
whichCiscoswitchportisconnectedtowhichuplink.Specifyoneoftheoptionslistedin“ConnectionOptions
forvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
SettheMTUforavSwitch.
Getting Started with vSphere Command-Line Interfaces
120 VMware, Inc.
esxcli <conn_options> network vswitch standard set --mtu=9000 --vswitch-name=vSwitch1
TheMTUisthesize,inbytes,ofthelargestprotocoldataunittheswitchcanprocess.Whenyousetthis
option,itaffectsalluplinksassignedtothevirtualswitch.
SettheCDPvalueforavSwitch.Youcansetstatustodown,listen,advertise,orboth.
esxcli <conn_options> network vswitch standard set --cdp-status=listen
--vswitch-name=vSwitch1
Setting Switch Attributes with vicfg-vswitch
Youcansetthemaximumtransmissionunit(MTU)andCDPstatusforavirtualswitch.TheCDPstatusshows
whichCiscoswitchportisconnectedtowhichuplink.Specifyoneoftheoptionslistedin“ConnectionOptions
forvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
SettheMTUforavSwitch.
vicfg-vswitch <conn_options> -m 9000 vSwitch1
TheMTUisthesize(inbytes)ofthelargestprotocoldataunittheswitchcanprocess.Whenyousetthis
option,itaffectsalluplinksassignedtothevirtualswitch.
SettheCDPvalueforavSwitch.Youcansetstatustodown,listen,advertise,orboth.
vicfg-vswitch <conn_options> --set-cdp ‘listen’
Checking, Adding, and Removing Port Groups
Youcancheck,add,andremoveportgroupswithESXCLIandwithvicfg-vswitch.
Managing Port Groups with ESXCLI
NetworkservicesconnecttovSwitchesthroughportgroups.Aportgroupallowsyoutogrouptrafficand
specifyconfigurationoptionssuchasbandwidthlimitationsandVLANtaggingpoliciesforeachportinthe
portgroup.Avirtualswitchmusthaveoneportgroupassignedtoit.Youcanassignadditionalportgroups.
Youcanuseesxcli network vswitch standard portgroup tocheck,add,andremoveportgroups.
Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18
inplaceof<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
Networkservicesconnecttovirtualswitchesthroughportgroups.Aportgroupallowsyoutogrouptraffic
andspecifyconfigurationoptionssuchasbandwidthlimitationsandVLANtaggingpoliciesforeachportin
theportgroup.Avirtualswitchmusthaveoneportgroupassignedtoit.Youcanassignadditionalport
groups.Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”on
page 18inplaceof<conn_options>.
Youcanusevicfg-vswitchtocheck,add,andremoveportgroups.
Checkwhetherportgroupsarecurrentlyassociatedwithavirtualswitch.
vicfg-vswitch <conn_options> --check-pg <port_group> vSwitch1
VMware, Inc. 121
Chapter 9 Managing vSphere Networking
Thecommandreturns0ifthespecifiedportgroupisassociatedwiththevirtualswitch,andreturns1
otherwise.Usevicfg-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,evenifthevirtualswitchisconnectedwithmultipleuplinks.Specifyoneoftheoptionslisted
in“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
Connectaportgroupwithanuplinkadapter.
esxcli <conn_options> network vswitch standard portgroup policy failover set
--active-uplinks=vmnic1,vmnic6,vmnic7
Thiscommandfailssilentlyiftheuplinkadapterdoesnotexist.
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,evenifthevirtualswitchisconnectedwithmultipleuplinks.Specifyoneoftheoptionslisted
in“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof<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
properlyrepresentconnectivity.VLANIDsareoptional.
Getting Started with vSphere Command-Line Interfaces
122 VMware, Inc.
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 g42
Setting the Port Group VLAN ID with vicfg-vswitch
VLANsallowyoutofurthersegmentasinglephysicalLANsegmentsothatgroupsofportsareisolatedasif
theywereonphysicallydifferentsegments.ThestandardisIEEE802.1Q.
AVLANIDrestrictsportgrouptraffictoalogicalEthernetsegmentwithinthephysicalnetwork.
SettheVLANIDto4095toallowaportgrouptoreachportgroupslocatedonotherVLAN.
SettheVLANIDto0todisabletheVLANforthisportgroup.
IfyouuseVLANIDs,youmustchangetheportgrouplabelsandVLANIDstogethersothatthelabels
properlyrepresentconnectivity.VLANIDsareoptional.
YoucanusethefollowingcommandsforVLANmanagement:
AllowallportgroupstoreachportgroupslocatedonotherVLANs.
vicfg-vswitch <conn_options> --vlan 4095 --pg “ALL” vSwitch2
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 nicsorthevicfg-nicscommand.Youcanalsouseesxcli network
vswitchandesxcfg-vswitchtolinkandunlinktheuplink.
Youcanusevicfg-nicstolistinformationandtospecifyspeedandduplexsettingfortheuplink.
Youcanuseesxcli network nic tolistalluplinks,tolistinformation,tosetattributes,andtobringa
specifieduplinkdownorup.
Managing Uplink Adapters with esxcli network nic
Thefollowingexampleworkflowlistsalluplinkadapters,listspropertiesforoneuplinkadapter,changesthe
uplink’sspeedandduplexsettings,andbringstheuplinkdownandbackup.Specifyoneoftheoptionslisted
in“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
To manipulate uplink adapter setup
1Listalluplinksandinformationabouteachdevice.
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
VMware, Inc. 123
Chapter 9 Managing vSphere Networking
3 Changeuplinkadaptersettings.
esxcli <conn_options> network nic set <option>
Specifyoneofthefollowingoptions.
4 (Optional)Bringtheuplinkadapterbackup.
esxcli <conn_options> network nic up --nic-name=vmnic0
Specifying Multiple Uplinks with ESXCLI
Atanytime,oneportgroupNICarrayandacorrespondingsetofactiveuplinksexist.Whenyouchangethe
activeuplinks,youalsochangethestandbyuplinksandthenumberofactiveuplinks.
Thefollowingexampleillustrateshowactiveandstandbyuplinksareset.
1Theportgroupnicarrayis[vmnic1,vmnic0,vmnic3,vmnic5,vmnic6,vmnic7]andactive-uplinksis
settothreeuplinks(vmnic1,vmnic0,vmnic3).Theotheruplinksarestandbyuplinks.
2Yousettheactiveuplinkstoanewset[vmnic3,vmnic5].
3Thenewuplinksoverridetheoldset.TheNICarraychangesto[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
-a|--auto Setthespeedandduplexsettingstoautonegotiate.
-D|--duplex=<str> DuplextosetthisNICto.Acceptablevaluesarefullandhalf.
-P | --phy-address SettheMACaddressofthedevice
-l|--message-level=<long> Setthedrivermessagelevel.Messagelevelsandwhattheyimplydifferper
driver.
-n|--nic-name=<str> NameoftheNICtoconfigured.Mustbeoneofthecardslistedinthenic list
command(required).
-p|--port=<str> Selectsthedeviceport.Thefollowingdeviceportsareavailable.
auiSelectauiasthedeviceport
bncSelectbncasthedeviceport
fibreSelectmiiasthedeviceport
miiSelectmiiasthedeviceport
tpSelecttpasthedeviceport
-S|--speed=<long> SpeedtosetthisNICto.Acceptablevaluesare10,100,1000,and10000.
-t|--transceiver-type=<str> Selecttransceivertype.Thefollowingtransceivertypesareavailable.
externalSetthetransceivertypetoexternal
internalSetthetransceivertypetointernal
-w|--wake-on-lan=<str> SetWake-on-LANoptions.Notalldevicessupportthisoption.Theoptionvalue
isastringofcharactersspecifyingwhichoptionstoenable.
pWakeonphyactivity
uWakeonunicastmessages
mWakeonmulticastmessages
bWakeonbroadcastmessages
aWakeonARP
gWakeonMagicPacket
sEnableSecureOnpasswordforMagicPacket
Getting Started with vSphere Command-Line Interfaces
124 VMware, Inc.
Managing Uplink Adapters with vicfg-nics
Thefollowingexampleworkflowlistsanuplinkadaptersproperties,changestheduplexandspeed,andsets
theuplinktoautonegotiateitsspeedandduplexsettings.Specifyoneoftheoptionslistedin“Connection
OptionsforvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
To manipulate uplink adapter setup
1Listsettings.
vicfg-nics <conn_options> -l
Liststheuplinksinthesystem,theircurrentandconfiguredspeed,andtheirduplexsetting.
2Setthesettingsforvmnic0tofullandthespeedto100.
vicfg-nics <conn_options> -d full -s 100 vmnic0
3Setvmnic2toautonegotiateitsspeedandduplexsettings.
vicfg-nics <conn_options> -a vmnic2
Linking and Unlinking Uplink Adapters with ESXCLI
Whenyoucreateavirtualswitchusingesxcli network vswitch standard add,alltrafficonthatvirtual
switchisinitiallyconfinedtothatvirtualswitch.Allvirtualmachinesconnectedtothevirtualswitchcantalk
toeachother,butthevirtualmachinescannotconnecttothenetworkortovirtualmachinesonotherhosts.A
virtualmachinealsocannotconnecttovirtualmachinesconnectedtoadifferentvirtualswitchonthesame
host.
Havingavirtualswitchthatisnotconnectedtothenetworkmightmakesenseifyouwantagroupofvirtual
machinestobeabletocommunicatewitheachother,butnotwithotherhostsorwithvirtualmachineson
otherhosts.Inmostcases,yousetupthevirtualswitchtotransferdatatoexternalnetworksbyattachingone
ormoreuplinkadapterstothevirtualswitch.
Youcanusethefollowingcommandstolist,add,andremoveuplinkadapters.WhenyoulinkusingESXCLI,
thephysicalNICisaddedasastandbyadapterbydefault.Youcanthenmodifytheteamingpolicytomake
thephysicalNICactivebyrunningthecommandesxcli network vswitch standard policy failover
set.
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
confinedtothatvirtualswitch.Allvirtualmachinesconnectedtothevirtualswitchcantalktoeachother,but
thevirtualmachinescannotconnecttothenetworkortovirtualmachinesonotherhosts.Avirtualmachine
alsocannotconnecttovirtualmachinesconnectedtoadifferentvirtualswitchonthesamehost.
Havingavirtualswitchthatisnotconnectedtothenetworkmightmakesenseifyouwantagroupofvirtual
machinestobeabletocommunicatewitheachother,butnotwithotherhostsorwithvirtualmachineson
otherhosts.Inmostcases,yousetupthevirtualswitchtotransferdatatoexternalnetworksbyattachingone
ormoreuplinkadapterstothevirtualswitch.
Youcanusethefollowingcommandstoaddandremoveuplinkadapters:
VMware, Inc. 125
Chapter 9 Managing vSphere Networking
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,andothermanagementtrafficontheESXisystem.YoucanalsobindanewlycreatedVMkernel
networkinterfaceforusebysoftwareanddependenthardwareiSCSIbyusingtheesxcli iscsicommands.
TheVMkernelnetworkinterfaceisseparatefromthevirtualmachinenetwork.Theguestoperatingsystem
andapplicationprogramscommunicatewithaVMkernelnetworkinterfacethroughacommonlyavailable
devicedriveroraVMwaredevicedriveroptimizedforthevirtualenvironment.Ineithercase,communication
intheguestoperatingsystemoccursasitwouldwithaphysicaldevice.Virtualmachinescanalso
communicatewithaVMkernelnetworkinterfaceifbothusethesamevirtualswitch.
EachVMkernelnetworkinterfacehasitsownMACaddressandoneormoreIPaddresses,andrespondsto
thestandardEthernetprotocolaswouldaphysicalNIC.TheVMkernelnetworkinterfaceiscreatedwithTCP
SegmentationOffload(TSO)enabled.
YoucanmanageVMkernelNICswithESXCLI(see“ManagingVMkernelNetworkInterfaceswithESXCLI”
onpage 125)andwithvicfg-vmknic(see“ManagingVMkernelNetworkInterfaceswithvicfgvmknic”on
page 126).
Managing VMkernel Network Interfaces with ESXCLI
YoucanconfiguretheVMkernelnetworkinterfaceforIPv4(see“ToaddandconfigureanIPv4VMkernel
NetworkInterfaceforIPv4”onpage 125)orforIPv6(see“ToaddandconfigureaVMkernelNetwork
InterfaceforIPv6”onpage 126)withESXCLI.Incontrasttovicfg-vmknic,ESXCLIdoesnotsupport
enablingvMotion.
YoucanaddandconfigureanIPv4VMkernelNICwithESXCLI.Specifyoneoftheoptionslistedin
“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
To add and configure an IPv4 VMkernel Network Interface for IPv4
1AddanewVMkernelnetworkinterface.
esxcli <conn_options> network ip interface add --interface-name=vmk<x>
--portgroup-name=<my_portgroup>
YoucanspecifytheMTUsettingafteryouhaveaddedthenetworkinterfacebyusingesxcli network
ip interface set --mtu.
2ConfiguretheinterfaceasanIPv4interface.YoumustspecifytheIPaddressusing--ip,thenetmask,and
thename.Forthefollowingexamples,assumethatVMSFVMK363isaportgrouptowhichyouwantto
addaVMkernelnetworkinterface.
esxcli <conn_options> network ip interface ipv4 set --ipv4=<ip_address>
--netmask=255.255.255.0 --interface-name=vmk<X>
Youcansettheaddressasfollows.
<X.X.X.X>–StaticIPv4address.
DHCPUseIPv4DHCP.
TheVMkernelsupportsDHCPonlyforESXi4.0andlater.
Whenthecommandfinishessuccessfully,thenewlyaddedVMkernelnetworkinterfaceisenabled.
3ListinformationaboutallVMkernelnetworkinterfacesonthesystem.
esxcli <conn_options> network ip interface list
Getting Started with vSphere Command-Line Interfaces
126 VMware, Inc.
Thecommanddisplaysthenetworkinformation,portgroup,MTU,andcurrentstateforeachvirtual
networkadapterinthesystem.
YoucanaddandconfigureanIPv6VMkernelNICwithESXCLI.
To add and configure a VMkernel Network Interface for IPv6
1Runesxcli 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.
2Runesxcli network ip interface ipv6 address add toconfiguretheinterfaceasanIPv6interface.
YoumustspecifytheIPaddressusing--ipandthename.Forthefollowingexamples,assumethat
VMSFVMK363isaportgrouptowhichyouwanttoaddaVMkernelnetworkinterface.
esxcli <conn_options> network ip interface ipv6 address add --ip=<X:X:X::/X>
--interface-name=vmk<X>
Youcansettheaddressasfollows.
<X:X:X::/X>:StaticIPv6address
--enable-dhcpv6:EnablesDHCPv6onthisinterfaceandattemptstoacquireanIPv6addressfrom
thenetwork.
--enable-router-adv:UsetheIPv6addressadvertisedbytherouter.Theaddressisaddedwhen
theroutersendsthenextrouteradvert.
TheVMkernelsupportsDHCPonlyforESXi4.0andlater.
Whenthecommandcompletessuccessfully,thenewlyaddedVMkernelnetworkinterfaceisenabled.
3ListinformationaboutallVMkernelnetworkinterfacesonthesystem.
esxcli <conn_options> network ip interface list
Thelistcontainsthenetworkinformation,portgroup,MTU,andcurrentstateforeachVMkernel
NetworkInterfaceonthesystem.
4YoucanlaterremovetheIPv6addressanddisableIPv6.
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(see“ToaddandconfigureanIPv4VMkernel
NetworkInterfacewithvicfgvmknic”onpage 126)orforIPv6(see“ToaddandconfigureanIPv6VMkernel
NetworkInterfacewithvicfgvmknic”onpage 127).Specifyoneoftheoptionslistedin“ConnectionOptions
forvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
To add and configure an IPv4 VMkernel Network Interface with vicfg-vmknic
1Runvicfg-vmknic --addtoaddaVMkernelnetworkinterface.
YoumustspecifytheIPaddressbyusing--ip,thenetmask,andthename.Forthefollowingexamples,
assumethatVMSFVMK363isaportgrouptowhichyouwanttoaddaVMkernelnetworkinterface.
vicfg-vmknic <conn_options> --add --ip <ip_address> -n 255.255.255.0 VMSF-VMK-363
YoucanspecifytheMTUsettingwhenaddingaVMkernelnetworkinterface.Youcannotchangethat
settingatalatertime.
Whenthecommandcompletessuccessfully,thenewlyaddedVMkernelnetworkinterfaceisenabled.
VMware, Inc. 127
Chapter 9 Managing vSphere Networking
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.
4ListinformationaboutallVMkernelnetworkinterfacesonthesystem.
vicfg-vmknic <conn_options> --list
Thecommanddisplaysthenetworkinformation,portgroup,MTU,andcurrentstateforeachvirtual
networkadapterinthesystem.
To add and configure an IPv6 VMkernel Network Interface with vicfg-vmknic
1Runvicfg-vmknic --addtoaddaVMkernelnetworkinterface.
YoumustspecifytheIPaddressbyusing--ip,thenetmask,andtheportgroupname.Forthefollowing
examples,assumethatVMSFVMK363isaportgrouptowhichyouwanttoaddaVMkernelnetwork
interface.
YoucanspecifytheMTUsettingwhenyouaddaVMkernelnetworkinterface.Youcannotchangethat
settingatalatertime.
Whenthecommandcompletessuccessfully,thenewlyaddedVMkernelnetworkinterfaceisenabled.
2EnableIPv6.
vicfg-vmknic <conn_options> --enable-ipv6 true VMSF-VMK-363
3 SupplyanIPv6address.
vicfg-vmknic <conn_options> --ip <ip_address> VMSF-VMK-363
ForIPv6,theIPaddresscanhaveoneofthefollowingformats:
<X:X:X::/X>StaticIPv6address
DHCPV6UseDHCPIPv6address.TheVMkernelsupportsDHCPonlyforESX/ESXi4.0andlater.
AUTOCONFUsetheIPv6addressadvertisedbytherouter.IfyoucreateaVMkernelnetworkinterface
withAUTOCONF,anaddressisassignedimmediately.IfyouaddAUTOCONFtoanexisting
vmknic,theaddressisaddedwhentheroutersendsthenextrouteradvert.
4 (Optional)EnablevMotion.
Bydefault,vMotionisdisabled.
vicfg-vmknic <conn_options> --enable-vmotion VMSF-VMK-363
Youcanlateruse--disable-vmotiontodisablevMotionagain.
5ListinformationaboutallVMkernelnetworkinterfacesonthesystem.
vicfg-vmknic <conn_options> --list
Thelistcontainsthenetworkinformation,portgroup,MTU,andcurrentstateforeachvirtualnetwork
adapterinthesystem.
6YoucanlaterremovetheIPv6addressanddisableIPv6.
Getting Started with vSphere Command-Line Interfaces
128 VMware, Inc.
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
Adistributedswitchfunctionsasasinglevirtualswitchacrossallassociatedhosts.Adistributedswitchallows
virtualmachinestomaintainaconsistentnetworkconfigurationastheymigrateacrossmultiplehosts.See
“NetworkingUsingvSphereDistributedSwitches”onpage 115.
LikeavSpherestandardswitch,eachdistributedswitchisanetworkhubthatvirtualmachinescanuse.A
distributedswitchcanforwardtrafficinternallybetweenvirtualmachinesorlinktoanexternalnetworkby
connectingtouplinkadapters.
Eachdistributedswitchcanhaveoneormoredistributedportgroupsassignedtoit.Distributedportgroups
groupmultipleportsunderacommonconfigurationandprovideastableanchorpointforvirtualmachines
thatareconnectingtolabelednetworks.Eachdistributedportgroupisidentifiedbyanetworklabel,whichis
uniquetothecurrentdatacenter.AVLANID,whichrestrictsportgrouptraffictoalogicalEthernetsegment
withinthephysicalnetwork,isoptional.
YoucancreatedistributedswitchesbyusingthevSphereWebClient.Afteryouhavecreatedadistributed
switch,youcanaddhostsbyusingthevSphereWebClient,createdistributedportgroups,andedit
distributedswitchpropertiesandpolicieswiththevSphereWebClient.Youcanaddandremoveuplinkports
byusingvicfg-vswitch.
SeethevSphereNetworkingdocumentationandthewhitepaperavailablethroughtheResourceslinkat
http://www.vmware.com/go/networkingforinformationaboutdistributedswitchesandhowtoconfigure
themusingthevSphereWebClient.
Youcanaddandremovedistributedswitchuplinkportswithvicfg-vswitch.
Afterthedistributedswitchhasbeensetup,youcanusevicfg-vswitchtoaddorremoveuplinkports.
Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18
inplaceof<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.
IMPORTANTInvSphere5.0,youcannotcreatedistributedvirtualswitcheswithESXCLI.
IMPORTANTYoucannotaddandremoveuplinkportswithESXCLI.
IMPORTANTIfyoutrytochangethehostordomainnameortheDNSserveronhoststhatuseDHCP,anerror
results.
VMware, Inc. 129
Chapter 9 Managing vSphere Networking
InnetworkenvironmentswhereaDHCPserverandaDNSserverareavailable,ESXihostsareautomatically
assignedDNSnames.
InnetworkenvironmentswhereautomaticDNSisnotavailableoryoudonotwanttouseautomaticDNS,you
canconfigurestaticDNSinformation,includingahostname,primarynameserver,secondarynameserver,
andDNSsuffixes.
Theesxcli network ip dnsnamespaceincludestwonamespaces.
esxcli network ip dns searchincludescommandsforDNSsearchdomainconfiguration.
esxcli network ip dns serverincludescommandsforDNSserverconfiguration.
ThefollowingexampleillustratessettingupaDNSserver.Specifyoneoftheoptionslistedin“Connection
OptionsforvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
To set up a DNS Server
1PrintalistofDNSserversconfiguredonthesystemintheorderinwhichtheywillbeused.
esxcli <conn_options> network ip dns server list
IfDNSisnotsetupforthetargetserver,thecommandreturnsanemptystring.
2Addaserverbyrunningesxcli network ip dns server addandspecifyingtheserverIPv4address
orIPv6address.
esxcli <conn_options> network ip dns server add --server=<str>
3 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=mydomain.biz
4ToturnonDHCP,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
1DisplayDNSpropertiesforthespecifiedserverasfollows:
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
Getting Started with vSphere Command-Line Interfaces
130 VMware, Inc.
2IftheDNSpropertiesareset,andyouwanttochangetheDHCPsettings,youmustspecifythevirtual
networkadaptertousewhenoverridingthesystemDNS.OverridetheexistingDHCPsettingasfollows:
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
Thevicfg-dnscommandlistsandspecifiestheDNSconfigurationofyourESXihost.Callthecommand
withoutcommandspecificoptionstolisttheexistingDNSconfiguration.Youcanalsouseesxcli network
ip dnsforDNSmanagement.
InnetworkenvironmentswhereaDHCPserverandaDNSserverareavailable,ESXihostsareautomatically
assignedDNSnames.
InnetworkenvironmentswhereautomaticDNSisnotavailableornotdesirable,youcanconfigurestaticDNS
information,includingahostname,primarynameserver,secondarynameserver,andDNSsuffixes.
ThefollowingexampleillustratessettingupaDNSserver.Specifyoneoftheoptionslistedin“Connection
OptionsforvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
To set up DNS
1Runvicfg-dnswithoutcommandspecificoptionstodisplayDNSpropertiesforthespecifiedserver.
vicfg-dns <conn_options>
IfDNSisnotsetupforthetargetserver,thecommandreturnsanerror.
2Tochangethesettings,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 mydomain.biz
3ToturnonDHCP,usethe--DHCPoption.
vicfg-dns <conn_options> --dhcp yes
To modify DNS setup for a preconfigured server
1Runvicfg-dnswithoutcommandspecificoptionstodisplayDNSpropertiesforthespecifiedserver.
vicfg-dns <conn_options>
Theinformationincludesthehostname,domainname,DHCPsetting(trueorfalse),andDNSserverson
theESXihost.
2IftheDNSpropertiesareset,andyouwanttochangetheDHCPsettings,youmustspecifythevirtual
networkadaptertousewhenoverridingthesystemDNS.v_nicmustbeoneoftheVMkernelnetwork
adapters.
OverridetheexistingDHCPsettingasfollows:
vicfg-dns <conn_options> --dhcp yes --v_nic <vnic>
IMPORTANTIfyoutrytochangethehostordomainnameortheDNSserveronhoststhatuseDHCP,anerror
results.
VMware, Inc. 131
Chapter 9 Managing vSphere Networking
Adding and Starting an NTP Server
Someprotocols,suchasKerberos,musthaveaccurateinformationaboutthecurrenttime.Inthosecases,you
canaddanNTP(NetworkTimeProtocol)servertoyourESXihost.
ThefollowingexampleillustratessettingupanNTPserver.Specifyoneoftheoptionslistedin“Connection
OptionsforvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
To manage an NTP Server
1Runvicfg-ntp--add toaddanNTPservertothehostspecifiedin<conn_options>anduseahostname
orIPaddresstospecifyanalreadyrunningNTPserver.
vicfg-ntp <conn_options> -a 192.XXX.XXX.XX
2Runvicfg-ntp --starttostarttheservice.
vicfg-ntp <conn_options> --start
3Runvicfg-ntp --listtolisttheservice.
vicfg-ntp <conn_options> --list
4Runvicfg-ntp --stoptostoptheservice.
vicfg-ntp <conn_options> --stop
5Runvicfg-ntp --deletetoremovethespecifiedNTPserverfromthehostspecifiedin<conn_options>.
vicfg-ntp <conn_options> --delete 192.XXX.XXX.XX
Managing the IP Gateway
IfyoumoveyourESXihosttoanewphysicallocation,youmighthavetochangethedefaultIPgateway.You
canusethevicfg-routecommandtomanagethedefaultgatewayfortheVMkernelIPstack.vicfg-route
supportsasubsetoftheLinuxroutecommand’soptions.
Ifyourunvicfg-routewithnooptions,thecommanddisplaysthedefaultgateway.Use--familytoprint
thedefaultIPv4orthedefaultIPv6gateway.Bydefault,thecommanddisplaysthedefaultIPv4gateway.
Specifyoneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18
inplaceof<conn_options>.
To add, view, and delete a route entry
1AddarouteentrytotheVMkernelandmakeitthedefault.
ForIPv4networks,noadditionaloptionsarerequired.
vicfg-route <conn_options> --add <network_ip> <netmask_IP> <gateway_ip>
Forexample,toaddarouteto192.XXX.100.0through192.XXX.0.1:
vicfg-route <conn_options> -a 192.XXX.100.0/24 192.XXX.0.1
or
vicfg-route <conn_options> -a 192.XXX.100.0 255.255.255.0 192.XXX.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 2001:10:20:253::/64 2001:10:20:253::1
IMPORTANTNoESXCLIcommandexistsforaddingandstartinganNTPserver.
IMPORTANTNoESXCLIcommandexiststomanagethedefaultgateway.
Getting Started with vSphere Command-Line Interfaces
132 VMware, Inc.
2Listrouteentriestocheckthatyourroutewasaddedbyrunningthecommandwithoutoptions.
vicfg-route <conn_options>
Theoutputlistsallnetworksandcorrespondingnetmasksandgateways.
3Setthedefaultgateway.
ForIPv4,usethissyntax:
vicfg-route <conn_options> 192.XXX.0.1
or
vicfg-route <conn_options> -a default 192.XXX.0.1
ForIPv6,usethissyntax:
vicfg-route <conn_options> -f V6 -a default 2001:10:20:253::1
4Runvicfg-route --deletetodeletetheroute.Specifyfirstthegateway,andthenthenetwork.
vicfg-route <conn_options> -d 192.XXX.100.0/24 192.XXX.0.1
Setting Up IPsec
YoucansetInternetProtocolSecuritywithesxcli network ip ipseccommandsorwiththevicfg-ipsec
command.whichsecuresIPcommunicationscomingfromandarrivingatESXihosts.Administratorswho
performIPsecsetupmusthaveasolidunderstandingofbothIPv6and IPsec.
ESXihostssupportIPseconlyforIPv6traffic,butnotforIPv4traffic.
Youcannotrunvicfg-ipsecwithavCenterServersystemasthetarget(usingthe--vihostoption).
Youcanrunesxcli network ip ipseccommandswithavCenterServersystemasatarget(usingthe
--vihostoption).
TheVMwareimplementationofIPsecadherestothefollowingIPv6RFCs:
4301SecurityArchitecturefortheInternetProtocol
4303IPEncapsulatingSecurityPayload(ESP)
4835CryptographicAlgorithmImplementationRequirementsforESP
2410TheNULLEncryptionAlgorithmandItsUseWithIPsec
2451TheESPCBCModeCipherAlgorithms
3602TheAESCBCCipherAlgorithmandItsUsewithIPsec
2404TheUseofHMACSHA196withinESPandAH
4868UsingHMACSHA256,HMACSHA384,andHMACSHA512
Using IPsec with ESXi
WhenyousetupIPseconanESXihost,youenableprotectionofincomingoroutgoingdata.Whathappens
preciselydependsonhowyousetupthesystem’sSecurityAssociations(SAs)andSecurityPolicies (SPs).
AnSAdetermineshowthesystemprotectstraffic.WhenyoucreateanSA,youspecifythesourceand
destination,authentication,andencryptionparameters,andanidentifierfortheSAwiththefollowing
options.
IMPORTANTInESX/ESXi4.1,ESXi5.0,andESXi5.1,IPv6isbydefaultdisabled.YoucanturnonIPv6by
runningoneofthefollowingvCLIcommands:
esxcli <conn_options> network ip interface ipv6 set --enable-dhcpv6
esxcli <conn_options> network ip interface ipv6 address add
vicfg-vmknic <conn_options> --enable-ipv6
VMware, Inc. 133
Chapter 9 Managing vSphere Networking
AnSPidentifiesandselectstrafficthatmustbeprotected.AnSPconsistsoftwologicalsections,aselector,
andanaction.
Theselectorisspecifiedbythefollowingoptions.
Theactionisspecifiedbythefollowingoptions
BecauseIPsecallowsyoutotargetpreciselywhichtrafficshouldbeencrypted,itiswellsuitedforsecuring
yourvSphereenvironment.Forexample,youcansetuptheenvironmentsoallvMotiontrafficisencrypted.
Managing Security Associations
YoucanspecifyanSAandrequestthattheVMkernelusethatSA.ThefollowingoptionsforSAsetupare
supported.
vicfg-ipsec esxcli network ip ipsec
sa-srcandsa-dst --sa-sourceand--sa-destination
spi(securityparameterindex) --sa-spi
sa-mode(tunnelortransport) --sa-mode
ealgoandekey -encryption-algorithmand--encryption-key
ialgoandikey --integrity-algorithmand--integrity-key
vicfg-ipsec esxcli network ip ipsec
src-addrandsrc-port --sa-sourceand--source-port
dst-addranddst-port --destination-port
ulproto --upper-layer-protocol
direction(inorout)--flow-direction
vicfg-ipsec esxcli network ip ipsec
sa-name --sa-name
sp-name --sp-name
action (none, discard, ipsec --action
vicfg-ipsec Option esxcli Option Description
sa-src <source_IP> sa-source
<source_IP>
SourceIPfortheSA.
sa-dst
<destination_IP>
sa-destination
<destination_IP>
DestinationIPfortheSA.
spi sa-spi SecurityParameterIndex(SPI)fortheSA.Mustbeahexadecimal
numberwitha0xprefix.
WhenIPsecisinuse,ESXiusestheESPprotocol(RFC43030),
whichincludesauthenticationandencryptioninformationand
theSPI.TheSPIidentifiestheSAtouseatthereceivinghost.Each
SAyoucreatemusthaveauniquecombinationofsource,
destination,protocol,andSPI.
sa-mode [tunnel |
transport]
sa-mode [tunnel |
transport]
Eithertunnelortransport.
Intunnelmode,theoriginalpacketisencapsulatedinanother
IPv6packet,wheresourceanddestinationaddressesaretheSA
endpointaddresses.
ealgo [null |
3des-cbc |
aes128-cbc]
encryption-algorith
m [null | 3des-cbc |
aes128-cbc]
Encryptionalgorithmtobeused.Choose3des-cbcor
aes128-cbc,ornullfornoencryption.
Getting Started with vSphere Command-Line Interfaces
134 VMware, Inc.
YoucanperformthesemaintaskswithSAs:
CreateanSA.Youspecifythesource,thedestination,andtheauthenticationmode.Youalsospecifythe
authenticationalgorithmandauthenticationkeytouse.Youmustspecifyanencryptionalgorithmand
key,butyoucanspecifynullifyouwantnoencryption.Authenticationisrequiredandcannotbenull.
Thefollowingexampleincludesextralinebreaksforreadability.Thelastoption(sa_2intheexample)is
thenameoftheSA.
esxcli network ip ipsec sa add
--sa-source 2001:DB8:1::121
--sa-destination 2001:DB8:1::122
--sa-mode transport
--sa-spi 0x1000
--encryption-algorithm 3des-cbc
--encryption-key 0x6970763672656164796c6f676f336465736362636f757432
--integrity-algorithm hmac-sha1
--integrity-key 0x6970763672656164796c6f67736861316f757432
--sa-name sa_2
ListanSAwithesxcli network ip ipsec sa list.ThiscommandreturnsSAscurrentlyavailable
forusebyanSP.ThelistincludesSAsyoucreated.
RemoveasingleSAwithesxcli network ip ipsec sa remove.IftheSAisinusewhenyourunthis
command,thecommandcannotperformtheremoval.
RemoveallSAswithesxcli network ip ipsec sa remove--removeall.ThisoptionremovesallSAs
evenwhentheyareinuse.
Managing Security Policies
AfteryouhavecreatedoneormoreSAs,youcanaddsecuritypolicies(SPs)toyourESXihosts.WhiletheSA
specifiestheauthenticationandencryptionparameterstouse,theSPidentifiesandselectstraffic.
ThefollowingoptionsforSPmanagementaresupported.
ekey <key> encryption-key
<key>
Encryptionkeytobeusedbytheencryptionalgorithm.Aseries
ofhexadecimaldigitswitha0xprefixoranASCIIstring.
ialgo [hmac-sha1 |
hmac-sha2-256 ]
integrity-algorithm
[hmac-sha1 |
hmac-sha2-256 ]
Authenticationalgorithmtobeused.Choosehmac-sha1or
hmac-sha2-256.
ikey integrity-key Authenticationkeytobeused.Aseriesofhexadecimaldigitsor
anASCIIstring.
vicfg-ipsec Option esxcli Option Description
CAUTIONRunningesxcli network ip ipsec sa remove--removeallremovesallSAsonyour
systemandmightleaveyoursysteminaninconsistentstate.
vicfg-ipsec Option esxcli Option Description
sp-src <ip>/<p_len> sp-source
<ip>/<p_len>
SourceIPaddressandprefixlength.
sp-dst <ip>/<p_len> sp-destination
<ip>/<p_len>
DestinationIPaddressandprefixlength.
src-port <port> source-port <port> Sourceport(065535).Specifyanyforanyports.
dst-port <port> destination-port
<port>
Destinationport(065535).Specifyanyforanyports.If
ulprotoisicmp6,thisnumberreferstotheicmp6type.
Otherwise,thisnumberreferstotheport.
ulproto [any | tcp
| udp | icmp6]
upper-layer-protocol
[any | tcp | udp |
icmp6]
Upperlayerprotocol.UsethisoptiontorestricttheSPtoonly
certainprotocols,oruseanytoapplytheSPtoallprotocols.
VMware, Inc. 135
Chapter 9 Managing vSphere Networking
YoucanperformthesemaintaskswithSPs:
CreateanSPwithesxcli network ip ipsec add.Youidentifythedatatomonitorbyspecifyingthe
selectorssourceanddestinationIPaddressandprefix,sourceportanddestinationport,upperlayer
protocol,directionoftraffic,actiontotake,andSPmode.ThelasttwooptionarethenameoftheSAto
useandthenameoftheSPthatisbeingcreated.Thefollowingexampleincludesextralinebreaksfor
readability.
esxcli network ip ipsec add
--sp-source=2001:0DB8:0001:/48
--sp-destination=2001:0DB8:0002:/48
--source-port=23
--destination-port=25
--upper-layer-protocol=tcp
--flow-direction=out
--action=ipsec
--sp-mode=transport
--sp-name sp_2
ListanSPwithesxcli network ip ipsec list.ThiscommandreturnsSPscurrentlyavailable.All
SPsarecreatedbytheadministrator.
RemoveanSPwithesxcli network ip ipsecremove.IftheSPisinusewhenyourunthiscommand,
thecommandcannotperformtheremoval.Youcanrunesxcli network ip ipsecremove
--removeallinsteadtoremovetheSPevenwhenitisinuse.
Managing the ESXi Firewall
Tominimizetheriskofanattackthroughthemanagementinterface,ESXiincludesafirewallbetweenthe
managementinterfaceandthenetwork.Toensuretheintegrityofthehost,onlyasmallnumberoffirewall
portsareopenbydefault.ThevSphereSecuritydocumentationexplainshowtosetupfirewallsforyour
environmentandwhichportsyoumighthavetotemporarilyenableforcertaintraffic.
Youmanagefirewallsbysettingupfirewallrulesets.vSphereSecuritydocumentationexplainshowtoperform
thesetaskswiththevSphereWebClient.Youcanalsouseesxcli network firewalltomanagefirewall
rulesetsandtoretrieveinformationaboutthem.Specifyoneoftheoptionslistedin“ConnectionOptionsfor
vCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
To limit shell access
1CheckfirewallstatusandsshServerrulesetstatus.
esxcli <conn_options> network firewall get
Default Action: DROP
dir [in | out] flow-direction [in |
out]
Directioninwhichyouwanttomonitorthetraffic.Tomonitor
trafficinbothdirections,createtwopolicies.
action [none |
discard | ipsec]
action [none | discard
| ipsec]
Actiontotakewhentrafficwiththespecifiedparametersis
encountered.
none‐‐Takenoaction,thatis,allowtrafficunmodified.
discard‐‐Donotallowdatainorout.
ipsec‐‐Usetheauthenticationandencryptioninformation
specifiedintheSAtodeterminewhetherthedatacomefrom
atrustedsource.
sp-mode [tunnel |
transport]
sp-mode [tunnel |
transport]
Mode,eithertunnelortransport.
sa-name sa-name NameoftheSAtousebythisSP.
vicfg-ipsec Option esxcli Option Description
CAUTIONRunningesxcli network ip ipsecremove --removeallremovesallSPsonyoursystem
andmightleaveyoursysteminaninconsistentstate.
Getting Started with vSphere Command-Line Interfaces
136 VMware, Inc.
Enabled: true
Loaded: true
esxcli <conn_options> network firewall ruleset list --ruleset-id sshServer
Name Enabled
--------- -------
sshServer true
2EnablethesshServerrulesetifitisdisabled.
esxcli <conn_options> network firewall ruleset set --ruleset-id sshServer --enabled true
3 ObtainaccesstotheESXiShellandcheckthestatusoftheallowedAllflag.
esxcli <conn_options> network firewall ruleset allowedip list --ruleset-id sshServer
Ruleset Allowed IP Addresses
--------- --------------------
sshServer All
SeeGettingStartedwithvSphereCommandLineInterfacesforinformationonaccessingtheESXiShell.
4SetthestatusoftheallowedAllflagtofalse.
esxcli <conn_options> network firewall ruleset set --ruleset-id sshServer --allowed-all false
5AddthelistofallowedIPaddresses.
esxcli <conn_options> network firewall ruleset allowedip add --ruleset-id sshServer
--ip-address 192.XXX.1.0/24
esxcli <conn_options> network firewall ruleset allowedip add --ruleset-id sshServer
--ip-address 192.XXX.10.10
6ChecktheallowedIPaddresslist.
esxcli <conn_options> network firewall ruleset allowedip list --ruleset-id sshServer
Ruleset Allowed IP Addresses
--------- -----------------------------
sshServer 192.XXX.10.10, 192.XXX.1.0/24
Monitoring VXLAN
Theesxcli network vswithch dvs vmware vxlannamespacesupportscommandsforexploringVXLAN
configurationdetails.Foramoredetailedexampleofthisfunctionality,seetheVMwarevSphereblogpost
aboutthetopic.
1ListallavailableVXLANvNetworkDistributedSwitches.
esxcli network vswitch dvs vmware vxlan list
2ViewtheVXLANstatisticslevel.
esxcli network vswitch dvs vmware vxlan config stats get
3 Changethestatisticslevel,forexample,from0to1.
esxcli network vswitch dvs vmware vxlan config stats set --level 1
Youcandecidetofilterstatisticsasfollows:
ForavNetworkDistributedSwitch,localizedtoanESXihost
ForaVTEPVMkernelinterface
ForaVXLANsegmentID
ForavNetworkDistributedSwitchportID
4ViewstatisticsforaspecificvNetworkDistributedSwitch.
esxcli network vswitch dvs vmware vxlan config stats list --vds-name Cluster01-VXLAN-VDS
5ViewstatisticsforaVXLANsegmentID.
ListtheavailablesegmentIDs
esxcli network vswitch dvs vmware vxlan network list -vds-name Cluster01-VXLAN-VDS
VMware, Inc. 137
Chapter 9 Managing vSphere Networking
RunthefollowingcommandtoviewthenetworkstatisticsforaparticularsegmentID
esxcli network vswitch dvs vmware vxlan network stats list --vds-name Cluster01-VXLAN-VDS
--vxlan-id 5000
Retrievenatworkmappinifsomevirtualmachinecommunicationisoccurring.
esxcli network vswitch dvs vmware vxlan network mapping list --vds-name Cluster01-VXLAN-VDS
--vxlan-id 5000
6ViewVXLANstatisticsforaVDSPortID.
esxcli network vswitch dvs vmware vxlan network port list --vds-name Cluster01-VXLAN-VDS
--vxlan-id 5000
7ViewthenetworkstatisticsforaspecificVDSPortID.
esxcli network vswitch dvs vmware vxlan network port list --vds-name Cluster01-VXLAN-VDS
--vxlan-id 5000 vdsport-is 968
Getting Started with vSphere Command-Line Interfaces
138 VMware, Inc.
VMware, Inc. 139
10
StartingwiththevSphere4.0release,thevCenterServermakesperformancechartsforCPU,memory,diskI/O,
networking,andstorageavailable.YoucanviewtheseperformancechartsbyusingthevSphereWebClient
andreadabouttheminthevSphereMonitoringdocumentation.Youcanalsoperformsomemonitoringofyour
ESXisystemusingvCLIcommands.
Thischapterincludesthesetopics:
“UsingresxtopforPerformanceMonitoring”onpage 139
“ManagingDiagnosticPartitionsonpage 139
“ManagingCoreDumps”onpage 140
“ConfiguringESXiSyslogServices”onpage 142
“ManagingESXiSNMPAgents”onpage 143
“RetrievingHardwareInformation”onpage 146
Using resxtop for Performance Monitoring
TheresxtopvCLIcommandallowsyoutoexaminehowESXisystemsuseresources.Youcanusethe
commandininteractivemode(default)orinbatchmode.TheResourceManagementdocumentationexplains
howtouseresxtopandprovidesinformationaboutavailablecommandsanddisplaystatistics.
IfyoucannotreachthehostwiththeresxtopvCLIcommand,youmightbeabletousetheesxtopcommand
intheESXiShellinstead.SeeGettingStartedwithvSphereCommandLineInterfacesforinformationonaccessing
theshell.
Managing Diagnostic Partitions
Yourhostmusthaveadiagnosticpartition(dumppartition)tostorecoredumpsfordebuggingandforuseby
VMwaretechnicalsupport.
AdiagnosticpartitionisonthelocaldiskwheretheESXisoftwareisinstalledbydefault.Youcanalsousea
diagnosticpartitiononaremotedisksharedbetweenmultiplehosts.Ifyouwanttouseanetworkdiagnostic
partition,youcaninstallESXiDumpCollectorandconfigurethenetworkedpartition.See“ManagingCore
DumpswithESXiDumpCollectoronpage 141.
Thefollowingconsiderationsapply:
AdiagnosticpartitioncannotbelocatedonaniSCSILUNaccessedthroughthesoftwareiSCSIor
dependenthardwareiSCSIadapter.FormoreinformationaboutdiagnosticpartitionswithiSCSI,see
GeneralBootfromiSCSISANRecommendationsinthevSphereStoragedocumentation.
Astandalonehostmusthaveadiagnosticpartitionof110MB.
Monitoring ESXi Hosts 10
IMPORTANTresxtopandesxtoparesupportedonlyonLinux.
Getting Started with vSphere Command-Line Interfaces
140 VMware, Inc.
IfmultiplehostsshareadiagnosticpartitiononaSANLUN,configurealargediagnosticpartitionthat
thehostsshare.
Ifahostthatusesashareddiagnosticpartitionfails,rebootthehostandextractlogfilesimmediatelyafter
thefailure.Otherwise,thesecondhostthatfailsbeforeyoucollectthediagnosticdataofthefirsthost
mightnotbeabletosavethecoredump.
Diagnostic Partition Creation
YoucanusethevSphereWebClienttocreatethediagnosticpartitiononalocaldiskoronaprivateorshared
SANLUN.Youcannotusevicfg-dumpparttocreatethediagnosticpartition.TheSANLUNcanbesetup
withFibreChannelorhardwareiSCSI.SANLUNsaccessedthroughasoftwareiSCSIinitiatorarenot
supported.
Diagnostic Partition Management
Youcanusethevicfg-dumppartortheesxcli system coredumpcommandtoquery,set,andscananESXi
system’sdiagnosticpartitions.ThevSphereStoragedocumentationexplainshowtosetupdiagnosticpartitions
withthevSphereWebClientandhowtomanagediagnosticpartitionsonaFibreChannelorhardwareiSCSI
SAN.
Diagnosticpartitionscaninclude,inorderofsuitability,paralleladapter,blockadapter,FC,orhardwareiSCSI
partitions.ParalleladapterpartitionsaremostsuitableandhardwareiSCSIpartitionstheleastsuitable.
Managing Core Dumps
Withesxcli system coredump,youcanmanagelocaldiagnosticpartitionsorsetupcoredumponaremote
serverinconjunctionwithESXiDumpCollector.ForinformationaboutESXiDumpCollector,seethevSphere
Networkingdocumentation.
Managing Local Core Dumps with ESXCLI
ThefollowingexamplescenariochangesthelocaldiagnosticpartitionwithESXCLI.Specifyoneofthe
connectionoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplace
of<conn_options>.
To manage a local diagnostic partition
1ShowthediagnosticpartitiontheVMkernelusesanddisplayinformationaboutallpartitionsthatcanbe
usedasdiagnosticpartitions.
esxcli <conn_options> system coredump partition list
2 Deactivatethecurrentdiagnosticpartition.
esxcli <conn_options> system coredump partition set --unconfigure
TheESXisystemisnowwithoutadiagnosticpartition,andyoumustimmediatelysetanewone.
3Settheactivepartitiontonaa.<naa_ID>.
esxcli <conn_options> system coredump partition set --partition=naa.<naa_ID>
4Listpartitionsagaintoverifythatadiagnosticpartitionisset.
CAUTIONIftwohoststhatshareadiagnosticpartitionfailandsavecoredumpstothesameslot,thecore
dumpsmightbelost.
Ifahostthatusesashareddiagnosticpartitionfails,rebootthehostandextractlogfilesimmediatelyafterthe
failure.
IMPORTANTWhenyoulistdiagnosticpartitions,softwareiSCSIpartitionsareincluded.However,SANLUNs
accessedthroughasoftwareiSCSIinitiatorarenotsupportedasdiagnosticpartitions.
VMware, Inc. 141
Chapter 10 Monitoring ESXi Hosts
esxcli <conn_options> system coredump partition list
Ifadiagnosticpartitionisset,thecommanddisplaysinformationaboutit.Otherwise,thecommand
showsthatnopartitionisactivatedandconfigured.
Managing Core Dumps with ESXi Dump Collector
Bydefault,acoredumpissavedtothelocaldisk.YoucanuseESXiDumpCollectortokeepcoredumpsona
networkserverforuseduringdebugging.ESXiDumpCollectorisespeciallyusefulforAutoDeploy,but
supportedforanyESXi5.0andlaterhost.ESXiDumpCollectorsupportsothercustomization,including
sendingcoredumpstothelocaldisk.
ESXiDumpCollectorisincludedwiththevCenterServerautorun.exeapplication.YoucaninstallESXi
DumpCollectoronthesamesystemasthevCenterServerserviceoronadifferentWindowsorLinux
machine.SeevSphereNetworking.
YoucanconfigureESXihoststouseESXiDumpCollectorbyusingtheHostProfilesinterfaceofthevSphere
WebClient,orbyusingESXCLI.Specifyoneoftheconnectionoptionslistedin“ConnectionOptionsforvCLI
HostManagementCommands”onpage 18inplaceof<conn_options>.
To manage core dumps with ESXi Dump Collector
1SetupanESXisystemtouseESXiDumpCollectorbyrunningesxcli system coredump.
esxcli <conn_options> system coredump network set --interface-name vmk0
--server-ipv4=1-XX.XXX --port=6500
YoumustspecifyaVMkernelportwith--interface-name,andtheIPaddressandportoftheserverto
sendthecoredumpsto.IfyouconfigureanESXisystemthatisrunninginsideavirtualmachine,you
mustchooseaVMkernelportthatisinpromiscuousmode.
2EnableESXiDumpCollector.
esxcli <conn_options> system coredump network set --enable=true
3 (Optional)CheckthatESXiDumpCollectorisconfiguredcorrectly.
esxcli <conn_options> system coredump network get
ThehostonwhichyouhavesetupESXiDumpCollectorsendscoredumpstothespecifiedserverbyusing
thespecifiedVMkernelNICandoptionalport.
Managing Core Dumps with vicfg-dumppart
Thefollowingexamplescenariochangesthediagnosticpartition.Specifyoneoftheconnectionoptionslisted
in“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplaceof<conn_options>.
To manage a diagnostic partition
1ShowthediagnosticpartitiontheVMkerneluses.
vicfg-dumppart <conn_options> -t
2Displayinformationaboutallpartitionsthatcanbeusedasdiagnosticpartitions.Use-ltolistall
diagnosticpartitions,-ftolistalldiagnosticpartitionsinorderofpriority.
vicfg-dumppart <conn_options> -f
Theoutputmightappearasfollows.
Partition name on vml.mpx.vmhba36:C0:T0:L0:7 -> mpx.vmhba36:C0:T0:L0:7
3 Deactivatethediagnosticpartition.
vicfg-dumppart <conn_options> -d
TheESXisystemisnowwithoutadiagnosticpartition,andyoumustimmediatelysetanewone.
4Settheactivepartitiontonaa.<naa_ID>.
vicfg-dumppart <conn_options> -s naa.<naa_ID>
Getting Started with vSphere Command-Line Interfaces
142 VMware, Inc.
5Runvicfg-dumppart -tagaintoverifythatadiagnosticpartitionisset.
vicfg-dumppart <conn_options> -t
Ifadiagnosticpartitionisset,thecommanddisplaysinformationaboutit.Otherwise,thecommand
informsyouthatnopartitionisset.
Configuring ESXi Syslog Services
AllESXihostsrunaSyslogservice,whichlogsmessagesfromtheVMkernelandothersystemcomponentsto
localfilesortoaremotehost.YoucanusethevSphereWebClient,orusetheesxcli system syslog
commandtoconfigurethefollowingparametersofthesyslogservice.
Remotehostandport.RemotehosttowhichSyslogmessagesareforwardedandportonwhichthe
remotehostreceivesSyslogmessages.Theremotehostmusthavealoglistenerserviceinstalledand
correctlyconfiguredtoreceivetheforwardedsyslogmessages.Seethedocumentationforthesyslog
serviceinstalledontheremotehostforinformationonconfiguration.
Transportprotocol.LogscanbesentbyusingUDP(default),TCPorSSLtransports.
Localloggingdirectory.Directorywherelocalcopiesofthelogsarestored.Thedirectorycanbelocated
onmountedNFSorVMFSvolumes.Onlythe/scratchdirectoryonthelocalfilesystemispersistent
acrossreboots.
Uniquedirectorynameprefix.SettingthisoptiontotruecreatesasubdirectorywiththenameoftheESXi
hostunderthespecifiedloggingdirectory.ThismethodisespeciallyusefulifthesameNFSdirectoryis
usedbymultipleESXihosts.
Logrotationpolicies.Setsmaximumlogsizeandthenumberofarchivestokeep.Youcanspecifypolicies
bothglobally,andforindividualsubloggers.Forexample,youcansetalargersizelimitforthevmkernel
log.
Aftermakingconfigurationchanges,restartthesyslogservice(vmsyslogd)byrunningesxcli system
syslog reload.
Theesxcli system syslogcommandallowsyoutoconfiguretheloggingbehaviorofyourESXisystem.
WithvSphere5.0,youcanmanagethetoplevelloggerandsubloggers.Thecommandhasthefollowing
options.
IMPORTANTTheesxcli system syslogcommandistheonlysupportedcommandforchangingESXi5.0
andlaterloggingconfiguration.Thevicfg-syslogcommandandeditingconfigurationfilesisnotsupported
forESXi5.0andcanresultinerrors.
Option Description
mark Marksalllogswiththespecifiedstring.
reload Reloadstheconfiguration,andupdatesanychangedconfigurationvalues.
config get Retrievesthecurrentconfiguration.
config set Setstheconfiguration.Useoneofthefollowingoptions.
--logdir=<path>Savelogstoagivenpath.
--loghost=<host>Sendlogstoagivenhost.See“esxclisystemsyslogExamples”on
page 143.
--logdir-unique=<true|false>Specifywhetherthelogshouldgotoaunique
subdirectoryofthedirectoryspecifiedinlogdir.
--default-rotate=<int>Defaultnumberoflogrotationstokeep.
--default-size=<int>Sizebeforerotatinglogs,inKB.
VMware, Inc. 143
Chapter 10 Monitoring ESXi Hosts
esxcli system syslog Examples
Thefollowingworkflowillustrateshowyoumightuseesxcli system syslogforlogconfiguration.Specify
oneoftheoptionslistedin“ConnectionOptionsforvCLIHostManagementCommands”onpage 18inplace
of<conn_options>.
1Showconfigurationoptions.
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>
2Setalllogstokeeptwentyrotationsbeforeoverwritingtheoldestlog.
esxcli <conn_options> system syslog config set --default-rotate=20
3SettherotationpolicyforVMkernellogsto10rotations,rotatingat2MB.
esxcli <conn_options> system syslog config logger --id=vmkernel --size=2048 --rotate=10
4Sendlogstoremotehostmyhost.mycompany.com.Thelogswillusethedefaulttransport(UDP)andport
(514).
esxcli system syslog config set --loghost='myhost.mycompany.com'
5 Savethelocalcopyoflogsto/scratch/mylogsandsendanothercopytotheremotehost.
esxcli <conn_options> system syslog config set --loghost='tcp://myhost.mycompany.com:1514'
--logdir='/scratch/mylogs'
Yousetthedirectoryontheremotehostbyconfiguringtheclientrunningonthathost.Youcanusethe
vSphereWebClienttoredirectsystemlogstoaremotehostbychangingtheSystem.global.logHost
advancedsetting.
6Sendalogmessagetoalllogssimultaneously.
esxcli <conn_options> system syslog mark --message="this is a message!"
7Reloadthesyslogdaemonandapplyconfigurationchanges.
esxcli <conn_options> system syslog reload
Managing ESXi SNMP Agents
SimpleNetworkManagementProtocol(SNMP)allowsmanagementprogramstomonitorandcontrol
networkeddevices.YoucanmanagevSphere5.0SNMPagentswithvicfg-snmpcommandsdiscussedhere.
vCenterServerandESXisystemsincludedifferentSNMPagents.
config logger list Showcurrentlyconfiguredsubloggers.
config logger set Setconfigurationoptionsforaspecificsublogger.Useoneofthefollowingoptions.
--id=<str>IDoftheloggertoconfigure(required).
--reset=<str>Resetvaluestodefault.
--rotate=<long>Numberofrotatedlogstokeepforaspecificlogger(requires--id).
--size=<long>Sizeoflogsbeforerotationforaspecificlogger,inKB(requires--id).
Option Description
IMPORTANTSignificantenhancementstoSNMP,includingsupportforSNMPv3,areincludedinESXi5.1.The
newfunctionalityismanagedthroughESXCLIcommands.SeethevSphereMonitoringandPerformance
documentationthatisavailableinthevSphere5.1DocumentationCenter.
Getting Started with vSphere Command-Line Interfaces
144 VMware, Inc.
vCenterServerSNMPagent.TheSNMPagentincludedwithvCenterServercansendtrapswhenthe
vCenterServersystemisstartedorwhenanalarmistriggeredonvCenterServer.ThevCenterServer
SNMPagentfunctionsonlyasatrapemitteranddoesnotsupportotherSNMPoperations(forexample,
GET).
YoucanmanagethevCenterServeragentwiththevSphereWebClientbutnotwiththevCLIcommand.
HostbasedembeddedSNMPagent.ESXi4.0andlaterincludesanSNMPagentembeddedinthehost
daemon(hostd)thatcansendtrapsandreceivepollingrequestssuchasGETrequests.
YoucanmanageSNMPonESXihostswiththevicfg-snmpvCLIcommand,butnotwiththevSphere
ClientorwiththeESXCLIcommand.
NetSNMPbasedagent.VersionsofESXreleasedbeforeESX/ESXi4.0includeaNetSNMPbasedagent.
YoucancontinuetousethisNetSNMPbasedagentinESX4.xwithMIBssuppliedbyyourhardware
vendorandotherthirdpartymanagementapplications.However,tousetheVMwareMIBfiles,youmust
usethehostbasedembeddedSNMPagent.
TousetheNETSNMPbasedagentandhostbasedembeddedSNMPagentatthesametime,makeoneofthe
agentslistenonanondefaultport.Bydefault,bothagentsusethesameport.
ThehostbasedembeddedSNMPagentisdisabledbydefault.Configuringandenablingtheagentrequires
thatyouperformthefollowingtasks:
1ConfigureSNMPCommunities.See“ConfiguringSNMPCommunities”onpage 144.
2ConfiguretheSNMPAgent.Youhavethefollowingchoices:
“ConfiguringtheSNMPAgenttoSendTrapsonpage 144
“ConfiguringtheSNMPAgentforPolling”onpage 145
Configuring SNMP Communities
BeforeyouenabletheESXiembeddedSNMPagent,youmustconfigureatleastonecommunityfortheagent.
AnSNMPcommunitydefinesagroupofdevicesandmanagementsystems.Onlydevicesandmanagement
systemsthataremembersofthesamecommunitycanexchangeSNMPmessages.Adeviceormanagement
systemcanbeamemberofmultiplecommunities.
ToconfigureSNMPcommunities,runesxcli system snmp setorvicfg-snmp -c,specifyinga
commaseparatedlistofcommunities.Forexample:
esxcli system snmp set -c public, internal
vicfg-snmp <conn_options> -c public, internal
Eachtimeyouspecifyacommunitywiththiscommand,thesettingsthatyouspecifyoverwritetheprevious
configuration.
Configuring the SNMP Agent to Send Traps
YoucanusetheSNMPagentembeddedinESXitosendvirtualmachineandenvironmentaltrapsto
managementsystems.Toconfiguretheagenttosendtraps,youmustspecifyatarget(receiver)address,the
community,andanoptionalport.Ifyoudonotspecifyaport,theSNMPagentsendstrapstoUDPport162
onthetargetmanagementsystembydefault.
Configuring a Trap Destination with ESXCLI
1Makesureacommunityissetup.
esxcli system snmp get <conn_options>
Current SNMP agent settings:
Enabled: 1
UDP port: 161
Communities: public
Notification targets:
VMware, Inc. 145
Chapter 10 Monitoring ESXi Hosts
2Setthetargetaddress,portnumber,andcommunity.
esxcli <conn_options> system snmp set -t target.example.com@163/public
Eachtimeyouspecifyatargetwiththiscommand,thesettingsyouspecifyoverwriteallpreviously
specifiedsettings.Tospecifymultipletargets,separatethemwithacomma.
YoucanchangetheportthattheSNMPagentsendsdatatoonthetargetusingthe--targetsoption.
ThatportisUDP162bydefault.
3 (Optional)EnabletheSNMPagentifitisnotyetrunning.
esxcli <conn_options> system snmp set --enable=yes
4 (Optional)Sendatesttraptoverifythattheagentisconfiguredcorrectly.
esxcli <conn_options> system snmp test
TheagentsendsawarmStarttraptotheconfiguredtarget.
Configuring a Trap Destination with vicfg-snmp
1Makesureacommunityissetup.
vicfg-snmp <conn_options> --show
Current SNMP agent settings:
Enabled: 1
UDP port: 161
Communities: public
Notification targets:
2Runvicfg-snmp --targetwiththetargetaddress,portnumber,andcommunity.
vicfg-snmp <conn_options> -t target.example.com@163/public
Eachtimeyouspecifyatargetwiththiscommand,thesettingsyouspecifyoverwriteallpreviously
specifiedsettings.Tospecifymultipletargets,separatethemwithacomma.
YoucanchangetheportthattheSNMPagentsendsdatatoonthetargetusingthe--targetsoption.
ThatportisUDP162bydefault.
3 (Optional)EnabletheSNMPagentifitisnotyetrunning.
vicfg-snmp <conn_options> --enable
4 (Optional)Sendatesttraptoverifythattheagentisconfiguredcorrectly.
vicfg-snmp <conn_options> --test
TheagentsendsawarmStarttraptotheconfiguredtarget.
Configuring the SNMP Agent for Polling
IfyouconfiguretheESXiembeddedSNMPagentforpolling,itcanlistenforandrespondtorequestssuchas
GETrequestsfromSNMPmanagementclientsystems.
Bydefault,theembeddedSNMPagentlistensonUDPport161forpollingrequestsfrommanagement
systems.Youcanusethevicfg-snmpcommandtoconfigureanalternativeport.Toavoidconflictswithother
services,useaUDPportthatisnotdefinedin/etc/services.
Configuring the SNMP Agent for Polling with ESXCLI
1Runvicfg-snmp --targetwiththetargetaddress,portnumber,andcommunity.
vicfg-snmp <conn_options> -c public -t target.example.com@163/public
IMPORTANTBoththeembeddedSNMPagentandtheNetSNMPbasedagentavailableintheESX4.xservice
consolelistenonUDPport161bydefault.IfyouareusinganESX4.xsystem,changetheportforoneagent
toenablebothagentsforpolling.
Getting Started with vSphere Command-Line Interfaces
146 VMware, Inc.
Eachtimeyouspecifyatargetwiththiscommand,thesettingsyouspecifyoverwriteallpreviously
specifiedsettings.Tospecifymultipletargets,separatethemwithacomma.
YoucanchangetheportthattheSNMPagentsendsdatatoonthetargetbyusingthe--targetsoption.
ThatportisUDP162bydefault.
2 (Optional)Specifyaportforlisteningforpollingrequests.
vicfg-snmp <conn_options> -p <port>
3 (Optional)IftheSNMPagentisnotenabled,enableit.
vicfg-snmp <conn_options> --enable
4Runvicfg-snmp --testtovalidatetheconfiguration.
Thefollowingexampleshowshowthecommandsareruninsequence.
vicfg-snmp <conn_options> –c public –t example.com@162/private --enable
# next validate your config by doing these things:
vicfg-snmp <conn_options> -–test
walk –v1 –c public esx-host
Configuring the SNMP Agent for Polling with vicfg-snmp
1Runvicfg-snmp --targetwiththetargetaddress,portnumber,andcommunity.
vicfg-snmp <conn_options> -c public -t target.example.com@163/public
Eachtimeyouspecifyatargetwiththiscommand,thesettingsyouspecifyoverwriteallpreviously
specifiedsettings.Tospecifymultipletargets,separatethemwithacomma.
YoucanchangetheportthattheSNMPagentsendsdatatoonthetargetbyusingthe--targetsoption.
ThatportisUDP162bydefault.
2 (Optional)Specifyaportforlisteningforpollingrequests.
vicfg-snmp <conn_options> -p <port>
3 (Optional)IftheSNMPagentisnotenabled,enableit.
vicfg-snmp <conn_options> --enable
4Runvicfg-snmp --testtovalidatetheconfiguration.
Thefollowingexampleshowshowthecommandsareruninsequence.
vicfg-snmp <conn_options> –c public –t example.com@162/private --enable
# next validate your config by doing these things:
vicfg-snmp <conn_options> -–test
walk –v1 –c public esx-host
Retrieving Hardware Information
CommandsindifferentESXCLInamespacesmightdisplaysomehardwareinformation,buttheesxcli
hardwarenamespaceisspecificallyintendedtogiveyouthatinformation.Thenamespaceincludes
commandsforgettingandsettingCPUproperties,forlistingbootdevices,andforgettingandsettingthe
hardwareclocktime.
YoucanalsousetheipminamespacetoretrieveIPMIsystemeventlogs(SEL)andsensordatarecords(SDR).
Thecommandsupportsbothget(singlereturnvalue)andlist(multiplereturnvalues)commandsandreturns
rawsensorinformation.
SeethevCLIReferenceortheESXCLIonlinehelpfordetails.
VMware, Inc. 147
Index
Numerics
3.5 LUN masks 97
A
Active Directory 25, 26
active path 47
ARP redirect 76
authentication
algorithm (IPsec) 134
default inheritance 63
key (IPsec) 134
returning to default inheritance 63
AUTOCONF 127
B
backing up configuration data 24
C
CDP 118, 119, 120
Challenge Handshake Authentication Protocol 62
changing IP gateway 131
CHAP 62
chapDiscouraged 62
chapPreferred 62
chapProhibited 62
chapRequired 62
Cisco Discovery Protocol 118
claim rules
adding 95
converting 97
deleting 98
from 3.5 systems 97
from LUN mask 97
listing 98
loading 98
moving 98
rule IDs 96
running 99
commands with esxcfg prefix 12
configuration data
backing up 24
restoring 24
configuration files, path 57
copying files 33
core dumps 140
ESXi Dump Collector 141
local 140
managing 141
creating directories 33
D
datastores
mounting 30
NFS 50
overview 39
default gateway 132
default inheritance 63, 80, 81
default port groups 118
dependent hardware iSCSI 59, 70, 75
device management 44, 87
device mappings 41, 42
DHCP 129, 130
DHCPV6 127
diagnostic partitions
creating 140
example 140, 141
managing 139
directory management 35
directory names with special characters 33
discovery sessions 60
discovery targets 61
disk file path 57
distributed switches 113, 114, 115, 117
DNS 128, 129, 130
downloading files 33
duplicate datastores 29
dynamic discovery 60
E
encryption algorithm (IPsec) 133
encryption key (IPsec) 134
esxcfg prefix 12
esxcli network ip commands 125
esxcli network ip dns 129
esxcli network nic commands 123
esxcli network vswitch commands 118, 120, 124
esxcli storag
nfs commands 51
esxcli storage core
claiming commands 93
claimrule commands 95
claimrule convert commands 97
Getting Started with vSphere Command-Line Interfaces
148 VMware, Inc.
claimrule delete command 98
claimrule list command 98
claimrule load command 98
claimrule move command 98
claimrule run command 99
device list 41
esxcli storage core adapter rescan 58
esxcli storage core claiming
reclaim command 94
unclaim command 94
esxcli storage core path 45, 47
esxcli storage nmp 87
device list command 88
device set command 88
fixed deviceconfig commands 89
path list command 88
psp commands 88, 89
psp roundrobin commands 90
roundrobin 50, 90
satp commands 91
esxcli system coredump 140
ESXi Dump Collector 139, 141
EUI name 45, 46, 61
examples
backup with vMA 24
configure VMkernel NIC for IPv4 125
configure VMkernel NIC for IPv6 126
DNS setup 129
enable and set NetQueue modules 25
entering maintenance mode 22, 23
iSCSI storage setup 68, 70, 73, 75
managing users 103
route entry setup 131
svmotion 57
uplink adapter setup 122
external HBA properties 78
F
failover 44
FC LUNs 39
Fibre Channel LUNs 39
file management
introduction 27
vifs 28, 35
file path, configuration file 57
file systems
NAS 51
VMFS 29
fixed path selection policy 89
G
gateway, IP 131
groups 101, 104
H
hard power operations 110
hardware iSCSI setup tasks 72, 76
HBA mappings 42
HBA properties 78
hosts
managing 21
shutdown or reboot 21
I
ifconfig, ESXCLI equivalents 115
independent hardware iSCSI
definition 59
setup tasks 72, 76
inheritance 81
IP gateway 131
IP storage 114
IPsec 132
IPv4 125, 126
IPv6 126, 127
IQN name 61
iSCSI
authentication 63, 82, 83
default inheritance 80, 81
dependent hardware iSCSI 70, 75
discovery target names 61
independent hardware iSCSI 72, 76
LUNs 39
mutual authentication 82, 83
options 77
overview 59
parameters 79, 80
parameters, returning to default inheritance 80,
81
port binding 70, 75
ports for multipathing 83
remove sessions 85
securing ports 62
security 61
sessions 84, 85
setup examples 68, 70, 73, 75
K
Kerberos 131
L
license 56
listing IP gateway 131
loading claim rules 98
lockdown mode 19
logical devices, listing 42
LUN masks, convert to claim rule 97
LUNs
VMware, Inc. 149
Index
names 45, 46
overview 40
M
MAC address, VMkernel NIC 125
MagicPacket 123
maintenance mode 22, 23
Managing 44, 59, 122
managing 140
managing local core dumps 140
managing NMP 87
managing paths 44
managing physical network interfaces 122
migrating virtual machines,svmotion 55
mount datastores 30
MTU 119, 120
multipathing 44, 45
mutual authentication 82, 83
mutual CHAP 69, 71, 74, 76, 82, 83
N
naa.xxx device name 45, 46
NAS datastores, datastores, NAS 50
NAS file systems 51
NetQueue VMkernel modules 25
network adapters
duplex value 122
managing 122
speed 122
network interfaces 117, 122
networking
vDS 128
vSS 117
NFS datastores 50
NFS, capabilities 51
NMP 44, 87
NTP server 131
O
offload iSCSI 59
orphaned virtual machine 106
P
parameters
default inheritance (iSCSI) 81
setting (iSCSI) 80
partitions, diagnostic 140
path change conditions for round robin 91
path claiming 93
path operations 88
path policies 47, 89, 90
path state, changing 46
paths
active 47
changing state 46
disabling 47
listing 46
listing with ESXCLI 45
managing 44
preferred 49, 50, 89
performance monitoring 139
physical network interfaces 122
platform support 14
Pluggable Storage Architecture 44
port binding 70, 75, 84
port groups 114, 121, 122
adding 120
and uplink adapter 121
default 118
removing 120
ports, iSCSI multipathing 83
power operations 110
powerop_mode 110
preferred path 49, 50, 89
PSA 44
acronym 87
managing claim rules 95
PSP
acronym 87
information 89
operations 88
R
raw devices 39
rebooting hosts 21
register virtual machines 107
removing snapshots 109
rescanning adapters 58
rescanning storage 39, 58
rescanning storage adapters 58
resignature VMFS copy 31
restoring configuration data 24
resxtop 13, 139
reverting snapshots 109
RFCs (vicfg-ipsec) 132
roles 101
round robin
operations 50, 90
path change conditions 91
retrieve settings 90
route entry setup 131
rule IDs 96
rules 92
claim rules 95
SATP rules 92
Getting Started with vSphere Command-Line Interfaces
150 VMware, Inc.
S
SATP
configuration parameters 93
deleting rules 92
retrieve settings 91
rules, adding 91
securing iSCSI ports 62
security associations (IPsec) 133
security policies (IPsec) 134
sessions, iSCSI 85
Simple Network Management Protocol 143
snapshots 108, 109
SNMP
communities 144
management 143
polling 145
traps 144
soft power operations 110
software iSCSI setup tasks 68, 70, 73, 75
spaces in directory names 33
special characters
in directories 33
vicfg-iscsi 79, 81
standard networking services 128
starting NTP server 131
state of path, changing 46
static discovery 60
stopping virtual machines 111
storage
creating directories with vifs 33
overview 37
path claiming 93
rescanning 39, 58
virtual machines 38
storage array target 40
storage device naming 39
supported platforms 14
svmotion 55
interactive Mode 56
license for storage vMotion 56
limitations 56
noninteractive mode 56
requirements 56
special characters 56
switch attributes 119, 120
syslog server specification 142
T
TCP Segmentation Offload 125
TCP/IP 72, 76, 114
transport mode 133
TSO 125
tunnel mode 133
U
unregister virtual machines 107
uplink adapters 114, 122
and port groups 121
setup 124
useANO (round robin) 50
user input 111
users
creating 103
in vSphere environment 101
modifying 103
V
VDS 113
vicfg-authconfig 25
vicfg-cfgbackup 23, 24
vicfg-dumppart 140, 141
vicfg-hostops 21, 22
vicfg-ipsec 133, 134
vicfg-iscsi
command syntax 63
default inheritance for authentication 63
default inheritance for parameters 80, 81
iscsi parameter options 81
vicfg-module 24
vicfg-mpath 46
vicfg-nas 50, 52
vicfg-nics 124
vicfg-ntp 131
vicfg-rescan 58, 75
vicfg-scsidevs
3.5 support 42
list options 42
vicfg-snmp 143
vicfg-syslog 142
vicfg-user 101, 102, 104
vicfg-vmknic 125
vicfg-volume 29
vicfg-vswitch 117, 120
vifs 28, 32
virtual devices 110
virtual machine configuration file path 57
virtual machines
attributes 107
file management 27
listing 106, 107
managing 107
migration with svmotion 55
network settings 115
orphaned 106
path 106
VMware, Inc. 151
Index
registering 106, 107
starting 109
stopping 111
storage VMotion 56
vmware-cmd 107
virtual switches 113, 117, 118
MTU 119, 120
retrieving information 118
vicfg-vswitch 117
VLAN ID 121, 122
VMFS
duplicate datastores 29
resignature copy 30
resignaturing 31
VMFS3 to VMFS5 conversion 29
VMkernel modules 24
VMkernel network interfaces 125
VMkernel NIC 125
enable VMotion 127
IPv4 125, 126
IPv6 126, 127
VMkernel NICs 125
vmkfstools 28
VML LUN names 45, 46
VMotion 114, 127
VMW_PSP_FIXED 48
VMW_PSP_MRU 48
VMW_PSP_RR 48
vmware-cmd
connection options 106
general options 106
server options 106
snapshots 108
virtual machine options 107
VMware Tools 110
vSphere distributed switches 115, 128
VSS 113
W
Windows Active Directory 26
Getting Started with vSphere Command-Line Interfaces
152 VMware, Inc.

Navigation menu