In VMware vSphere, you can use an iSCSI disk as a shared datastore for your ESXi hosts. An ESXi host accesses iSCSI storage over your local network using the TCP protocol. In this article, we’ll look at how to add an iSCSI LUN to a VMWare ESXi host and create a shared VMFS datastore on it.
Suppose you have already created, configured, and published an iSCSI target (disk) on your storage device (array). Also, you can use a virtual disk (VHDX) hosted on Windows Server as an iSCSI target.
In this example, we are using a standalone host running VMware ESXi 6.7 (you can also use the free ESXi Hypervisor). This can be a physical host or a virtual machine (here is an example of running ESXi in a Hyper-V VM). There are two network interfaces in the host (the first is for management and the second is for the iSCSI traffic).
Configure Network for iSCSI Traffic on VMWare ESXi
Open the web interface to manage your ESXi host (
First of all, create a separate VMkernel network interface that will be used by the ESXi host to access the iSCSI storage. Open Networking -> VMkernel NICs -> Add VMkernel NIC.
Besides the vmk port, create a new port group (New port group). Specify the group name (iSCSI) and assign a static IP address for your vmkernel interface.
Then open the settings of your default vSwitch0 (Networking -> Virtual Switches). Make sure that the second physical interface (vmnic1) of your host has been added to the configuration and is active (otherwise, click Add uplink to add it).
In the NIC Teaming section, make sure that both physical interfaces are Active.
Then in the iSCSI port group settings, you need to allow only the second interface to be used for iSCSI traffic. Go to Networking -> Port groups -> iSCSI —> Edit settings. Expand the NIC teaming section and select Override failover order = Yes. Leave vmnic1 active and set Unused for the vmnic0 port.
As a result, your ESXi host will use only one network interface to access your iSCSI LUN.
Configuring iSCSI Software on VMWare ESXi
The iSCSI software adapter is disabled by default in ESXi. To enable it, open Storage -> Adapters. Click Software iSCSi.
Change iSCSI enable to Enabled.
Then add the IP address of your iSCSI storage and the connection port (by default, the TCP Port
3260 is used for the iSCSI traffic) in the Dynamic targets section. ESXi will scan all iSCSI targets on the storage and display them in the Static Targets list.
Save the settings. Note that a new iSCSI Software Adapter HBA
vmhba65 appeared in the Storage -> Adapters tab.
If you don’t see the list of iSCSI targets in your storage, you can diagnose iSCSI disk availability using the ESXi console.
Enable SSH on your ESXi host and connect to it using any SSH client (I use the built-in Windows 10 SSH client):
Using the command below, you can check the availability of your iSCSI storage (192.168.113.10) from the specified vmkernel port (vmk1):
# vmkping -I vmk1 192.168.113.10
In this example, the iSCSI storage responds to ping.
Then check if the iSCSI TCP Port 3260 is available on the storage using netcat (in this example, 192.168.113.60 is the IP address of the vmk1 interface):
# nc -s 192.168.113.60 -z 192.168.113.10 3260
Connection to 192.168.113.10 3260 port [tcp/*] succeeded!
Make sure that the software iSCSI is enabled on your ESXi host:
# esxcli iscsi software get
Enable it if needed:
# esxcli iscsi software set -e true
Software iSCSI Enabled
You can also get the current settings of a software iSCSI HBA adapter as follows:
# esxcli iscsi adapter get -A vmhba65
vmhba65 Name: iqn.1998-01.com.vmware:srv-esx1-1234abcd Alias: Vendor: VMware Model: iSCSI Software Adapter Description: iSCSI Software Adapter Serial Number: Hardware Version: Asic Version: Firmware Version: Option Rom Version: Driver Name: iscsi_vmk Driver Version: TCP Protocol Supported: false Bidirectional Transfers Supported: false Maximum Cdb Length: 64 Can Be NIC: false Is NIC: false Is Initiator: true Is Target: false Using TCP Offload Engine: false Using ISCSI Offload Engine: false
Create a VMFS Datastore on iSCSI LUN in VMWare ESXi
Then you can create a VMFS (Virtual Machine File System) datastore to store virtual machine files on the connected iSCSI LUN.
Open Storage -> Datastores -> New datastore.
Enter the name of your VMFS datastore and select the iSCSI LUN to create it.
Select VMFS 6 as a file system and specify that you want to entire the volume of the iSCSI disk for the datastore. In a few seconds, your new VMFS datastore will be available on ESXi.
So, you have connected the iSCSI disk to your ESXi host and created a VMFS datastore on it. Multiple ESXi servers can simultaneously access this datastore. Now you have shared storage, and if you configure a VMware vCenter server, you will be able to use vMotion to move running VMs between hosts.