I have been playing around with my new QNAP NAS appliance, getting the storage configured and the volumes setup with my Scientific Linux 6 virtual machines using  Daniel’s articles as a reference point. While the articles worked well easily for me at the beginning, setting client VMs with authentication to multiple targets took a bit more effort. Hopefully, this post will help those who may encounter this similar problem.

The first thing to do is the go through the configuration wizard to create the targets as documented in the article. Continue on until you get to this screen:

Choose “Use CHAP Authentication” (leave Mutual CHAP disabled for now), assigned it a login user and (THIS IMPORTANT), a password that is up to 16 chapters long. The wizard will not make it obvious that you exceeded your password field, so pay careful attention when you type in your credentials.

At any event, after entering your credentials, continue through the wizard and repeat until you reached the desired number of volumes (or LUNs). You will have the screen similar to this:

Note the IQNs. Those names will become important later.

On the client server, we will setup a iSCSI initiator. First, we will install the following package:

iscsi-initiator-utils

Assuming you have a repo setup, you can install it like this:

 yum -y install iscsi-initiator-utils

Then cd to /etc/iscsi. After backing the backup of the existing iscsi.conf file, you will enable or add the following:

node.session.auth.authmethod = CHAP

node.session.auth.username = puttargetusernamehere

node.session.auth.password = puttargetpasswordhere

discovery.sendtargets.auth.authmethod = CHAP

discovery.sendtargets.auth.username = puttargetusernamehere

discovery.sendtargets.auth.password = puttargetpasswordhere

Afterward, save the file and then enable iscsi for startup:

chkconfig iscsi on

And then bring up the service:

service iscsi start

It’s okay if you don’t see the “OK” response back yet. You are not done yet.

Now we will need to initiate a connection the NAS with the following command:

iscsiadm -m discoverydb -t st -p 192.168.15.250 -D

What this will do is to pull a list of targets (this is when the actual ISCSI daemon on the initiator starts up):

[root@localhost iscsi]# iscsiadm -m discoverydb -t st -p 192.168.15.250 -D

Starting iscsid:                                           [  OK  ]

192.168.15.250:3260,1 iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0005.c2d7bd

192.168.15.250:3260,1 iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0004.c2d7bd

192.168.15.250:3260,1 iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0003.c2d7bd

192.168.15.250:3260,1 iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0002.c2d7bd

192.168.15.250:3260,1 iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0001.c2d7bd

and save them to the following directory:

root@localhost iscsi]# cd /var/lib/iscsi/

[root@localhost iscsi]# ls

ifaces  isns  nodes  send_targets  slp  static

[root@localhost iscsi]# find .

.

./static

./nodes

./nodes/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0003.c2d7bd

./nodes/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0003.c2d7bd/192.168.15.250,3260,1

./nodes/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0003.c2d7bd/192.168.15.250,3260,1/default

./nodes/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0005.c2d7bd

./nodes/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0005.c2d7bd/192.168.15.250,3260,1

./nodes/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0005.c2d7bd/192.168.15.250,3260,1/default

./nodes/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0002.c2d7bd

./nodes/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0002.c2d7bd/192.168.15.250,3260,1

./nodes/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0002.c2d7bd/192.168.15.250,3260,1/default

./nodes/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0001.c2d7bd

./nodes/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0001.c2d7bd/192.168.15.250,3260,1

./nodes/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0001.c2d7bd/192.168.15.250,3260,1/default

./nodes/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0004.c2d7bd

./nodes/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0004.c2d7bd/192.168.15.250,3260,1

./nodes/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0004.c2d7bd/192.168.15.250,3260,1/default

./slp

./send_targets

./send_targets/192.168.15.250,3260

./send_targets/192.168.15.250,3260/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0004.c2d7bd,192.168.15.250,3260,1,default

./send_targets/192.168.15.250,3260/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0003.c2d7bd,192.168.15.250,3260,1,default

./send_targets/192.168.15.250,3260/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0005.c2d7bd,192.168.15.250,3260,1,default

./send_targets/192.168.15.250,3260/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0001.c2d7bd,192.168.15.250,3260,1,default

./send_targets/192.168.15.250,3260/st_config

./send_targets/192.168.15.250,3260/iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0002.c2d7bd,192.168.15.250,3260,1,default

./ifaces

./isns

(It should be noted while the login credentials are saved as well in that directory, the files are only readable by root).

Finally, you will enable the initiator to login and attach to a specific LUN. Enter following with IQN of the LUN you will be using:

iscsiadm -m node -T iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0002.c2d7bd —login

For some reason, you have to pull a list of target first from the volume, otherwise, you will encounter something similar to this:

iscsiadm: no records found!

Now, assuming you have the correct login in the iscsi.conf and on the NAS volume, you will get the following screen:

[root@localhost iscsi]# iscsiadm -m node -T iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0002.c2d7bd —login

Logging in to [iface: default, target: iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0002.c2d7bd, portal: 192.168.15.250,3260]

Login to [iface: default, target: iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0002.c2d7bd, portal: 192.168.15.250,3260] successful.

Otherwise, you will get the following screen:

[root@localhost iscsi]# iscsiadm -m node -T iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0002.c2d7bd —login

Logging in to [iface: default, target: iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0002.c2d7bd, portal: 192.168.15.250,3260]

iscsiadm: Could not login to [iface: default, target: iqn.2004-04.com.qnap:ts-419pplus:iscsi.kvm0002.c2d7bd, portal: 192.168.15.250,3260].

iscsiadm: initiator reported error (19 - encountered non-retryable iSCSI login failure)

You will probably need to recheck your login. Worse case, you can always wiped the initiator config with:

iscsiadm -m discoverydb -t st -p 192.168.15.250 -o delete

From this point, when you established a successful ISCSI connect, you will see the following in kernel buffer:

csi4 : iSCSI Initiator over TCP/IP

scsi 4:0:0:0: Direct-Access     QNAP     iSCSI Storage    3.1  PQ: 0 ANSI: 5

sd 4:0:0:0: [sda] 104857600 512-byte logical blocks: (53.6 GB/50.0 GiB)

sd 4:0:0:0: [sda] Write Protect is off

sd 4:0:0:0: [sda] Mode Sense: 2f 00 00 00

sd 4:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn’t support DPO or FUA

 sda: unknown partition table

sd 4:0:0:0: [sda] Attached SCSI disk

sd 4:0:0:0: Attached scsi generic sg0 type 0

If you see this, you are done. RHEL OS sees it as a regular block device and configures it accordingly. You may now partition and format it for production use.

  1. monzell posted this