Configure iSCSI. target - centos 7

Configure Storage Server with iSCSI.
A storage on a network is called iSCSI Target, a Client which connects to iSCSI Target is called iSCSI Initiator.
This example is based on the environment below.
+----------------------+          |          +----------------------+
| [   iSCSI Target   ] |10.0.0.30 | 10.0.0.31| [ iSCSI Initiator  ] |
|   dlp.server.world   +----------+----------+   www.server.world   |
|                      |                     |                      |
+----------------------+                     +----------------------+


[1]Install admin tools first.

[root@dlp ~]#
yum -y install targetcli

[2]Configure iSCSI Target.
For example, create an disk-image under the /iscsi_disks directory and set it as a SCSI device.



# create the directory

[root@dlp ~]#
mkdir /iscsi_disks
# enter the admin console

[root@dlp ~]#
targetcli

targetcli shell version 2.1.fb34
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/>
cd backstores/fileio
# create a disk-image with the name "disk01" on /iscsi_disks/disk01.img with 20G

/backstores/fileio>
create disk01 /iscsi_disks/disk01.img 20G

Created fileio disk01 with size 21474836480
/backstores/fileio>
cd /iscsi
# create a target

/iscsi>
create iqn.2014-07.world.server:storage.target00

Created target iqn.2014-07.world.server:storage.target00.
Created TPG 1.
/iscsi>
cd iqn.2014-07.world.server:storage.target00/tpg1/portals
# set IP address of the target

/iscsi/iqn.20.../tpg1/portals>
create 10.0.0.30

Using default IP port 3260
Created network portal 10.0.0.30:3260.
/iscsi/iqn.20.../tpg1/portals>
cd ../luns
# set LUN

/iscsi/iqn.20...t00/tpg1/luns>
create /backstores/fileio/disk01

Created LUN 0.
/iscsi/iqn.20...t00/tpg1/luns>
cd ../acls
# set ACL (it's the IQN of an initiator you permit to connect)

/iscsi/iqn.20...t00/tpg1/acls>
create iqn.2014-07.world.server:www.server.world

Created Node ACL for iqn.2014-07.world.server:www.server.world
Created mapped LUN 0.
/iscsi/iqn.20...t00/tpg1/acls>
cd iqn.2014-07.world.server:www.server.world
# set UserID for authentication

/iscsi/iqn.20....server.world>
set auth userid=username

Parameter userid is now 'username'.
/iscsi/iqn.20....server.world>
set auth password=password

Parameter password is now 'password'.
/iscsi/iqn.20....server.world>
exit

Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
# after configuration above, the target enters in listening like follows.

[root@dlp ~]#
netstat -lnp | grep 3260

tcp        0      0 10.0.0.30:3260          0.0.0.0:*               LISTEN      -

Comentarios