In this section, we will go through the configuration of the ISCSI target server on a RHEL host. ISCSI is an Internet Protocol that allows multiple servers and users to access network drives remotely over a TCP/IP network by setting up a shared storage network.
As part of this assignment, I’ve connected 4 disks (/dev/sdb-sde) to my ISCSI target server as shown and we will attach these disks to our servers sys01 and sys02 which will form a Veritas Storage Foundation cluster in subsequent chapters.
Installing iSCSI Target
Open the terminal and use the yum command to search for the package name “targetcli” to add, monitor, and remove iSCSI storage interconnects.
Install the targetcli
tool
Start and enable the target service on boot time.
Open port 3260
in the firewall and reload the firewall configuration
View the targetcli
layout using the below command
List using the following command
Workflow for creating an iSCSI target
To configure an iSCSI target, we will need the following details
- iSCSI target with a unique iQN.
- iSCSI Backstore – is a storage object that defines the resources that the backstore uses.
- Create iSCSI Portal.
- Set up iSCSI LUN.
- Creating an iSCSI ACL
- Setup CHAP Authentication if required/
Navigate to the iSCSI directory and run the create command to create an IQN
Create a block storage object
Block devices include physical devices like HDDs etc from where we can create LVM or RAID volumes. Navigate to the block of the backstores directory
Create an iSCSI LUN of each of our block devices attached
Creating an iSCSI portal
By default, the iSCSI portal is set to listen to all IP addresses with the default port number which is: 0.0.0.0:3260. Navigate to /tpg1/portals to delete the default portal
1 |
Then create the new portal and specify the IP address to enable the target. |
Configure iSCSI Initiator on RHEL 9
ISCSI Initiator is installed on the client machine to send data to the target. The below package is required to install the ISCSI initiator.
Start and enable the target service on boot time. We will need this info to be added to our ISCSI target server.
Access Control Lists are used to configure access rules that each initiator has access to LUNs. Navigate to our iSCSI target and then to the ACL directory and create an ACL using the initiator name we found in /etc/iscsi/initiatorname.iscsi
Discover the target by using the target’s IP address using the below command we should get a response from our target ISCSI and we can see all our devices attached.
1 2 |
<span class="line"><span style="color: #F6F6F4">[root@lnx01 </span><span style="color: #F286C4">~</span><span style="color: #F6F6F4">]# iscsiadm </span><span style="color: #F286C4">-</span><span style="color: #F6F6F4">m discovery </span><span style="color: #F286C4">-</span><span style="color: #F6F6F4">t st </span><span style="color: #F286C4">-</span><span style="color: #F6F6F4">p </span><span style="color: #BF9EEE">192.168</span><span style="color: #F6F6F4">.</span><span style="color: #BF9EEE">0.17</span></span> <span class="line"><span style="color: #BF9EEE">192.168</span><span style="color: #F6F6F4">.</span><span style="color: #BF9EEE">0.17</span><span style="color: #F6F6F4">:</span><span style="color: #BF9EEE">3260</span><span style="color: #F6F6F4">,</span><span style="color: #BF9EEE">1</span><span style="color: #F6F6F4"> iqn.</span><span style="color: #BF9EEE">2003</span><span style="color: #F286C4">-</span><span style="color: #BF9EEE">01</span><span style="color: #F6F6F4">.org.linux</span><span style="color: #F286C4">-</span><span style="color: #F6F6F4">iscsi.satellite.x8664:sn.02e62e692903</span></span> |
Log in to the ISCSI target
Show disks attached
1 |
<span class="line"><span style="color: #F6F6F4">sudo grep </span><span style="color: #DEE492">"</span><span style="color: #E7EE98">Attached SCSI</span><span style="color: #DEE492">"</span><span style="color: #F6F6F4"> </span><span style="color: #F286C4">/var</span><span style="color: #F6F6F4">/log/messages</span></span> |
Create a filesystem on our disks attached.
Mount the file system
To make the file persistent on boot add an entry to fstab file
Verify the disk has been mounted.
That’s about it to configure a simple ISCSI target server for our lab.