原创文章,欢迎转载,转载时请务必给出原文链接,谢谢!http://blog.youkuaiyun.com/sinchb/article/details/8433994#t10
iSCSI initiators and targets prove their identity to each other using the CHAP protocol, which includes a mechanism to prevent cleartext passwords from appearing on the wire.
Initiator认证可以在没有target 认证的时候应用,这种只要求target验证initiator的CHAP认证也称为Uni-directional Authentication,单向认证(target做验证)
target认证则要求initiator认证被同时应用才可以,也就是说,initiator和target需要相互认证,这种认证被称为Bi-directional Authentication,相互认证
iSCSI CHAP认证的密码长度必须介于12到16个字符(但是下面测试的时候字符长度都没有超过12字符,也没有问题,这个问题需要进一步求证),空格是合法的密码字符,所以”I Love iSCSI!!!!”是一个合法的密码!
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 2 -b /dev/sdc
tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL (最后那个参数是大写字母I,不是数字1)
Target 1: 1qn.2012-12:disk0
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 10737 MB, Block size: 512
Online: Yes
Removable media: No
Prevent rem
一、 什么是CHAP?
Challenge-Handshake Authentication ProtocoliSCSI initiators and targets prove their identity to each other using the CHAP protocol, which includes a mechanism to prevent cleartext passwords from appearing on the wire.
二、 iSCSI支持两种级别的chap 认证:
Initiator authentication和Target authentication2.1 Initiator 认证要求:
在initiator尝试连接到一个target的时候,initator需要提供一个用户名和密码给target供target进行认证。下面我们称这个用户名密码为incoming账号,即:incoming账号是initiator端提供给target端,供target端认证的账号。2.2 target 认证要求:
在initiator尝试连接到一个target的时候,target需要提供一个用户名和密码给initiator供initiator进行认证。与之对应的是outcoming账号,即:outcoming账号是target端提供给initiator端,供initiator认证的账号。Initiator认证可以在没有target 认证的时候应用,这种只要求target验证initiator的CHAP认证也称为Uni-directional Authentication,单向认证(target做验证)
target认证则要求initiator认证被同时应用才可以,也就是说,initiator和target需要相互认证,这种认证被称为Bi-directional Authentication,相互认证
iSCSI CHAP认证的密码长度必须介于12到16个字符(但是下面测试的时候字符长度都没有超过12字符,也没有问题,这个问题需要进一步求证),空格是合法的密码字符,所以”I Love iSCSI!!!!”是一个合法的密码!
三、 建立iscsi target lun
3.1在target端建立target
按照下面的步骤建立有两个lun的target(1)创建一个target
tgtadm --lld iscsi --op new --mode target --tid 1 -T 1qn.2012-12:disk0(2)给这个target分配两个设备sdb,sdc
tgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 1 -b /dev/sdbtgtadm --lld iscsi --op new --mode logicalunit --tid 1 --lun 2 -b /dev/sdc
(3)将ACL设置为ALL
ACL 是Access Control Lists 的缩写,访问控制列表,只有在这个列表中的ip才有权限访问本target。我们设置为ALL,默认所有ip都可以访问,当然,我们可以指定某些ip,只有这些ip才可以访问。tgtadm --lld iscsi --op bind --mode target --tid 1 -I ALL (最后那个参数是大写字母I,不是数字1)
(4)看看我们创建的target
[root@iscsiB ~]# tgt-admin --showTarget 1: 1qn.2012-12:disk0
System information:
Driver: iscsi
State: ready
I_T nexus information:
LUN information:
LUN: 0
Type: controller
SCSI ID: IET 00010000
SCSI SN: beaf10
Size: 0 MB, Block size: 1
Online: Yes
Removable media: No
Prevent removal: No
Readonly: No
Backing store type: null
Backing store path: None
Backing store flags:
LUN: 1
Type: disk
SCSI ID: IET 00010001
SCSI SN: beaf11
Size: 10737 MB, Block size: 512
Online: Yes
Removable media: No
Prevent rem