Created target iqn.2003-01.org.linux-iscsi.l99.x8664:sn.936bc66a0793.
Entering new node /iscsi/iqn.2003-01.org.linux-iscsi.l99.x8664:sn.936bc66a0793/tpgt1
o-
tpgt1
.................................................................................................................
[enabled]
o-
acls
..................................................................................................................
[0 ACL]
o-
luns
..................................................................................................................
[0 LUN]
o-
portals
............................................................................................................
[0 Portal]
4.创建lun
/iscsi/iqn.20...66a0793/tpgt1> cd luns
/iscsi/iqn.20...93/tpgt1/luns> create /backstores/iblock/iscsi0
Selected LUN 0.
Successfully created LUN 0.
Entering new node /iscsi/iqn.2003-01.org.linux-iscsi.l99.x8664:sn.936bc66a0793/tpgt1/luns/lun0
/iscsi/iqn.20...gt1/luns/lun0> ls
o- lun0 ....................................................................................... [iblock/iscsi0 (/dev/vmdata/iscsi0)]
5.创建portal
/iscsi/iqn.20...66a0793/tpgt1> cd portals
/iscsi/iqn.20...tpgt1/portals> ls
o-
portals
..............................................................................................................
[0 Portal]
/iscsi/iqn.20...tpgt1/portals> create 192.168.122.1 3260
Successfully created network portal 192.168.122.1:3260.
Entering new node /iscsi/iqn.2003-01.org.linux-iscsi.l99.x8664:sn.936bc66a0793/tpgt1/portals/192.168.122.1:3260
/iscsi/iqn.20...68.122.1:3260> cd ..
/iscsi/iqn.20...tpgt1/portals> create 192.168.122.1 3261
Successfully created network portal 192.168.122.1:3261.
Entering new node /iscsi/iqn.2003-01.org.linux-iscsi.l99.x8664:sn.936bc66a0793/tpgt1/portals/192.168.122.1:32616.创建acls
6.添加访问许可(acls)
/iscsi/iqn.20...66a0793/tpgt1> cd acls
/iscsi/iqn.20...93/tpgt1/acls> create iqn.1993-08.org.debian:01:50d4b3301a24
Successfully created Node ACL for iqn.1993-08.org.debian:01:50d4b3301a24
Created mapped LUN 0.
Entering new node /iscsi/iqn.2003-01.org.linux-iscsi.l99.x8664:sn.936bc66a0793/tpgt1/acls/iqn.1993-08.org.debian:01:50d4b3301a24
/iscsi/iqn.20...:50d4b3301a24> ls
o-
iqn.1993-08.org.debian:01:50d4b3301a24
...........................................................................
[1 Mapped LUN]
o-
mapped_lun0
.......................................................................................................
[lun0 (rw)]
**create后的参数为initiator的名字,可以在客户机的/etc/iscsi/initiatorname.iscsi文件中找到
7.设置授权属性
这里设置为可以无密码访问
/> cd iscsi/iqn.2003-01.org.linux-iscsi.l99.x8664:sn.936bc66a0793/tpgt1/
/iscsi/iqn.20...66a0793/tpgt1> set attribute authentication=0
Parameter authentication is now '0'.
/iscsi/iqn.20...66a0793/tpgt1>
8.保存配置
/iscsi> cd /
/> saveconfig
WARNING: Saving l99 current configuration to disk will overwrite your boot settings.
The current target configuration will become the default boot config.
Are you sure? Type 'yes': yes
Making backup of qla2xxx/ConfigFS with timestamp: 2013-12-02_16:42:36.209861
Successfully updated default config /etc/target/qla2xxx_start.sh
Making backup of srpt/ConfigFS with timestamp: 2013-12-02_16:42:36.209861
Successfully updated default config /etc/target/srpt_start.sh
Making backup of loopback/ConfigFS with timestamp: 2013-12-02_16:42:36.209861
Successfully updated default config /etc/target/loopback_start.sh
Making backup of fc/ConfigFS with timestamp: 2013-12-02_16:42:36.209861
Successfully updated default config /etc/target/fc_start.sh
Making backup of LIO-Target/ConfigFS with timestamp: 2013-12-02_16:42:36.209861
Generated LIO-Target config: /etc/target/backup/lio_backup-2013-12-02_16:42:36.209861.sh
Making backup of Target_Core_Mod/ConfigFS with timestamp: 2013-12-02_16:42:36.209861
Generated Target_Core_Mod config: /etc/target/backup/tcm_backup-2013-12-02_16:42:36.209861.sh
Successfully updated default config /etc/target/lio_start.sh
Successfully updated default config /etc/target/tcm_start.sh
/> exit