Home Linux & Systems Cybersecurity Cloud & DevOps Networks & Infrastructure SIEM & Monitoring DFIR & Threat Intel Development & Other All categories Projects About Tools

How to configure and use iSCSI Target in GNU/Linux

Leer en espanol
How to configure and use iSCSI Target in GNU/Linux

Table of contents

iSCSI (Internet SCSI) is a standard that allows the use of the SCSI protocol over TCP/IP networks. iSCSI is a transport layer protocol defined in the specifications ===

What is iSCSI?

iSCSI (Abbreviation for SCSI Internet) is a standard that allows the use of protocol SCSI about networks TCP/IP. iSCSI is a transport layer protocol defined in the SCSI-3 specifications. Other protocols at the transport layer are SCSI Parallel Interface and fiber channel.

The adoption of iSCSI in corporate production environments has currently accelerated thanks to the increase in Gigabit Ethernet. The manufacturing of iSCSI-based storage (red de área de almacenamiento) is less expensive and is proving to be an alternative to Fiber Channel-based SAN solutions.

we install the software iSCSI initiator.

Redhat or derivatives:

Bash
yum install iscsi-initiator-utils

Debian or derivatives:

text
aptitude install open-iscsi

We establish node.startup  in automatic mode

Bash
[root@redorbitaclus01 ~]# vi /etc/iscsi/iscsid.conf
[…]

node.startup = automatic

[…]

using the command iscsiadm we use iSCSI discovery

Bash
[root@redorbitaclus01 ~]# iscsiadm -m discovery -t st -p 192.168.1.20:3261

192.168.1.20:3261,3 iqn.2011-03.org.example.istgt:redorbitaclus

[root@redorbitaclus01 ~]# iscsiadm -m discovery

192.168.1.20:3260 via sendtargets

192.168.1.20:3261 via sendtargets

If we want to know what information was stored about the discovered target, we have to operate in node mode

Bash
[root@redorbitaclus01 ~]# iscsiadm -m node –targetname iqn.2011-03.org.example.istgt:redorbitaclus -p 192.168.1.20:3261

We proceed to log in to an iSCSI target

Bash
[root@redorbitaclus01 ~]# iscsiadm -m node –targetname «iqn.2011-03.org.example.istgt:redorbitaclus» –portal «192.168.1.20:3261» –login

Logging in to [iface: default, target: iqn.2011-03.org.example.istgt:redorbitaclus, portal: 192.168.1.20,3261] (multiple)

Login to [iface: default, target: iqn.2011-03.org.example.istgt:redorbitaclus, portal: 192.168.1.20,3261] successful.

We check the sessions

Bash
[root@redorbitaclus01 ~] iscsiadm -m session -o show

tcp: [2] 192.168.1.20:3261,-1 iqn.2011-03.org.example.istgt:clustomcat
[root@redorbitaclus01 ~] netstat -n -p|grep 3260

tcp        0      0 192.168.1.80:39147      192.168.1.20:3261       ESTABLISHED 1929/iscsid

We format and mount the disk.

We check that we have a new device added

Bash
[root@redorbitaclus01 ~]  dmesg
[ 2189.095341] sd 3:0:0:0: Attached scsi generic sg2 type 0

[ 2189.102983] sd 3:0:0:0: [sdb] 55924032 512-byte logical blocks: (28.6 GB/26.6 GiB)

[ 2189.113045] sd 3:0:0:0: [sdb] Write Protect is off

[ 2189.113051] sd 3:0:0:0: [sdb] Mode Sense: 83 00 00 08

[ 2189.113939] sd 3:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn’t support DPO or FUA

[ 2189.129843] sdb: sdb1

[ 2189.137121] sd 3:0:0:0: [sdb] Attached SCSI disk

We format and mount the disk:

Bash
[root@redorbitaclus01 ~]  mkfs.ext4 /dev/sdb
[root@redorbitaclus01 ~]  mount /dev/sdb1  /backup

We configure fstab to start the disk:

text
/dev/sdb1 /backup ext4    defaults        0       2

Finally we configure so that ISCSI starts automatically

Redhat or derivatives:

text
chkconfig iscsi on

Debian or derivatives:

sql
update-rc.dopen-iscsi enable

Regards, rokitoh
:wq!

Comments