Настройка iSCSI CentOS8
<pre> dnf -y install targetcli </pre>
<pre> firewall-cmd --permanent --add-port=3260/tcp firewall-cmd –reload systemctl enable target --now targetcli </pre>
<pre> cd backstores/block create diskraid10 /dev/md126 cd /iscsi create iqn.2021-01.local.centos8:disk1 cd iqn.2021-01.local.centos8:disk1/tpg1 set attribute authentication=0 demo_mode_write_protect=0 set attribute generate_node_acls=1 cd luns create /backstores/block/diskraid5 cd / saveconfig exit </pre>
исправление статуса
Сетевой диск требует 2 пути до него, если сетевуха одна, то можно пометить как локальный
<pre> esxcli storage nmp satp rule add -s VMW_SATP_LOCAL --device diskid --option="enable_local" (replace the diskid with the disk identifier) esxcli storage core claiming reclaim -d diskid (replace the diskid with the disk identifier) esxcli storage core claimrule load esxcli storage core claimrule run </pre>
Настройка iSCSI CentOS7
<pre> yum -y install epel-release yum -y install scsi-target-utils </pre> <pre> systemctl enable tgtd </pre> <pre> # cat /etc/tgt/conf.d/disk1.conf <target iqn.2016-10.ru.optim-m.st1:disk1>
direct-store /dev/mapper/disk1 initiator-address 10.1.0.51 initiator-address 10.1.0.52 initiator-address 10.1.0.53 initiator-address 10.1.0.54 initiator-address 10.1.0.55
</target>
MaxRecvDataSegmentLength 262144 MaxXmitDataSegmentLength 262144 InitialR2T No MaxOutstandingR2T 8
</pre> <pre> </pre> <pre> </pre>
yum install -y cryptsetup </pre> <pre> modprobe dm_crypt cryptsetup luksFormat /dev/sdX echo «password» | cryptsetup luksOpen /dev/disk/by-uuid/e5baa25f-6bb2-4e82-b5a3-3b87d5c91711 disk1 </pre> <pre> </pre>
Настройка iSCSI CentOS6
<pre> # yum -y install scsi-target-utils </pre>
<pre> # nano /etc/tgt/targets.conf default-driver iscsi
<target iqn.2015-12.ru.company.st1:crypted-disk1>
controller_tid 11 backing-store /home/disk.img initiator-address 10.1.0.51 initiator-address 10.1.0.52 initiator-address 10.1.0.53 initiator-address 10.1.0.54 initiator-address 10.1.0.55 lun 2
</target>
<target iqn.2015-12.ru.company.st1:no-crypted-disk2>
direct-store /dev/sdb #LUN1 initiator-address 10.1.0.51 initiator-address 10.1.0.52 initiator-address 10.1.0.53 initiator-address 10.1.0.54 initiator-address 10.1.0.55
</target>
MaxRecvDataSegmentLength 262144 MaxXmitDataSegmentLength 262144 InitialR2T No MaxOutstandingR2T 8
</pre> <pre> service tgtd restart chkconfig tgtd on </pre>
* iptables <pre> # nano /etc/sysconfig/iptables -A INPUT -m state –state NEW -m tcp -p tcp –dport 3260 -j ACCEPT </pre> * Создание контейнера 10Gb <pre> dd if=/dev/zero of=/home/disk.img bs=1M seek=10000 count=0 </pre>