First, the server configuration
1, the software installation configuration: yum install targetcli -y
2, configuration interface: targetcli, and as follows:
1) /backstores/block create disk1 /dev/sdb1
2) /iscsi create iqn.2017-02.com.example.server0
3) /iscsi/iqn.2017-02.com.example.server0/tpg1/acls create iqn.2017-02.com.example: xxx //iqn.2017-02.com.example.xxx password for the connection
4) /iscsi/iqn.2017-02.com.example.server0/tpg1/luns create /backstores/block/disk1
5) /iscsi/iqn.2017-02.com.example.com.server0/portals create
3, firewall settings
1) add port: firewall-cmd --permanent --add-port = 3260 / tpc
2) to reload the firewall: firewall-cmd --reload
4, start the service and set the boot
1) to start the service: systemctl start target
2) Set the boot: systemctl enable target
Second, the client settings
1, add a password to /etc/iscsi/initiatorname.iscsi file: initiatorname = iqn.2017-02.com.example: xxx
2, start the service and set the boot
1)systemctl start iscsi , systemctl start iscsid
2) systemctl enable iscsi , systemctl enable iscsid
3, find and log iscsi server: iscsiadm -m discovery -t st -p 10.0.0.20 -l
4. Check the hard disk: lsblk
5, the hard disk partition: fdisk / dev / sdb // here mounted to the hard symbol sdb
6, format the hard disk: mkfs.xfs / dev / sdb1
7, see the UUID: blkid
8, to add the UUID fstab file: UUID = "" / iscsitest _netdev 0 0
9. Create a mount directory: mkdir / iscsitest
10, mount the hard drive: mount / iscsitest