Saturday, May 7, 2011

iSCSI Targets on Solaris 10 U9

Assuming we have a pool named pool1 and we wish to create a target for a client host named server1. Our ZFS target server has two interfaces; the interface we want to use for iSCSI has  the IP address

First, create a new volume for the iSCSI target:

 zfs create -V 100g pool1/vols/iscsi1

We can share it out (this could have been done during the creation phase, of course)

 zfs set shareiscsi=on pool1/vols/iscsi1

Let's bind this volume so that it's only available on the iSCSI interface:

 iscsitadm create tpgt 1
 iscsitadm modify tpgt -i
 iscsitadm modify target -p 1 pool1/vols/iscsi1

We should set up some sort of authentication. At a minimum, a target CHAP entry.

Go ahead and create the client/initiator entry:
 iscsitadm create initiator --iqn server1

assign the CHAP username for server1 (we're calling it server1user):
 iscsitadm modify initiator --chap-name server1user server1

set a CHAP password for that client:
 iscsitadm modify initiator --chap-secret server1
 (it must be at least 12 characters long and no more than 16 characters long.)

Bind the ACL to the target:
  iscsitadm modify target --acl server1 pool1/vols/iscsi1

Now all you need to do is to connect to it from the iSCSI initiator on server1. Set the server interface IP as the portal (i.e.,, look at the targets, and authenticate via CHAP using server1user as the username and whatever password you specified above as the password.

No comments: