Set Up Independent Hardware iSCSI with ESXCLI

With independent hardware-based iSCSI storage, you use a specialized third-party adapter capable of accessing iSCSI storage over TCP/IP. This iSCSI initiator handles all iSCSI and network processing and management for your
system.
You must install and configure the independent hardware iSCSI adapter for your host before you can access the iSCSI storage device. For installation information, see vendor documentation.
Hardware iSCSI setup requires a number of high-level tasks. You should be familiar with the corresponding command for each task. You can refer to the relevant documentation for each command or run
esxcli iscsi --help
in the console. Specify one of the options listed in Connection Options for vCLI Host Management Commands in place of
<conn_options>
.
  1. Determine the iSCSI adapter type and retrieve the iSCSI adapter ID.
    esxcli <conn_options> iscsi adapter list
  2. Configure the hardware initiator (HBA) by running
    esxcli iscsi networkportal ipconfig
    with one or more of the following options.
    Option
    Description
    -A|--adapter=<str>
    iSCSI adapter name (required)
    -1|--dns1=<str>
    iSCSI network portal primary DNS address
    -2|--dns2=<str>
    iSCSI network portal secondary DNS address
    -g|--gateway=<str>
    iSCSI network portal gateway address
    -i|--ip=<str>
    iSCSI network portal IP address (required)
    -n|--nic=<str>
    iSCSI network portal (vmknic)
    -s|--subnet=<str>
    iSCSI network portal subnet mask (required)
  3. Set the iSCSI name and alias.
    esxcli <conn_options> iscsi adapter set --adapter <adapter_name> --name=<name> esxcli <conn_options> iscsi adapter set --adapter <adapter_name> --alias=<alias>
  4. Add a dynamic discovery address or a static discovery address.
    • With dynamic discovery, all storage targets associated with a host name or IP address are discovered. You can run the following command.
      esxcli <conn_options> iscsi adapter discovery sendtarget add --address=<ip/dns[:port]> --adapter=<adapter_name>
    • With static discovery, you must specify the host name or IP address and the iSCSI name of the storage target. You can run the following command.
      esxcli <conn_options> iscsi adapter discovery statictarget add --address=<ip/dns[:port]> --adapter=<adapter_name> --name=<target_name>
  5. Set the authentication information for CHAP.
    You can set per-target CHAP for static targets, per-adapter CHAP, or apply the command to the discovery address.
    Option
    Command
    Adapter-level CHAP
    esxcli iscsi adapter auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=[prohibited, discouraged, preferred, required] --secret=<string> --adapter=<vmhba>
    Discovery-level 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>
    Target-level 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>
    The following example sets adapter-level CHAP.
    esxcli <conn_options> iscsi adapter auth chap set --direction=uni --chap_username=<name> --chap_password=<pwd> --level=preferred --secret=uni_secret --adapter=vmhba33
    Mutual CHAP is not supported for independent hardware iSCSI storage.
  6. Set iSCSI parameters.
    Option
    Command
    Adapter-level CHAP
    esxcli iscsi adapter param set --adapter=<vmhba> --key=<key> --value=<value>
    Discovery-level CHAP
    esxcli iscsi adapter discovery sendtarget param set --adapter=<vmhba> --key=<key> --value=<value> --address=<sendtarget_address>
    Target-level CHAP
    esxcli iscsi adapter target portal param set --adapter=<vmhba> --key=<key> --value=<value> --address=<address> --name=<iqn.name>
  7. After setup is complete, run
    esxcli storage core adapter rescan --adapter=<iscsi_adapter>
    to rescan all storage devices.
  8. After setup is complete, perform rediscovery and rescan all storage devices.
    The following example performs the rediscovery and rescan operations.
    esxcli <conn_options> iscsi adapter discovery rediscover esxcli <conn_options> storage core adapter rescan --adapter=vmhba36