Configuring AIX as an iSCSI target.

On the iSCSI target host (server).

Host is running AIX 7.1.

Install the devices.tmiscsw.rte fileset. This fileset can be found on the AIX 7.1 Expansion Pack CD.

l273pp043_pub[/] > oslevel -s

7100-00-02-1041

l273pp043_pub[/] > lslpp -l devices.tmiscsw.rte

Fileset Level State Description

----------------------------------------------------------------------------

Path: /usr/lib/objrepos

devices.tmiscsw.rte 7.1.0.0 COMMITTED iSCSI Target Software Device

Driver

Path: /etc/objrepos

devices.tmiscsw.rte 7.1.0.0 COMMITTED iSCSI Target Software Device

Driver

l273pp043_pub[/] > lsdev -Cc disk

hdisk4 Available Virtual SCSI Disk Drive

hdisk5 Available Virtual SCSI Disk Drive

l273pp043_pub[/] > lspv

hdisk4 00f6050a2cd79ef8 rootvg active

hdisk5 00f602736c1a2ad8 None

l273pp043_pub[/] > lsvg

rootvg

l273pp043_pub[/] > smit tmiscsi_proto_add

iSCSI Target Device

iSCSI Target Protocol Device

Add an iSCSI Target Protocol Device

Add an iSCSI Target Protocol Device

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

[Entry Fields]

iSCSI Target Protocol Device Name tmsw0

Maximum number of sessions [200] +#

Maximum transfer size in one PDU [262144] +#

Access Control enabled [off] +

Apply change to DATABASE only no +

COMMAND STATUS

Command: OK stdout: yes stderr: no

Before command completion, additional instructions may appear below.

tmsw0 Available

# smit tmtarget_add

Add an iSCSI Target

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

[Entry Fields]

iSCSI Target Protocol Device Name tmsw0

iSCSI Target Logical Name []

* iSCSI Target Name [iqn.aix]

Maximum Target LUNs allowed [512] +#

Paths []

Force disconnection of iSCSI clients on remove [no] +

Initiator Reconnection delay [] +#

Addressing method [0] +#

Apply change to DATABASE only no +

Target Registration Method [none] +

SLP Registration Lifetime [] +#

iSNS Servers Names [] +

Displays the iSCSI target name. You can specify the name using one | +

| of the following two formats: iqn. <what-you-want>, eui. <16 |

| ASCII-encoded hexadecimal digits>. The iSCSI name must be unique |

| within the entire network.

COMMAND STATUS

Command: OK stdout: yes stderr: no

Before command completion, additional instructions may appear below.

target0 Available

# smit tmlun

+--------------------------------------------------------------------------+

| iSCSI Parent Target Name |

| |

| Move cursor to desired item and press Enter. |

| |

| target0 Available iSCSI Target Mode Target |

| |

Add an iSCSI Target Logical Unit

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

[Entry Fields]

iSCSI Parent Target Name target0

Logical Unit Name []

* Backing Device Type [disk] +

Backing Device Name [hdisk5] +

Backing File Full Path Name [] /

Maximum Number of Commands to Queue to Device [3] +#

Apply change to DATABASE only no +

COMMAND STATUS

Command: OK stdout: yes stderr: no

Before command completion, additional instructions may appear below.

lu0 Available

l273pp043_pub[/] > lsdev -C | grep -i iscsi

iscsi0 Available iSCSI Protocol Device

lu0 Available iSCSI Target Mode Logical Unit

target0 Available iSCSI Target Mode Target

tmiscsi0 Defined iSCSI Target Mode Targets Container

tmsw0 Available iSCSI Target Mode Device Driver

l273pp043_pub[/] > lsattr -El lu0

back_dev hdisk5 Backing Device Name True

back_dev_option N/A True

back_dev_type disk Backing Device Type True

back_file Backing File Full Path Name True

dev_size N/A True

lun_id 0x0 Logical Unit Number ID False

queue_depth 3 Maximum Number of Commands to Queue to Device True

l273pp043_pub[/] > lsattr -El target0

add_method 0 Addressing method True

force_delay 15 Initiator Reconnection delay True

force_logout no Force disconnection of iSCSI clients on remove True

iscsi_name iqn.aix iSCSI Target Name True

isns_srvnames auto iSNS Servers Names True

max_luns 512 Maximum Target LUNs allowed True

owner tmsw0 iSCSI Target Protocol Device Owner True

paths Paths True

reg_policy none Target Registration Method True

slp_lifetime 10800 SLP Registration Lifetime True

l273pp043_pub[/] >

l273pp043_pub[/] > lsattr -El tmsw0

access_control off Access Control enabled True

keepalive 240 Connection keepalive (in seconds) True

max_session 200 Maximum number of sessions True

max_xfer_size 262144 Maximum transfer size in one PDU True

l273pp043_pub[/] >

On the iSCSI initiator host (client).

Host is running AIX 6.1.

root@lb511p015_pub / # oslevel -s

6100-01-05-0920

root@lb511p015_pub / # lsdev -Cc disk

hdisk1 Available Virtual SCSI Disk Drive

root@lb511p015_pub / # lspv

hdisk1 00c8e424e56b6006 rootvg active

# smit iscsi

Change / Show Characteristics of an iSCSI Protocol Device

Type or select values in entry fields.

Press Enter AFTER making all desired changes.

[Entry Fields]

iSCSI Protocol Device iscsi0

Description iSCSI Protocol Device

Status Available

iSCSI Initiator Name [iqn.lb424p001.hostid.0a990d01]

Maximum number of commands to queue to driver [200] +#

Discovery Policy file +

Maximum Targets Allowed [16] Apply change to DATABASE only no +

root@lb511p015_pub / # chdev -l iscsi0

iscsi0 changed

root@lb511p015_pub / # mkdev -l iscsi0

iscsi0 Available

root@lb511p015_pub /etc/iscsi # tail /etc/iscsi/targets

# Assume the target is at address 10.2.1.106

# the valid port is 3260

# the name of the target is iqn.2003-01.com.ibm:00.fcd0ab21.shark128

# the CHAP secret is "123ismysecretpassword.fc1b"

# The target line would look like:

# 10.2.1.106 3260 iqn.2003-01.com.ibm:00.fcd0ab21.shark128 \

# "123ismysecretpassword.fc1b"

#

172.29.152.52 3260 iqn.aix

root@lb511p015_pub /etc/iscsi # cfgmgr -vl iscsi0

----------------

attempting to configure device 'iscsi0'

Time: 0 LEDS: 0x25b0

invoking /usr/lib/methods/cfgiscsi -l iscsi0

Number of running methods: 1

----------------

Completed method for: iscsi0, Elapsed time = 0

return code = 0

****************** stdout ***********

hdisk0

****************** no stderr ***********

----------------

Time: 0 LEDS: 0x539

Number of running methods: 0

----------------

attempting to configure device 'hdisk0'

Time: 0 LEDS: 0x25f3

invoking /usr/lib/methods/cfgscsidisk -l hdisk0

Number of running methods: 1

----------------

Completed method for: hdisk0, Elapsed time = 1

return code = 0

****************** no stdout ***********

****************** no stderr ***********

----------------

Time: 1 LEDS: 0x539

Number of running methods: 0

----------------

calling savebase

return code = 0

****************** no stdout ***********

****************** no stderr ***********

Configuration time: 1 seconds

root@lb511p015_pub /etc/iscsi #

root@lb511p015_pub /etc/iscsi # lsdev -Cc disk

hdisk0 Available Other iSCSI Disk Drive

hdisk1 Available Virtual SCSI Disk Drive

root@lb511p015_pub /etc/iscsi # lsattr -El hdisk0

clr_q no Device CLEARS its Queue on error True

host_addr 172.29.152.52 Hostname or IP Address False

location Location Label True

lun_id 0x0 Logical Unit Number ID False

max_transfer 0x40000 Maximum TRANSFER Size True

port_num 0xcbc PORT Number False

pvid 00f602736c1a2ad80000000000000000 Physical volume identifier False

q_err yes Use QERR bit True

q_type simple Queuing TYPE True

queue_depth 1 Queue DEPTH True

reassign_to 120 REASSIGN time out value True

rw_timeout 30 READ/WRITE time out value True

start_timeout 60 START unit time out value True

target_name iqn.aix Target NAME False

# mkvg -fy iscsivg hdisk0

# mklv -tjfs2 -y ISCSIlv iscsivg 1

# crfs -vjfs2 -Ayes -d ISCSIlv -m /iscsifs

# chfs -a size=+10G /iscsifs

# df -g /iscsifs

Filesystem GB blocks Free %Used Iused %Iused Mounted on

/dev/ISCSIlv 10.06 9.18 9% 5 1% /iscsifs

root@lb511p015_pub /etc/iscsi # lsvg

rootvg

iscsivg

root@lb511p015_pub /etc/iscsi # lsvg iscsivg

VOLUME GROUP: iscsivg VG IDENTIFIER: 00cdb51100004c000000012fa1c4fb49

VG STATE: active PP SIZE: 64 megabyte(s)

VG PERMISSION: read/write TOTAL PPs: 799 (51136 megabytes)

MAX LVs: 256 FREE PPs: 637 (40768 megabytes)

LVs: 2 USED PPs: 162 (10368 megabytes)

OPEN LVs: 2 QUORUM: 2 (Enabled)

TOTAL PVs: 1 VG DESCRIPTORS: 2

STALE PVs: 0 STALE PPs: 0

ACTIVE PVs: 1 AUTO ON: yes

MAX PPs per VG: 32512

MAX PPs per PV: 1016 MAX PVs: 32

LTG size (Dynamic): 256 kilobyte(s) AUTO SYNC: no

HOT SPARE: no BB POLICY: relocatable

root@lb511p015_pub /etc/iscsi #

root@lb511p015_pub /etc/iscsi # lsvg -p iscsivg

iscsivg:

PV_NAME PV STATE TOTAL PPs FREE PPs FREE DISTRIBUTION

hdisk0 active 799 637 160..00..157..160..160

root@lb511p015_pub /etc/iscsi # netstat -na | grep 3260

tcp4 0 0 172.29.144.167.33566 172.29.152.52.3260 ESTABLISHED

On the iSCSI initiator host (client).

root@lb511p015_pub /iscsifs # lmktemp bigfile 900M

bigfile

On the iSCSI target host (server).

topas_nmonD=Disk-StatsHost=l273pp043_pubRefresh=2 secs07:03.14

Network

I/F Name Recv=KB/s Trans=KB/s packin packout insize outsize Peak->Recv TransKB

en1 0.6 0.0 10.5 0.0 61.0 0.0 2.8 0.1

en0 33146.7 780.2 23031.9 11740.2 1473.7 68.1 33323.6 1505.4

lo0 0.0 0.0 0.0 0.0 0.0 0.0 0.4 0.4

Total 32.4 0.8 in Mbytes/second Overflow=0

I/F Name MTU ierror oerror collision Mbits/s Description

en1 65390 0 0 0 2047 Standard Ethernet Network Interface

en0 1500 0 0 0 2047 Standard Ethernet Network Interface

lo0 16896 0 0 0 0 Loopback Network Interface

Disk-KBytes/second-(K=1024,M=1024*1024)

Disk Busy Read Write 0----------25-----------50------------75--------100

Name KB/s KB/s | | | | |

hdisk4 0% 0 0| |

hdisk5 31% 0 32001|WWWWWWWWWWWWWWWW> |

Totals 0 32001+-----------|------------|-------------|----------+

http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=/com.ibm.aix.commadmn/doc/commadmndita/configuring_iscsi_software_target.htm

Configuring the iSCSI software target

The iSCSI software target driver enables AIX to act as one iSCSI target device or as several iSCSI target devices. The iSCSI target driver exports local disks, logical volumes, or local files to iSCSI initiators that connect to AIX using the iSCSI protocol and TCP/IP.

Each target device has an iSCSI Qualified Name and a set of logical unit numbers (LUNs) that are available to initiators that connect to the virtual iSCSI target. For each target device, you can specify which network interface and which TCP/IP port numbers the target driver can use to accept incoming connections.

Note: You need to have the iSCSI target fileset installed. The fileset name is devices.tmiscsw.rte and the fileset is contained on the AIX Expansion pack.

To configure an iSCSI target driver, complete the following steps:

  1. Create a single instance of the iSCSI target driver using the following SMIT path. This instance acts as a container for the other iSCSI objects.

Devices > iSCSI > iSCSI Target Device > iSCSI Target Protocol Device > Add an iSCSI Target Protocol Device

  1. Create one iSCSI target device for each virtual iSCSI target that is allocated by the iSCSI target driver. Use the following SMIT path to create each iSCSI target device:

Devices > iSCSI > iSCSI Target Device > iSCSI Targets > Add an iSCSI Targets

  1. Define one or more LUNs for each target device using the following SMIT path:

Note: The LUNs are accessible by initiators that connect to a virtual target. On the iSCSI target, each LUN can be associated with either a previously defined logical volume, with a physical volume, or with a file previously created on a local file system. Any physical volume that is associated with an iSCSI target logical unit cannot be used in any other way by the AIX system that is running the iSCSI target driver.

Devices > iSCSI > iSCSI Target Device > iSCSI Target LUNs

This step generally completes the configuration. However, if you are using Challenge Handshake Authentication Protocol (CHAP), or if you are using Access Control Lists (ACLs) to indicate which initiators can access which LUNs, an additional step is required to complete the target configuration.

target_name chap_name chap_secret

target_name|lun_name iSCSI_name, iSCSI_name,...