Server
Environment: rhel7.2 Package: Targetcli-2.1.fb41-3.el7.noarch,selinux-policy-targeted-3.13.1-60.el7.noarch
1.yum install-y TARGETCLI
2.systemctl enabled Target
3.firewall-cmd--permanent--add-rich-rule ' rule family=ipv4 source address=192.168.1.0/24 service name=targetd Accept ' && Firewall-cmd--reload
4.fdisk/dev/vda a partition of 1GB capacity, note! No formatting!
5.partprobe/dev/sda
6.targetcli
/> ls
/>/backstores/block Create data_block/dev/sda9
/> Iscsi/create iqn.2016-05.com.example.com:system1
/> Iscsi/iqn.2016-05.com.example.com:system1/tpg1/acls Create iqn.2016-05.com.example.com:system2
/> Iscsi/iqn.2016-05.com.example.com:system1/tpg1/luns Create/backstores/block/data_block
/> Iscsi/iqn.2016-05.com.example.com:system1/tpg1/portals/create 192.168.1.101 If this step is wrong, execute the following red Font command ↓ execute this sentence again
/> Iscsi/iqn.2016-05.com.example.com:system1/tpg1/portals/delete ip_address=0.0.0.0 ip_port=3260
/> Saveconfig
/> Exit Server Configuration complete!
Client
Environment: RHEL7 Package: iscsi-initiator-utils-iscsiuio-6.2.0.873-32.el7.x86_64, iscsi-initiator-utils-6.2.0.873-32.el7.x86_ 64
1.yum install-y iscsi-initiator*
2. Execution: iscsiadm-m discovery-t st-p system1.example.com This command: Get-->>192.168.1.101:3260,1 Iqn.2016-05.com.example.com:system1
3. Modify: Vim/etc/iscsi/initiatorname.iscsi fill in client iqn:initiatorname= iqn.2016-05.com.example.com:system2
4. Connection server: Iscsiadm-m node-t iqn.2016-05.com.example.com:system1-p system1.example.com-l
5.fdsik-l
6.FDISK/DEV/SDB Create a 500M partition-->/DEV/SDB1-MKFS.XFS/DEV/SDB1
7. Check Uuid:blkid
/dev/sdb1:uuid= "eb5377bc-ac3e-4e35-bc46-a93218109589" type= "XFS"
Mkdir/test
7.vim/etc/fstab
Uuid= "eb5377bc-ac3e-4e35-bc46-a93218109589"/test xfs Defaults,_netdev 0 0
Mount-a See if it is correct
12.iscsi-target