Creating iSCSI Target….

To create an iSCSI target from the targetcli shell, use the cd command to change to the /iscsi directory.

/> cd /iscsi

/iscsi>

Use the create command without any arguments to create an iSCSI target by using a default target name.

By default, the target is identified by an “iqn” identifier. This is an iSCSI Qualified Name (IQN), which uniquely identifies a target. IQN format addresses are most commonly used to identify a target. This address consists of the following fields:

  • Literal iqn
  • Date (in yyyy-mm format) that the naming authority took ownership of the domain
  • Reversed domain name of the authority
  • Optional “:” that prefixes a storage target name specified by the naming authority

Other address types include Extended Unique Identifier (EUI) and T11 Network Address Authority (NAA). The following example uses the create command to create an IQN (iSCSI Qualified Name) called iqn.2015-07.com.example.host02 with a target named tgt1.

/iscsi> create iqn.2015-07.com.example.host02:tgt1

A Target Portal Group (TPG) is created as a result of this command. Use the ls command to view the TPG hierarchy.

/iscsi> ls

o- iscsi …………………………………… [Targets: 1]

o- iqn.2003-01.org.linux-iscsi.host02.x8664:sn.3abca38b994f …………. [TPGs: 1]

o- tpg1 ……………………….. [no-gen-acls, no-auth]

o- acls …………………………………. [ACLs: 0]

o- luns …………………………………. [LUNs: 0]

o- portals ……………………………. [Portals: 1]

o- 0.0.0.0:3260 …………………………….. [OK]

Note that the initial TPG hierarchy is empty with the exception of a network portal.

A network portal is an IP address:port pair. An iSCSI target is accessed by remote systems through the network portal. The default portal of 0.0.0.0:3260 allows the iSCSI server to listen on all IPv4 addresses on port 3260. You can delete the default portal and configure portals as needed. Both IPv4 and IPv6 addresses are supported.

To allow remote systems to access an iSCSI target on port 3260, either disable the firewalld service on the iSCSI server or configure firewalld to trust the 3260/tcp port. The following example uses firewall-cmd to open the 3260/tcp port for the firewalld service.

# firewall-cmd –permanent –add-port=3260/tcp

If you include the –permanent option when adding a port, use the firewall-cmd command to reload the configuration.

# firewall-cmd –reload