Iscsi

iSCSI 登錄失敗,出現錯誤 24 - 無法登錄所有門戶

  • April 20, 2018

我正在嘗試設置 iSCSI 目標:

[root@localhost /]# targetcli
targetcli shell version 2.1.fb37
Copyright 2011-2013 by Datera, Inc and others.
For help on commands, type 'help'.

/> cd backstores/fileio 
/backstores/fileio> create disk01 /iscsi_disks/disk01.img 5G
Created fileio disk01 with size 5368709120
/backstores/fileio> cd /iscsi 
/iscsi> create iqn.2015-06.world.server:storage.target01
Created target iqn.2015-06.world.server:storage.target01.
Created TPG 1.
Global pref auto_add_default_portal=true
Created default portal listening on all IPs (0.0.0.0), port 3260.
/iscsi> cd iqn.2015-06.world.server:storage.target01/tpg1/luns
/iscsi/iqn.20...t01/tpg1/luns> create /backstores/fileio/disk01 
Created LUN 0.
/iscsi/iqn.20...t01/tpg1/luns> cd ../acls 
/iscsi/iqn.20...t01/tpg1/acls> create iqn.2015-06.world.server:www.server.world
Created Node ACL for iqn.2015-06.world.server:www.server.world
Created mapped LUN 0.
/iscsi/iqn.20...t01/tpg1/acls> cd iqn.2015-06.world.server:www.server.world/
/iscsi/iqn.20....server.world> set auth userid=foo
Parameter userid is now 'foo'.
/iscsi/iqn.20....server.world> set auth password=bar
Parameter password is now 'bar'.
/iscsi/iqn.20....server.world> exit
Global pref auto_save_on_exit=true
Last 10 configs saved in /etc/target/backup.
Configuration saved to /etc/target/saveconfig.json
[root@localhost /]# service iscsid restart
Redirecting to /bin/systemctl restart iscsid.service
[root@localhost /]# service iscsi restart
Redirecting to /bin/systemctl restart iscsi.service

這是結構(在新視窗中打開圖像以查看全尺寸):

在此處輸入圖像描述

發現似乎工作正常:

[root@linuxbox ~]# iscsiadm -m discovery -t sendtargets -p 10.0.0.60
10.0.0.60:3260,1 iqn.2015-06.world.server:storage.target01

但是,當我嘗試連接時,我收到以下授權失敗消息:

[root@linuxbox ~]# iscsiadm -m node --targetname "iqn.2015-06.world.server:storage.target01" --portal "10.0.0.60:3260" --login 
Logging in to [iface: default, target: iqn.2015-06.world.server:storage.target01, portal: 10.0.0.60,3260] (multiple)
iscsiadm: Could not login to [iface: default, target: iqn.2015-06.world.server:storage.target01, portal: 10.0.0.60,3260].
iscsiadm: initiator reported error (24 - iSCSI login failed due to authorization failure)
iscsiadm: Could not log into all portals

在客戶端電腦上,您必須編輯initiatorname文件中的 initiatorname.iscsi. 該名稱是作為 ACL 創建的 iqn。

$ vi /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2015-06.world.server:www.server.world

就我而言,啟動器的 iqn 存在問題 - 我編輯了文件/etc/iscsi/initiatorname.iscsi並執行 service iscsi restart ,但仍然/etc/messages在目標上看到錯誤:

Dec  2 14:51:05 iscsi-target-vm kernel: iSCSI Initiator Node: iqn.1994-05.com.redhat:47fbcf58e10 is not authorized to access iSCSI target portal group: 1.

12 月 2 日 14:51:05 iscsi-target-vm 核心:iSCSI 登錄協商失敗。`

所以解決方案是在啟動器處執行service iscsid restart以重新載入 iqn。

引用自:https://unix.stackexchange.com/questions/207534