Configuring iSCSI in SLES
- Check that related software has been installed in the host system.
After SLES is installed, run the rpm -qa |grep iscsi command to check whether the iSCSI software is installed.
linux-epl0:~/SPES_FOR_LINUX-2012.08.16 # rpm -qa |grep iscsi yast2-iscsi-client-2.17.34-0.5.1 open-iscsi-2.0.872-0.35.1 yast2-iscsi-server-2.17.10-0.7.3
The output shows that the iSCSI software has been installed.
If the iSCSI software is not installed or the installed iSCSI software is of an early version, use the YaST tool to install or upgrade the software.
- On the CLI, enter yast to start the YaST tool.
linux-epl0:~/open-iscsi-2.0-870.2 # yast
In the menu on the left, choose Software, as shown in Figure 4-304.
- In the menu on the right, choose Software Management, as shown in Figure 4-305.
- In Search, enter iscsi to query iSCSI software packages.Figure 4-306 Querying iSCSI software packages
- In the output that is displayed, choose the iSCSI software package that you want to install.Figure 4-307 Choosing an iSCSI software installation package
- In the output that is displayed, choose Action and press Enter. In the menu that is displayed, choose Install.Figure 4-308 Choosing Install
- Choose Accept to start the software installation.Figure 4-309 Starting the software installation
- After the installation is complete, choose Quit to exit YaST.
Figure 4-310 Exiting YaST - On the CLI, enter yast to start the YaST tool.
- Configure the IP address for the storage system.
The supported IP protocols vary with the storage system version. Specify the IP protocol based on the actual storage system version and application scenario.
Observe the following rules when configuring IP addresses for the iSCSI ports of the storage system:
- The IP address of the iSCSI host port cannot reside on the same network segment as the IP address of the management network port.
- The IP address of the iSCSI host port cannot reside on the same network segment as the IP address of the heartbeat network port.
- The IP addresses of the iSCSI host ports of the same controller must reside on different network segments. In some storage systems of the latest versions, IP addresses of iSCSI host ports on the same controller can reside on the same network segment. However, this configuration is not recommended.
Read-only users cannot modify the IP addresses of iSCSI host ports.
Modifying an IP address will interrupt services running on the host port.
- Configure the IP address on a host.
This section describes how to use the YaST tool to configure the IP address. Perform the following steps:
- Go to the YaST tool management CLI and choose Network Devices.Figure 4-311 Choosing Network Devices
- Choose Network Settings to configure the network.Figure 4-312 Choosing Network Settings
- Choose a network adapter to be configured.Figure 4-313 Choosing a network adapter
- Press Tab to choose Edit.Figure 4-314 Configuring the IP address and subnet mask
- Enter the IP address and subnet mask.Figure 4-315 Entering the IP address and subnet mask
Click Next.
- After configuring the network, choose OK on the Network Settings screen to activate the configuration.Figure 4-316 Activating the configuration
- After IP addresses are configured for the host and the storage system, run the ping command to check the link connectivity. If the link connectivity is poor, check the physical links and IP address configurations.
[root@root ~]# ping 100.100.100.2 PING 100.100.100.2 (100.100.100.2) 56(84) bytes of data. 64 bytes from 100.100.100.2: icmp_seq=1 ttl=64 time=0.607 ms 64 bytes from 100.100.100.2: icmp_seq=2 ttl=64 time=0.181 ms 64 bytes from 100.100.100.2: icmp_seq=3 ttl=64 time=0.159 ms ^C --- 100.100.100.2 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2399ms rtt min/avg/max/mdev = 0.159/0.315/0.607/0.207 ms
- Go to the YaST tool management CLI and choose Network Devices.
- Configure an initiator on the host.
Run the iscsiadm command to configure the host initiator.
- Start the iSCSI service.
linux-epl0:~ # /etc/init.d/open-iscsi start Loading iscsi modules: done Starting iSCSI initiator service: done Setting up iSCSI targets: unused
- View the host initiator information.
[root@root ~]#cat /etc/iscsi/initiatorname.iscsi InitiatorName=iqn.2012-10.com.example:d0104b56adc6
The output shows that the name of the host initiator is iqn.2012-10.com.example:d0104b56adc6.
Rules for setting an iSCSI initiator name:
Format: iqn.domaindate.reverse.domain.name:optional name
An iSCSI initiator name contains only:
- Special characters: hyphens (-), periods (.), and semicolons (:)
- Lower-case letters (a to z)
- Digits (0 to 9)
An iSCSI initiator name can contain a maximum of 223 characters.
In some OSs, the host initiator name is left blank. You need to configure this parameter by modifying a configuration file or using the YaST tool.
- Query the target.
For example, if the service IP address of the storage port is 100.100.100.2, run the following command on the host to query the target:
linux-epl0:~ # iscsiadm -m discovery -t st -p 100.100.100.2 100.100.100.2:3260,260 iqn.2006-08.com.huawei:oceanstor:21000022a10b7bb2::20103:100.100.100.2
- Log in to the target.
linux-epl0:~ # iscsiadm -m node -p 100.100.100.2 -l Logging in to [iface: default, target: iqn.2006-08.com.huawei:oceanstor:21000022a10b7bb2::20103:100.100.100.2, portal: 100.100.100.2,3260] (multiple) Login to [iface: default, target: iqn.2006-08.com.huawei:oceanstor:21000022a10b7bb2::20103:100.100.100.2, portal: 100.100.100.2,3260] successful.
- Configure the open-iscsi service to run upon system startup
linux-epl0:~ # chkconfig open-iscsi on
- If CHAP authentication is not required between the storage system and the host, the host initiator configuration is completed. If CHAP authentication is required, run the iscsiadm command.
linux-epl0:~ #iscsiadm -m node -o update -p 100.100.100.2 -n node.session.auth.authmethod -v CHAP linux-epl0:~ # iscsiadm -m node -o update -p 100.100.100.2 -n node.session.auth.username -v root linux-epl0:~ # iscsiadm -m node -o update -p 100.100.100.2 -n node.session.auth.password -v huawei123456 linux-epl0:~ # /etc/init.d/open-iscsi restart Stopping iSCSI daemon: iscsid dead but pid file exists [ OK ] Turning off network shutdown. Starting iSCSI daemon: [ OK ] [ OK ] Setting up iSCSI targets: Logging in to [iface: default, target: iqn.2006-08.com.huawei:oceanstor:21000022a10b7bb2::100.100.100.2-20100, portal: 100.100.100.2,3260] Login to [iface: default, target: iqn.2006-08.com.huawei:oceanstor:21000022a10b7bb2::100.100.100.2-20100, portal: 100.100.100.2,3260]: successful [ OK ]
The user name and password in the commands must be the same as the initiator name and password configured on the storage system; otherwise, the connection cannot be established.
The command syntax is as follows:
iscsiadm -m node -o update -p targetip -n node.session.auth.authmethod -v CHAP
iscsiadm -m node -o update -p targetip -n node.session.auth.username -v username
iscsiadm -m node -o update -p targetip -n node.session.auth.password -v password
This command is also applicable to adding CHAP authentication to multiple targets.
You are advised to run the iscsiadm command to modify related parameters. Do not modify the parameters using the configuration file.
- Start the iSCSI service.
- Configure an initiator for the storage system.
The initiator configured on the host is identified by the ISM. You need to manually add the identified initiator to the host.
- OceanStor T V1 series storage
To configure the OceanStor T V1 series storage, perform the following steps:
- In the ISM navigation tree, choose SAN Services > Mappings > Initiators. In the function pane, select the initiator that you want to add to the host and click Add to Host.Figure 4-317 Selecting an initiator
- Select the host to which the initiator is added.Figure 4-318 Adding an initiator to the host
- If CHAP authentication is not required between the storage system and the host, the host initiator configuration is completed. If CHAP authentication is required, proceed with the following steps to configure CHAP authentication on the storage system.
The following steps describe how to configure CHAP authentication on the storage system.
- In the ISM navigation tree, choose SAN Services > Mappings > Initiators. In the function pane, select the initiator whose CHAP authentication you want to configure and choose CHAP > CHAP Configuration in the navigation bar.Figure 4-319 Initiator CHAP configuration
- In the CHAP Configuration dialog box that is displayed, click Create in the lower right corner.Figure 4-320 CHAP Configuration dialog box
In the Create CHAP dialog box that is displayed, enter the CHAP user name and password.
Figure 4-321 Create CHAP dialog boxThe CHAP user name contains 4 to 25 characters and the password contains 12 to 16 characters. The limitations on the CHAP user name and password vary with the storage system. For details, see the help documentation of the storage system.
Assign the CHAP user name and password to the initiator.
Figure 4-322 Assigning the CHAP account to the initiator - Enable the CHAP account that is assigned to the host.
In the ISM navigation tree, choose SAN Services > Mappings > Initiators. In the function pane, select the initiator whose CHAP account is to be enabled and choose CHAP > Status Settings in the navigation bar.
- In the ISM navigation tree, choose SAN Services > Mappings > Initiators. In the function pane, select the initiator that you want to add to the host and click Add to Host.
Figure 4-323 Setting the CHAP statusIn the Status Settings dialog box that is displayed, choose Enabled from the CHAP Status drop-down list.
Figure 4-324 Enabling CHAPFigure 4-325 shows the initiator status in the ISM.
- OceanStor T V1 series storage
- Scan for LUNs on a host.
Run the rescan-scsi-bus.sh script on a SLES host to scan for LUNs.
If rescan-scsi-bus.sh is not found, run the rpm -qa | grep sg3 command to check whether sg3_utils-libs-xx-xx and sg3_utils-xx-xx are installed. If they are not installed, install them.
Perform the following steps to scan for LUNs:
- Add LUNs to the host on the storage system and then run the following command on the host to scan for the LUNs:
[root@root ~]# rescan-scsi-bus.sh Host adapter 0 (megaraid_sas) found. Host adapter 1 (ata_piix) found. Host adapter 10 (iscsi_tcp) found. Host adapter 2 (ata_piix) found. Host adapter 3 (bnx2i) found. Host adapter 4 (bnx2i) found. Host adapter 5 (bnx2i) found. Host adapter 6 (bnx2i) found. Scanning SCSI subsystem for new devices Scanning host 0 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs Scanning for device 0 2 0 0 ... OLD: Host: scsi0 Channel: 02 Id: 00 Lun: 00 Vendor: DELL Model: PERC H700 Rev: 2.10 Type: Direct-Access ANSI SCSI revision: 05 Scanning host 1 channels 0 2 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs Scanning for device 1 0 0 0 ... OLD: Host: scsi1 Channel: 00 Id: 00 Lun: 00 Vendor: TSSTcorp Model: DVD-ROM SN-108BB Rev: D150 Type: CD-ROM ANSI SCSI revision: 05 Scanning host 2 channels 0 2 for SCSI target IDs 0 1 2 3 4 5 6 7, all LUNs Scanning host 3 for all SCSI target IDs, all LUNs Scanning host 4 for all SCSI target IDs, all LUNs Scanning host 5 for all SCSI target IDs, all LUNs Scanning host 6 for all SCSI target IDs, all LUNs Scanning host 10 for all SCSI target IDs, all LUNs Scanning for device 10 0 0 0 ... OLD: Host: scsi10 Channel: 00 Id: 00 Lun: 00 Vendor: HUAWEI Model: S2600T Rev: 2105 Type: Direct-Access ANSI SCSI revision: 04 0 new device(s) found. 0 device(s) removed.
- Query LUN information on the host.
linux-epl0:~ # fdisk -l Disk /dev/sda: 598.8 GB, 598879502336 bytes 255 heads, 63 sectors/track, 72809 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Device Boot Start End Blocks Id System /dev/sda1 * 1 13 104391 83 Linux /dev/sda2 14 72809 584733870 8e Linux LVM Disk /dev/sdb: 104 MB, 104857600 bytes 4 heads, 50 sectors/track, 1024 cylinders Units = cylinders of 200 * 512 = 102400 bytes
- If the newly added LUNs cannot be identified on the host, perform as follows:
- Restart the open-iscsi service: Run the /etc/init.d/open-iscsi restart command to restart the service.
- Re-log in to the iSCSI initiator: Run the iscsiadm -m node -u and iscsiadm -m node -l commands to log out of and log in to the iSCSI initiator.
- Add LUNs to the host on the storage system and then run the following command on the host to scan for the LUNs: