How to setup ISCSI Target?
Server Side
1) Install scsi-target-utils using yum
yum -y install scsi-target-utils
2) Edit iSCSI target configuration
vim /etc/tgt/targets.conf
initiator-address 192.168.56.102 ##Initiator IP/Name
incominguser myuser redhat ##Username = myuser and password = redhat
"iqn.2014-09.net.node1:server.target01" ##Can be anything
There are 2 types of storage devices:
backing-store - defines a virtual device on the target.
direct-store - defines a direct mapped device with the same properties as the physical device (such as VENDOR_ID, SERIAL_NUM, etc.)
3) Start iSCSI target and on boot
service tgtd start
Start on boot
chkconfig tgtd on
4) Enable 3260 port at firewall
5) Check iSCSI target configuration
tgtadm --mode target --op show
6) Check if everything works as expected
tgt-admin -s
How to setup iSCSI initiator?
Client Side
1) Install iscsi-initiator-utils using yum
yum -y install iscsi-initiator-utils
2) Edit initiator configuration file
vim /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2014-09.net.node1:san.initiator01
InitiatorAlias=node2
3) Edit iscsi client configuration /etc/iscsi/iscsid.conf
node.session.auth.authmethod = CHAP
node.session.auth.username = manoj
node.session.auth.password = redhat
4) Start iscsi client service
service iscsid start
5) Start iscsi client on boot
chkconfig iscsid on
6) Discovering targets in our iSCSI server
iscsiadm -m discovery -t st --portal Target-server-IP
7) Login with iSCSI LUN
iscsiadm -m node --targetname iqn.2014-09.net.node1:server.target01 --portal Target-Server-IP --login
8) Checking session status with the target
iscsiadm --mode session --op show
Thats it!!
Please do not forget to update with your feedback :-)