Linux iSCSI - target and initiator

Published: 09 December 2024
on channel: uadmin
215
10

This video is part of the Random Linux Stuff Playlist:
   • Random Linux Stuff  

============
You need root permissions...
=========
TARGET

#install the targetcli
yum install -y targetcli

#enter targetcli
targetcli
/backstores/fileio/ create lun /opt/lablun1.img 10000M
/iscsi create iqn.2024-01.nl.server-iscsi:server
/iscsi/iqn.2024-01.nl.server-iscsi:server/tpg1/acls create iqn.2024-01.nl.client-iscsi:client1
/iscsi/iqn.2024-01.nl.server-iscsi:server/tpg1/luns create /backstores/fileio/lun

/iscsi/iqn.2024-01.nl.server-iscsi:server/tpg1 set attribute authentication=1
/iscsi/iqn.2024-01.nl.server-iscsi:server/tpg1/acls/iqn.2024-01.nl.client-iscsi:client1 set auth userid=demo
/iscsi/iqn.2024-01.nl.server-iscsi:server/tpg1/acls/iqn.2024-01.nl.client-iscsi:client1 set auth password=badpassword
saveconfig

#enable and start the target service
systemctl enable target.service
systemctl status target.service
=========
=========
INITIATOR

#installing utils
yum install -y iscsi-initiator-utils

#enabling iscsid
systemctl enable iscsid --now

#echo modifying initiator name
#replace the current initiator line with this:
echo InitiatorName=iqn.2024-01.nl.client-iscsi:client1/etc/iscsi/initiatorname.iscsi

#restarting iscsid
systemctl restart iscsid.service

#adding auth to iscsid.conf
#add these lines to the bottom of the file
node.session.auth.authmethod = CHAP
node.session.auth.username = demo
node.session.auth.password = badpassword

#portal ip address this depends on your ip addresses....
iscsiadm --mode discoverydb --type sendtargets --portal 192.168.4.181 --discover
iscsiadm -m node --login
iscsiadm -m session -o show

#check for new lun with lsblk
lsblk

=======


Watch video Linux iSCSI - target and initiator online without registration, duration hours minute second in high quality. This video was added by user uadmin 09 December 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 215 once and liked it 10 people.