Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Internet Small Computer Systems Interface ( iSCSI )
04-06-2018, 12:41 PM (This post was last modified: 04-10-2018 08:23 PM by rayluk.)
Post: #1
Internet Small Computer Systems Interface ( iSCSI )
iSCSI provides block-level access to storage devices by carrying SCSI commands over a TCP/IP network. This can provide an illusion of attached SCSI disk to the server.

On CentOs 7, to export iSCSI:
S1) install scsi-target-utils
S2) configure /etc/tgt/targets.conf ( example: http://tab.d-thinker.org/showthread.php?...http://tab.d-thinker.org/showthread.php?tid=11144&pid=6959 )

On CentOs 7, to mount iSCSI
S1) install iscsi-initiator-utils
S2) run `iscsiadm -m discovery -t sendtargets -p $ip:$port` ( example: http://tab.d-thinker.org/showthread.php?...http://tab.d-thinker.org/showthread.php?tid=11144&pid=6959 )
Find all posts by this user
Quote this message in a reply
04-10-2018, 05:01 PM (This post was last modified: 04-10-2018 07:56 PM by rayluk.)
Post: #2
RE: Internet Small Computer Systems Interface ( iSCSI )
packages in CentOS
scsi-target-utils:For providing a iSCSI target
iscsi-initiator-utils:For mounting a iCSCI target to local machine
Find all posts by this user
Quote this message in a reply
04-10-2018, 08:16 PM (This post was last modified: 04-10-2018 08:16 PM by rayluk.)
Post: #3
RE: Internet Small Computer Systems Interface ( iSCSI )
To export a block device.

Add the following line to /etc/tgt/targets.conf on iSCSI server. Then run `systemctl restart tgtd`
Code:
<target iqn.2018-10.c3.tetra:t1>
  backing-store /dev/rbd4
</target>
Find all posts by this user
Quote this message in a reply
04-10-2018, 08:21 PM (This post was last modified: 04-10-2018 08:21 PM by rayluk.)
Post: #4
RE: Internet Small Computer Systems Interface ( iSCSI )
To mount a iSCSI block, run the following line
Code:
iscsiadm -m discovery -t sendtargets -p 10.6.1.20:3260

The block will be added as /dev/sd*
Code:
[root@tetrali-2 ~]# parted /dev/sda print free
Model: IET VIRTUAL-DISK (scsi)
Disk /dev/sda: 10.5GB
Sector size (logical/physical): 512B/512B
Partition Table: loop
Disk Flags:

Number  Start  End     Size    File system  Flags
1      0.00B  10.5GB  10.5GB  ext4

dmesg
Code:
[32001.527483] Loading iSCSI transport class v2.0-870.
[32043.879421] iscsi: registered transport (tcp)
[32226.823793] scsi host0: iSCSI Initiator over TCP/IP
[32226.831455] scsi 0:0:0:0: RAID              IET      Controller       0001 PQ: 0 ANSI: 5
[32226.833364] scsi 0:0:0:1: Direct-Access     IET      VIRTUAL-DISK     0001 PQ: 0 ANSI: 5
[32226.843557] scsi 0:0:0:0: Attached scsi generic sg0 type 12
[32226.843606] scsi 0:0:0:1: Attached scsi generic sg1 type 0
[32226.905644] sd 0:0:0:1: [sda] 20480000 512-byte logical blocks: (10.5 GB/9.77 GiB)
[32226.905852] sd 0:0:0:1: [sda] Write Protect is off
[32226.905857] sd 0:0:0:1: [sda] Mode Sense: 69 00 10 08
[32226.906495] sd 0:0:0:1: [sda] Write cache: enabled, read cache: enabled, supports DPO and FUA
[32226.914403] sd 0:0:0:1: [sda] Attached SCSI disk
[32342.492010] EXT4-fs (sda): mounted filesystem with ordered data mode. Opts: (null)
Find all posts by this user
Quote this message in a reply
04-11-2018, 06:11 PM
Post: #5
RE: Internet Small Computer Systems Interface ( iSCSI )
iSCSI need some setting when working through an NAT.

" - When an iSCSI discovery connection is to be used through a port
redirector, a target will have to be configured to return a domain
name instead of an IP address in a SendTargets response, since the
port redirector will not be able to map the IP address(es)
returned in the iSCSI message. It is a good practice to do this
anyway.
"
Ref: http://www.faqs.org/rfcs/rfc3721.html
Find all posts by this user
Quote this message in a reply
04-11-2018, 07:30 PM (This post was last modified: 04-11-2018 08:55 PM by rayluk.)
Post: #6
RE: Internet Small Computer Systems Interface ( iSCSI )
(04-11-2018 06:11 PM)rayluk Wrote:  iSCSI need some setting when working through an NAT.

" - When an iSCSI discovery connection is to be used through a port
redirector, a target will have to be configured to return a domain
name instead of an IP address in a SendTargets response, since the
port redirector will not be able to map the IP address(es)
returned in the iSCSI message. It is a good practice to do this
anyway.
"
Ref: http://www.faqs.org/rfcs/rfc3721.html

Code:
Add portal
       This command is used to add a portal to the target :

           tgtadm --lld iscsi --op new --mode portal --param portal=10.1.1.101:3260

   Remove portal
       This command is used to remove a portal from the target :

           tgtadm --lld iscsi --op delete --mode portal --param portal=10.1.1.101:3260
This action is in man page but I can never do the same behaviour.
Code:
[root@tetrali-1 ~]# tgtadm --lld iscsi --op new --mode portal --param portal=172.0.0.1:3260
tgtadm: invalid request
Find all posts by this user
Quote this message in a reply
04-11-2018, 09:06 PM
Post: #7
RE: Internet Small Computer Systems Interface ( iSCSI )
(04-11-2018 07:30 PM)rayluk Wrote:  
Code:
Add portal
       This command is used to add a portal to the target :

           tgtadm --lld iscsi --op new --mode portal --param portal=10.1.1.101:3260

   Remove portal
       This command is used to remove a portal from the target :

           tgtadm --lld iscsi --op delete --mode portal --param portal=10.1.1.101:3260
This action is in man page but I can never do the same behaviour.
Code:
[root@tetrali-1 ~]# tgtadm --lld iscsi --op new --mode portal --param portal=172.0.0.1:3260
tgtadm: invalid request

Following behaviour is observed during some test and some reminder from zma

In here, the ip port combination must be an combination that can connect back to this machine. It would fail if it cannot connect back to itself.
Let VMIP = ip of vm
Let PHIP = ip of ph
In our network situation, the ip:port here should be that of the PH and forward it to the VM by iptables. If we try to connect to $PHIP:port, where the $PHIP:port is being forwarded $VMIP:port, tcp connections would fail as the TCP handshake would never goes back to the iptable for the process. This will make the PH thinks that target is not responding.

Therefore, it will be hard if we really want to forward the iSCSI from a VM to the external network. Some other solutions, like using the PH directly doing the export should be enough at this stage.
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: