Configuration of iSCSI Target

iSCSI Target on a PVE-VM

Create iSCSI Target

  • Prerequisites
    Installed and running targetcli.

To install targetcli on the host where you want to create the iSCSI target, run the following command:

apt-get install targetcli-fb

Once you have targetcli installed, navigate to the iSCSI directory. Open the cli with the command:

targetcli

Navigate to the iSCSI directory. You can also use the cd command to navigate to the iSCSI directory.

/> iscsi/

Use one of the following options to create an iSCSI target:

Creating an iSCSI target using a default target name:

/iscsi> create

Created target iqn.2003-01.org.linux-iscsi.hostname.x8664:sn.78b473f296ff Created TPG1

The default name uses the linux-scsi.org domain to create the target name, so the hosts will be uniquely identified. But if you want to create a specific name, use the following command.

The structure of the name follows this format:

iqn.2003-01.org.linux-iscsi.mildtgt.x8664:sn.2b182a5f672e

it follows the rules defined by RFC 3720 for iSCSI Qualified Names (IQN):

  • iqn. → the standard prefix for an IQN.

  • 2003-01 → the registration date of the domain (in this case January 2003). linux-iscsi.org was registered then.

  • org.linux-iscsi → reversed domain name, used to ensure uniqueness.

  • mildtgt.x8664 → comes from your hostname (mildtgt) and architecture (x86_64).

  • :sn.2b182a5f672e → a generated serial number (usually random or derived from hardware). This differentiates multiple targets on the same host.

Linux default isn’t picking randomly—it’s following the standard. It creates an IQN based on the registered linux-iscsi.org prefix, your hostname, architecture, and a serial number, so you always get a valid and unique identifier, even with no manual configuration.

Creating an iSCSI target using a specific name:

/iscsi> create iqn.2025-09.it.cnr.igi.mildstone.mildtgt:sn.bc2411d99f87

I created the target name with current date and serial number taken using the mac of the interface exposing iscsi

Verify the newly created target:

/iscsi> ls
o- iscsi ....................................................... [Targets: 1]
o- iqn.2025-09.it.cnr.igi.mildstone.mildtgt:sn.bc2411d99f87 ..... [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]