User Tools

Site Tools


public:iscsi:login

First connection to iSCSI targets

The standard program for iSCSI management is the administration tool iscsiadm from the package 'open-iscsi'. At first check, whether the package 'open-iscsi' was installed and its status:

root@kvm55:~# /etc/init.d/open-iscsi status
Current active iSCSI sessions:
iscsiadm: No active sessions.

When the service is not active, it will be started:

root@kvm55:~# /etc/init.d/open-iscsi start
 * Starting iSCSI initiator service iscsid
 * Setting up iSCSI targets
scsiadm: No records found

As minimum information for a log-in the IP address of the host is needed that exports iSCSI targets. With the help of the IP address the iSCSI targets are searched. When multipath is used, a query of the first IP address normally also finds the iSCSI targets on the second iSCSI path with the other IP address.

root@kvm55:~# iscsiadm -m discovery –t st –p 10.48.2.10
10.48.2.10:3260,482 iqn.2000-05.com.3pardata:24820002ac002071
10.48.2.11:3260,582 iqn.2000-05.com.3pardata:25820002ac002071

As a result of the query, the directory '/etc/iscsi/nodes/' is created. It contains sub-directories for every iSCSI target and within further sub-directories for every iSCSCI path configuration files named 'default'.

Some iSCSI targets already need a CHAP username and a pasword for an iSCSI discovery. In these cases the directory '/etc/iscsi/nodes/' is not created. In such cases it is helpful to add the login information into the standard iSCSI configuration file '/etc/iscsi/iscsid.conf' and to repeat the discovery command.

After successful log-in the login information should be added to the configuration files of the single nodes as described below and should be removed from the standard iSCSI configuration file. Otherwise it will not be possible to carry out an iSCSI discovery for an iSCSI target that possibly expects different login information.

In most cases a CHAP authentication for the iSCSI targets is used, in few cases also an authentication of the iSCSI initiator (so called mutual CHAP) is used.

For a successful log-in to an iSCSI target the configuration file 'default' has to be expanded by the authentication information. This is possible from the command line. It has to be done for every iSCSI path:

root@kvm55:~# iscsiadm -m node \
-T iqn.2000-05.com.3pardata:24820002ac002071 -p 10.48.2.10 \
--op=update --name node.session.auth.authmethod --value=CHAP
root@kvm55:~# iscsiadm -m node \
-T iqn.2000-05.com.3pardata:25820002ac002071 -p 10.48.2.11 \
--op=update --name node.session.auth.authmethod --value=CHAP
root@kvm55:~# iscsiadm -m node \
-T iqn.2000-05.com.3pardata:24820002ac002071 -p 10.48.2.10 \
--op=update --name node.session.auth.username --value=iscsiuser
root@kvm55:~# iscsiadm -m node \
-T iqn.2000-05.com.3pardata:25820002ac002071 -p 10.48.2.11 \
--op=update --name node.session.auth.username --value=iscsiuser
root@kvm55:~# iscsiadm -m node \
-T iqn.2000-05.com.3pardata:24820002ac002071 -p 10.48.2.10 \
--op=update --name name node.session.auth.password --value=password
root@kvm55:~# iscsiadm -m node \
-T iqn.2000-05.com.3pardata:25820002ac002071 -p 10.48.2.11 \
--op=update --name name node.session.auth.password --value=password

The values 'iscsiuser' and 'password' in the example above have to be substituted by the real values for the iSCSI target. When the commands depicted above were executed successfully, the output is shown.

Afterwards a log-in to the iSCSI targets is done. A separate log-in to every iSCSI target is possible

root@kvm55:~# iscsiadm –m node \
–T iqn.2000-05.com.3pardata:24820002ac002071 -l
…
root@kvm55:~# iscsiadm –m node \
–T iqn.2000-05.com.3pardata:25820002ac002071 -l
…

… as well as a log-on to all targets simultaniously:

root@kvm55:~# iscsiadm –m node -l
…

The precise content of the command output depends on the iSCSI target and therefore was not displayed here. In any case the output of every log-in trial has to contain 'success'. When this is not the case the log-in was not successful and access to the iSCSI target will not be possile.

In the end, the success of the connection process is checked by displaying the active iSCSI sessions:

root@kvm55:~# iscsiadm -m session
tcp: [1] 10.48.2.11:3260,582 iqn.2000-05.com.3pardata:25820002ac002071
tcp: [2] 10.48.2.10:3260,482 iqn.2000-05.com.3pardata:24820002ac002071

In case the connection has to be carried out at every boot, the configuration files have to be adapted accordingly:

root@kvm55:~# find /etc/iscsi/ -type f –name default –print0 \
| xargs –r0 sed –i ‘s/startup = manual/startup = automatic/‘
root@kvm55:~# find /etc/iscsi/ -type f –name st_config –print0 \
| xargs –r0 sed –i ‘s/startup = manual/startup = automatic/‘

previous chapter | contents | next chapter

public/iscsi/login.txt · Last modified: 2015/06/12 16:56 by T Kornack