Step_By_Step_GUIDE To Configure ISCSI Target and Initiator on RHEL07
1: set hostname
hostnamectl set-hostname iscsihost.example.local
2: Install packages.
On Target:
Package: targetcli
Provides the targetcli shell to configure LIO (Linux I/O Target), the in-kernel iSCSI target framework
yum install targetcli
On Initiator:
yum install iscsi-initiator-utils
Provides iscsiadm, iscsid, and related tools to discover and log in to iSCSI targets.
3: Enter targetcli shell.
targetcli
ls
It will show:
BLOCK = Block-device based LUN Storage Space like Disk e.g. /dev/sdb.
FILEIO = File based LUN Storage Space like file created with dd command.
PSCSI = (SCSI Pass-through) Physical Disk based LUN Storage Space like CD-ROM.
RamDisk= Ramdisk based LUN Storage Space for higher IO speed
4: Create a Backstore.
/backstores/block create backstore01 /dev/sdb
ls
5: Create ISCI Target
/iscsi create
This will :
• Creates a new iSCSI target node under /iscsi
• Assigns it a unique IQN (iSCSI Qualified Name)
• Initializes a TPG (Target Portal Group) called tpg1
• Prepares the structure where you’ll later:
• Add LUNs
• Configure ACLs
• Set portals (IP + port)
• Enable authentication
A TPG is a container inside an iSCSI target that defines how initiators connect to the target.
6: Exposes a real disk (block device) to iSCSI clients by attaching it as a LUN under the target.
/iscsi/iqn.2003-01.org.linux-iscsi.server.x8664:sn.89b50c23d34a/tpg1/luns create /backstores/block/backstore
ls
7: Allows a specific iSCSI initiator to access your target.
Go to Client & Copy IQN Number with cp /etc/iscsi/initiatorname.iscsi & return to Host**
Client End:
1: Login ESXI hOST
2: Go to Storage
3: Adopters
4: vmhba65
5: iscsi configure
6: Name and alias -- copy iqn
Host Terminal: where you left before moving to client terminal:
/iscsi/iqn.2003-01.org.linux-iscsi.server.x8664:sn.89b50c23d34a/tpg1/acls create iqn.1994-05.com.redhat:3e9d906e8
ls
exit
8: If firewalld is enabled, add port 3260/tcp to firewall rules.
sudo firewall-cmd --permanent --add-port=3260/tcp
sudo firewall-cmd --reload
----
ESXI Host End:
1: Login ESXI hOST
2: Go to Storage
3: Adopters
4: vmhba65
5: iscsi configure
6: Add port Binding -- use vmk that have IP of same range as Target
7: add Dynamic target -- put Target Ip --save -- rescan
8: to create a datastore: Data store -- create datastore -- create new vmfs data store -- select drive -- chose full or custome size and Finish.
-----------------------------------------------------------------------------------------------------
GitHub: https://github.com/muhammadshaban89/S...
LinkdIn: www.linkedin.com/in/muhammad-shaban-45577719a