iSCSI (Internet Small Computer Systems Interface) allows you to share block storage devices over a standard TCP/IP network, making it a cost-effective alternative to dedicated Fibre Channel SANs. On RHEL 8, the targetcli package provides a powerful interactive shell for configuring iSCSI targets, while iscsi-initiator-utils handles the client side. This tutorial walks through setting up a complete iSCSI storage solution from target server to initiator client. By the end, your client will see the iSCSI disk as a local block device and mount it persistently via /etc/fstab.
Prerequisites
- Two RHEL 8 servers: one acting as the iSCSI target (storage server) and one as the initiator (client)
- A dedicated block device or partition on the target server (e.g.,
/dev/sdb) - Both servers registered with Red Hat Subscription Manager or configured with a local repository
- Root or sudo access on both systems
- Network connectivity between target and initiator on port 3260/TCP
Step 1 — Install and Start targetcli on the Target Server
Install the targetcli package, which provides the Linux SCSI Target Framework (LIO) management interface, then enable and start the service.
dnf install -y targetcli
systemctl enable --now target
systemctl status target
Step 2 — Configure the iSCSI Target Using targetcli
Enter the targetcli interactive shell and create a backstore, an iSCSI IQN, a LUN, and an ACL to restrict access to your initiator. Replace /dev/sdb with your actual block device and adjust the IQN values to match your environment. The initiator IQN must match the value set in /etc/iscsi/initiatorname.iscsi on the client.
targetcli
# Inside the targetcli shell:
/backstores/block create name=disk1 dev=/dev/sdb
/iscsi create iqn.2024-01.com.example:target1
/iscsi/iqn.2024-01.com.example:target1/tpg1/luns create /backstores/block/disk1
/iscsi/iqn.2024-01.com.example:target1/tpg1/acls create iqn.2024-01.com.example:initiator1
exit
Step 3 — Open the Firewall on the Target Server
iSCSI uses TCP port 3260. Use firewall-cmd to permanently allow this traffic and reload the firewall rules.
firewall-cmd --permanent --add-port=3260/tcp
firewall-cmd --reload
firewall-cmd --list-ports
Step 4 — Install iscsi-initiator-utils and Set the Initiator IQN on the Client
On the initiator (client) server, install the iSCSI initiator utilities and configure the initiator IQN to match the ACL entry you created on the target. Restart the service to apply the new IQN.
dnf install -y iscsi-initiator-utils
# Edit the initiator IQN file:
vi /etc/iscsi/initiatorname.iscsi
# Set: InitiatorName=iqn.2024-01.com.example:initiator1
systemctl enable --now iscsid
systemctl restart iscsid
Step 5 — Discover and Log In to the iSCSI Target
Use iscsiadm to perform a SendTargets discovery against the target server IP, then log in to the discovered target. Once logged in, the iSCSI disk appears as a new block device visible via lsblk.
# Replace 192.168.1.100 with your target server's IP address
iscsiadm --mode discovery --type sendtargets --portal 192.168.1.100
iscsiadm --mode node --targetname iqn.2024-01.com.example:target1 --portal 192.168.1.100 --login
lsblk
Step 6 — Format, Mount, and Add to /etc/fstab
Create a filesystem on the new iSCSI block device, mount it, and add it to /etc/fstab for persistent mounting at boot. The _netdev mount option is critical — it tells the system to wait for the network before attempting to mount the device.
# The iSCSI disk typically appears as /dev/sdc or similar — verify with lsblk
mkfs.xfs /dev/sdc
mkdir -p /mnt/iscsi
mount /dev/sdc /mnt/iscsi
df -h /mnt/iscsi
# Add to /etc/fstab for persistent mount:
echo '/dev/sdc /mnt/iscsi xfs defaults,_netdev 0 0' >> /etc/fstab
# Verify fstab entry mounts correctly:
umount /mnt/iscsi
mount -a
df -h /mnt/iscsi
Conclusion
You have successfully configured an iSCSI target on one RHEL 8 server using targetcli and connected to it from a second server acting as the initiator. The storage is now accessible as a standard block device, formatted with XFS, and mounted persistently at boot using the _netdev option to ensure the network is ready before the mount is attempted. This setup provides centralized block storage that can be shared with additional initiators by adding their IQNs to the ACL.
Next steps: How to Configure Multipath I/O (MPIO) for iSCSI on RHEL 8, How to Encrypt iSCSI Traffic with IPsec on RHEL 8, and How to Set Up NFS Storage on RHEL 8.