一.在linux下安装启动iscsi target
1.安装启动iscsi服务
[root@wjb10000 ~]# yum -y install targetcli.noarch
2.建立一个目录设置为iscsi设备
[root@wjb10000 ~]# mkdir /iscsi_disks
3.设置target
[root@wjb10000 ~]# targetcliWarning: Could not load preferences file /root/.targetcli/prefs.bin.targetcli shell version 2.1.fb41Copyright 2011-2013 by Datera, Inc and others.For help on commands, type 'help'. /> cd backstores/fileio/backstores/fileio> create disk01 /iscsi_disks/disk01.img 20GCreated fileio disk01 with size 21474836480/backstores/fileio> cd /iscsi/iscsi> create iqn.2016-06.wjb.com:storage.target0Created target iqn.2016-06.wjb.com:storage.target0.Created TPG 1.Global pref auto_add_default_portal=trueCreated default portal listening on all IPs (0.0.0.0), port 3260./iscsi> cd iqn.2016-06.wjb.com:storage.target0/tpg1/portals//iscsi/iqn.20.../tpg1/portals> create 192.168.1.50Using default IP port 3260Could not create NetworkPortal in configFS/iscsi/iqn.20.../tpg1/portals> delete 0.0.0.0 3260Deleted network portal 0.0.0.0:3260/iscsi/iqn.20.../tpg1/portals> create 192.168.1.50Using default IP port 3260Created network portal 192.168.1.50:3260./iscsi/iqn.20.../tpg1/portals> cd ../luns/iscsi/iqn.20...et0/tpg1/luns> create /backstores/fileio/disk01Created LUN 0./iscsi/iqn.20...et0/tpg1/luns> cd ../acls/iscsi/iqn.20...et0/tpg1/acls> create iqn.2016-06.wjb.com:www.server.comCreated Node ACL for iqn.2016-06.wjb.com:www.server.comCreated mapped LUN 0./iscsi/iqn.20...et0/tpg1/acls> cd iqn.2016-06.wjb.com:www.server.com//iscsi/iqn.20...ww.server.com> set auth userid=usernameParameter userid is now 'username'./iscsi/iqn.20...ww.server.com> set auth password=passwordParameter password is now 'password'./iscsi/iqn.20...ww.server.com> exitGlobal pref auto_save_on_exit=trueLast 10 configs saved in /etc/target/backup.Configuration saved to /etc/target/saveconfig.json
4.设置防火墙
[root@wjb10000 ~]# vim /etc/firewalld/services/iscsi.xml<?xml version="1.0" encoding="utf-8"?><service><short>ISCSI</short><description>ISCSI protocal</description><port protocal="tcp" port="3260"></service>[root@wjb10000 ~]# firewall-cmd --permanent --add-service=iscsi[root@wjb10000 ~]# firewall-cmd --reload
5.启动服务
[root@wjb10000 ~]# systemctl enable target.serviceCreated symlink from /etc/systemd/system/multi-user.target.wants/target.service to /usr/lib/systemd/system/target.service.[root@wjb10000 ~]# systemctl start target.service
6.查看端口
[root@wjb10000 ~]# netstat -lnp | grep 3260tcp 0 0 192.168.1.50:3260 0.0.0.0:* LISTEN -
二.在linux下安装启动iscsi initiator
1.安装 iscsi-initiator-utils服务
[root@wjb10000 ~]# yum install iscsi-initiator-utils
新闻热点
疑难解答