In this tutorial, we will show how to configure your Ubuntu iSCSI target for multi-path IO for your initiators.
This guide assumes you have completed our knowledge base tutorial “Setup iSCSI Storage Server on Ubuntu 20.04 LTS” or already have iSCSI configured.
By default when you create an iSCSI target in targetcli, it will map its portals to all IP addresses on the server. This is not ideal for proper multi-path configuration, so this guide will remove the default configuration and set it up properly.
Configuring your iSCSI target to be used on multiple portals is done from the iSCSI server however configuring multi-path policies is done clientside.
First, we must configure our multiple iSCSI interfaces to prepare for multi-path.
Select which network interfaces you wish to use for iSCSI, and then configure their static IP addresses.
Note: For best practices, each iSCSI interface should have an IP address on a separate subnet to ensure there is no cross-talk between pathing.
For the purposes of this guide, we will use the 10.10.2.0/24 subnet for iSCSI path 1, and 10.10.3.0/24 for iSCSI path 2. There is typically no need to add a default gateway to these interfaces since it is not normally recommended to route iSCSI traffic to avoid added latency.
Once you have the interfaces selected, set a static IP on each of them with the nmtui tool.
Run the command “nmtui” from your terminal as a root user or with elevated sudo privliges.
Next, select the first interface you want to use for iSCSI and set the static IP. ensure to check off “Automatically connect” if it is not already.
Next, repeat this step with the second interface.
Bring these interfaces up and ensure they can be pinged from the client machine prior to continuing to make sure the networks are behaving normally.
Next, go back into the targetcli tool you used to configure iSCSI initially. Notice that by default when you create your IQN, iSCSI sets the portals to 0.0.0.0:3260. This pushes iSCSI out all available interfaces. We will want to remove this default configuration, and only add the static paths we have created specifically for iSCSI.
type “cd” and press enter. This will give you a the ability to use your arrow keys to move into any level of the directory tree you want. Move down to “portals” and press enter.
Next, we will remove the default portal.
/iscsi/iqn.20.../tpg1/portals> delete 0.0.0.0 3260 Deleted network portal 0.0.0.0:3260 /iscsi/iqn.20.../tpg1/portals>
Next, add the iSCSI interfaces one at a time. We are using 2 paths here, but it is possible to use more.
/iscsi/iqn.20…/tpg1/portals> create 10.10.2.75 3260
Using default IP port 3260
Created network portal 10.10.2.75:3260.
/iscsi/iqn.20…/tpg1/portals> create 10.10.3.75 3260
Using default IP port 3260
Created network portal 10.10.3.75:3260.
Your iSCSI paths are now configured to be used in a proper MPIO configuration.
The way in which multi-path is configured (most recently used,round-robin etc) will depend on the client. For ESXi, once you configure iSCSI to communicate on the same networks, you can use dynamic discovery, using only one of the IP addresses involved, and ESXi will find the others. Once the LUN is found in ESXi, you can select the multi-pathing policy under “Storage devices” and then selecting the LUN and going to properties. From here, you can choose multipathing properties.
Once you select edit multipathing, use the drop-down menu to choose which policy you’d like to use.
If the LUN’s are not showing up after attempting discovery, first SSH into your ESXi node and attempt to ping the iSCSI portal IP addresses to ensure the nodes are able to communicate.