iSCSI

Initiator

iscsiadm – open-iscsi administration utility

iscsiadm -m discovery t sendtargets -p 192.168.122.143:3260

List connections:

iscsiadm -m session

Disconnect all:

iscsiadm -m node --logoutall=all

Get initiatiator’s name:

cat /etc/iscsi/initiatorname.iscsi

https://wiki.debian.org/SAN/iSCSI/open-iscsi

Target

targetcli – administration shell for storage targets

Create target:

cd iscsi
create

Create ACLs (using initiatorname from the allowed initiator):

cd /iscsi/iqn.2003-01.org.linux-iscsi.iscsitarget.x8664:sn.2b0e3ab167db/tpg1/acls
create <initiatorname>

Restrict the IP (v4 or v6) connections:

cd /iscsi/iqn.2003-01.org.linux-iscsi.iscsitarget.x8664:sn.2b0e3ab167db/tpg1/portals
create 192.168.122.169
leo@iscsitarget:~$ sudo targetcli 
targetcli shell version 2.1.fb48
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/> ls
o- / ......................................................................................................................... [...]
  o- backstores .............................................................................................................. [...]
  | o- block .................................................................................................. [Storage Objects: 2]
  | | o- tank-vm-100-disk-0 ............................................... [/dev/tank/vm-100-disk-0 (10.0GiB) write-thru activated]
  | | | o- alua ................................................................................................... [ALUA Groups: 1]
  | | |   o- default_tg_pt_gp ....................................................................... [ALUA state: Active/optimized]
  | | o- tank-vm-101-disk-0 ............................................... [/dev/tank/vm-101-disk-0 (10.0GiB) write-thru activated]
  | |   o- alua ................................................................................................... [ALUA Groups: 1]
  | |     o- default_tg_pt_gp ....................................................................... [ALUA state: Active/optimized]
  | o- fileio ................................................................................................. [Storage Objects: 0]
  | o- pscsi .................................................................................................. [Storage Objects: 0]
  | o- ramdisk ................................................................................................ [Storage Objects: 0]
  o- iscsi ............................................................................................................ [Targets: 1]
  | o- iqn.2003-01.org.linux-iscsi.iscsitarget.x8664:sn.2b0e3ab167db ..................................................... [TPGs: 1]
  |   o- tpg1 .................................................................................................. [gen-acls, no-auth]
  |     o- acls .......................................................................................................... [ACLs: 0]
  |     o- luns .......................................................................................................... [LUNs: 2]
  |     | o- lun0 .......................................... [block/tank-vm-100-disk-0 (/dev/tank/vm-100-disk-0) (default_tg_pt_gp)]
  |     | o- lun1 .......................................... [block/tank-vm-101-disk-0 (/dev/tank/vm-101-disk-0) (default_tg_pt_gp)]
  |     o- portals .................................................................................................... [Portals: 1]
  |       o- 0.0.0.0:3260 ..................................................................................................... [OK]
  o- loopback ......................................................................................................... [Targets: 0]
  o- vhost ............................................................................................................ [Targets: 0]
  o- xen-pvscsi ....................................................................................................... [Targets: 0]
  • https://wiki.debian.org/SAN/iSCSI/LIO
  • https://manpages.debian.org/testing/targetcli-fb/targetcli.8.en.html
  • https://wiki.archlinux.org/title/ISCSI/LIO
  • http://linux-iscsi.org/wiki/LIO
  • https://manpages.debian.org/testing/targetcli-fb/targetcli.8.en.html
  • https://www.server-world.info/en/note?os=Debian_10&p=iscsi&f=2