iSCSI (Internet SCSI) Target and Initiator Configuration
iSCSI (Internet SCSI) , stands for internet small computer interface. It is a network protocol and it allows you to use the SCSI protocol over TCP/IP networks.
In iSCSI initiator is typically implemented in software, and functions similar to a hardware iSCSI HBA to access targets from a remote storage server. Using a software-based ISCSI initiator requires connecting to an existing Ethernet network of sufficient bandwidth to carry the expected storage traffic. Configuring an iSCSI client initiator requires installing the ISCSI-initiator-utils package, which includes the iscsi and iscsid services and the /etc/iscsi/iscsid.conf and /etc/iscsi/initiatorname.iscsi configuration files. The /etc/iscsi.conf file contains default settings for node records created during new target discovery.
In original SCSI protocol vice terminology, a target is a single connectable storage or output device uniquely identified on a SCSI bus. In iSCSI, in which the SCSCI bus is emulated across an IP network, a target can be a dedicated physical device in a network-attached storage enclosure or an iSCSI software-configured logical device to a networked storage server. A target, like HBAs and initiators, is an end point in SCSI bus communication, passing command descriptor blocks (CDB) to request or provide storage transactions. To provide access to the storage or output device, a target is configured with one or more logical unit numbers(LUNs). In iSCSI, LUNS appear as the target’s sequentially numbered disk drives, although targets typically have only one LUN. An initiator performs SCSI negotiation with a target to establish a connection to the LUN. The LUN responds as an emulated SCSI disk block device, which can be used in raw form or formatted with a client-supported file system. iscsi provides for LUN masking by using ACLs. This ensure that only a designated client node can login to a specific target. On the target server, ACL can be set at the TPG level to secure groups of LUNS, or set individually per LUN.
iSCSI Target Configuration
On the server, which is going to act as a iSCSI target, create a volume group with a 200MB logical volume to use for iSCSI as its resource:
# vgcreate myvg /dev/sdb
# lvcreate –name mylv –size 200M myvg
# yum install targetcli
#systemctl start target
#firewall-cmd –permanet –add-port=3260/tcp
Execute targetcli command to configure iSCSI target:
1) configure the existing /dev/myvg/mylv logical volume as a block-type backing store. Use the name block1 for the backstore.
/> /backstores/block/ create block1 /dev/myvg/mylv
2) Create a unique iSCSI Qualified Name (IQN) for the target will be iqn.2016-06.com.example:block1
/> /iscsi create iqn.2016-06.com.example:block1
Creating the IQ name automatically created a default target portal group named tpg1
3) Create an ACL for the client node (initiator), The initiator will be connecting with its initiator name set to iqn.2016-06.com.example:block1
/> /iscsi/iqn2016-06.com.example:block1/tpg1/acls/ <space>
4)Create a LUN under the target, the LUN should use the previously defined backing storage device named block1
5) Configure a portal for the target to listen on <IP>,port 3260
/> /iscsi/iqn.2016-06.com.example:block1/tpg1/portals create <IP>
6) Exit and save the configuration.
iSCSI Initiator Configuration
1) Install the iSCSI-initiator-utils RPM
# yum install -y iscsi-initiator-utils
2) Create a unique iSCSI Qualified Name for the client initiator by modifying the Initiator Name setting in /etc/iSCSI/initiatorname.iSCSI
[root@pc~] # vi /etc/iSCSI/initiatorname.iSCSI
InitiatorName=iqn.2016-06.com.example.com:block1(specify the same name as we set in the target)
3) Enable and start the iSCSI client service.
[root@pc~]# systemctl enable iSCSI; systemctl start iSCSI
4) Discover and log into the configured target from the iSCSI target server.
Discover the configured iSCSI target(s) provided by the iSCSI target server portal.
[root@pc~] #iSCSiadm -m discovery -t st -p <IP>
5) Log into the presented iSCSI target
[root@pc~]# iSCSIadm -m node -T iqn.2016-06.com.example:block1 -p <IP> –login
6) Identify the newly available block device created by the iSCSI target login.
[root@pc~]# iSCSIadm -m node -T iqn.2016-06.com.example:(servername) [-p target_server[:port]] -1
7) Create a filesystem:
8) Create a mount point and get UUID:
# blkid /dev/sda
/dev/sda: UUID=”6a1c44d0-3e2f-49fc-85ba-ced3e44bb5b0″ TYPE=”ext4″
“UUID=6a1c44d0-3e2f-49fc-85ba-ced3e44bb5b0 /mnt/block ext4 _netdev 00 ” to /etc/fstab
# mount /mnt/block
If you need any further assistance please contact our support department.