Configuring iSCSI initiator on Red Hat Linux 4 and 5

876
I was configuring iSCSI initiator in one of our Red Hat Linux 4 server, couple of weeks ago, after a day’s work at last I became successful. Ohhh thank GOD. Last week again I have asked to configure iSCSI on Red Hat Linux 5 server I was cool, I already did this on RHEL 4, but after installing the package on RHEL 5 and looking at configuration file takes my breath away, a completely new configuration file not even able to compare with RHEL4. Ohhhh GOD help me. Again after a days work I was successful sharing my work with you guys it may helpful to you.

Configuring iSCSI initiator in Red Hat Enterprise Server 4

iSCSI (Internet Small Computer System Interface)

Concepts

Initiator

An initiator functions as an iSCSI client. An initiator typically serves the same purpose to a computer as a SCSI bus adapter would, except that instead of physically cabling SCSI devices (like hard drives and tape changers), an iSCSI initiator sends SCSI commands over an IP network. An initiator falls into two broad types:

Software initiator

A software initiator uses code to implement iSCSI. Typically, this happens in a kernel-resident device driver that uses the existing network card (NIC) and network stack to emulate SCSI devices for a computer by speaking the iSCSI protocol. Software initiators are available for most mainstream operating systems, and this type is the most common mode of deploying iSCSI on computers.

Hardware initiator

A hardware initiator uses dedicated hardware, typically in combination with software (firmware) running on that hardware, to implement iSCSI. A hardware initiator mitigates the overhead of iSCSI and TCP processing and Ethernet interrupts, and therefore may improve the performance of servers that use iSCSI.

Target

iSCSI refers to a storage resource located on an iSCSI server (more generally, one of potentially many instances of iSCSI running on that server) as a “target”. An iSCSI target usually represents hard disk storage. As with initiators, software to provide an iSCSI target is available for most mainstream operating systems.
Common deployment scenarios for an iSCSI target include:

Storage array

In a data center or enterprise environment, an iSCSI target often resides in a large storage array, such as a NetApp filer or an EMC Corporation NS-series computer appliance. A storage array usually provides distinct iSCSI targets for numerous clients.[1]

Software target

In a smaller or more specialized setting, mainstream server operating systems (like Linux, Solaris or Windows Server 2008) and some specific-purpose operating systems (like NexentaStor, StarWind iSCSI Target, FreeNAS, iStorage Server, OpenFiler or FreeSiOS) can provide iSCSI target’s functionality.

Addressing

Special names refer to both iSCSI initiators and targets. iSCSI provides three name-formats:

iSCSI Qualified Name (IQN)
Format: iqn.yyyy-mm.{reversed domain name} (e.g. iqn.2001-04.com.acme:storage.tape.sys1.xyz) (Note: there is an optional colon with arbitrary text afterwards. This text is there to help better organize or label resources.)

Extended Unique Identifier (EUI)

Format: eui.{EUI-64 bit address} (e.g. eui.02004567A425678D)
T11 Network Address Authority (NAA)
Format: naa.{NAA 64 or 128 bit identifier} (e.g. naa.52004567BA64678D)
IQN format addresses occur most commonly. They are qualified by a date (yyyy-mm) because domain names can expire or be acquired by another entity.

Installation on Red Hat Linux 4

# rpm -ivh iscsi-initiator-utils-4.0.3.0-7.i386.rpm

IQN no of Red Hat Linux 4 Server (/etc/initiatorname.iscsi file)

Each iSCSI device on the network, be it initiator or target, has a unique iSCSI node name. Red Hat uses the iSCSI Qualified Name (IQN) format with the initiator that ships with Red Hat Enterprise Linux. In the IQN format, a node name consists of a predefined section, chosen based on the initiator manufacturer, and a unique device name section which is editable by the administrator.
Provide this IQN number to your IPSAN Administrator he will create and assign LUN to this IQN

Configuration ( /etc/iscsi.conf)

Terms

To globally configure a CHAP username and password for initiator
authentication by the target(s), uncomment the following lines:

Outgoingusername is something we create at Target to authenticate the LUN assigned to this

OutgoingUsername=
OutgoingPassword=

To globally configure a CHAP username and password for target(s)
authentication by the initiator, uncomment the following lines:

IncomingUsername=
IncomingPassword=

Settings in config file ( /etc/iscsi.conf)

DiscoveryAddress=ipaddress or hostname of your IPSAN
OutgoingUsername=username created in targetserver for accssing this LUN
OutgoingPassword= password created in targetserver for accssing this LUN
LoginTimeout=15

Installation on Red Hat Linux 5

# rpm -ivh iscsi-initiator-utils-6.2.0.868-0.18.el5.i386.rpm

IQN no of Red Hat Linux 5 Server (/etc/iscsi/initiatorname.iscsi)

Configuration ( /etc/iscsi/iscsid.conf)

Settings

# To enable CHAP authentication set node.session.auth.authmethod
# to CHAP. The default is None.
node.session.auth.authmethod = CHAP

# To set a CHAP username and password for initiator
# authentication by the target(s), uncomment the following lines:
node.session.auth.username = testuser
node.session.auth.password = testpassword

# To enable CHAP authentication for a discovery session to the target
# set discovery.sendtargets.auth.authmethod to CHAP. The default is None.
discovery.sendtargets.auth.authmethod = CHAP

# To set a discovery session CHAP username and password for the initiator
# authentication by the target(s), uncomment the following lines:
discovery.sendtargets.auth.username = testuser
discovery.sendtargets.auth.password = testpassword

#service iscsi restart

Will get the output like this

Stopping iSCSI daemon:
iscsid dead but pid file exists [ OK ]
Turning off network shutdown. Starting iSCSI daemon: [ OK ]
[ OK ]
Setting up iSCSI targets: iscsiadm: No records found!
[ OK ]

Now discover the targets.

#iscsiadm -m discovery -t sendtargets -p 192.168.x.x ( IP address of Target)

# service iscsi restart

Will get like this
Logging out of session [sid: 1, target: iqn.1991-05.com.microsoft:aio1200-oracle-rac-target, portal: 192.168.x.x,3260]
Logout of [sid: 1, target: iqn.1991-05.com.microsoft:aio1200-oracle-rac-target, portal: 192.168.x.x,3260]: successful
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.1991-05.com.microsoft:aio1200-oracle-rac-target, portal: 192.168.251.10,3260]
Logging in to [iface: default, target: iqn.1991-05.com.microsoft:aio1200-oracle-rac-target, portal: 192.168.x.x,3260]

Important.

If you made any changes to the configuration file first remove the iqn from cache using this command

#iscsiadm -m node -T iqn.1991-05.com.microsoft:aio1200-oracle-rac-target -o delete

After issuing this command restart the iscsi to take effect the configuration you changed

#Service iscsi restart

After restarting the service discover again using

#iscsiadm -m discovery -t sendtargets -p 192.168.x.x (IP address of Target)