Scsi-target-utils Quickstart Guide
来源:互联网 发布:mac队员被杀 编辑:程序博客网 时间:2024/05/21 11:24
https://fedoraproject.org/wiki/Scsi-target-utils_Quickstart_Guide
About
This page is intended to outline a series of steps need to quickly get a scsi-target-utils based iSCSI software target working.
Most of these instructions can also be found in a README provided by the scsi-target-utils package (see/usr/share/doc/scsi-target-utils-*/README.iscsi
).
Installation
Start by installing the scsi-target-utils
package using DNF:
# dnf install scsi-target-utils
Or with YUM:
# yum install scsi-target-utils
Configuration
Firewall
Ensure, port 3260 is available for incoming connection and there is no firewall in the way between target and test machine.
- Either stop your firewall:
# service iptables stop
- Or, open up tcp port 3260 for traffic using:
# system-config-firewall
- Or, modify your iptables configuration manually by
- editing /etc/sysconfig/iptables
- Then restarting iptables:
# service iptables restart
For firewalld:
firewall-cmd --zone=FedoraServer --add-service=iscsi-target --permanent
firewall-cmd --reload
Backing Store
When configured, the tgtd service will present a block device to iSCSI initiators. You may use a LVM logical volume, a disk partition, a whole disk, or a file. For production use a LVM logical volume is typically used. For this document, we will create a file.
- First, create a 8Gib file:
# dd if=/dev/zero of=/var/tmp/iscsi-disk1 bs=1M count=8000
Selinux
# semanage fcontext -a -t tgtd_var_lib_t /var/tmp/iscsi-disk1# restorecon -Rv /var/tmp/iscsi-disk1
Service startup
Configure the tgtd service to start on boot. Type:
# service tgtd start# chkconfig tgtd on
Up and running in 3 steps
For the fastest way to present a target device with 1 logical unit to any initiator ... follow these three steps:
- First, create a target device
- Next, add a logical unit
- Finally, enable the target to accept initiators
That's it!
How to ...
The following sections detail common actions you might perform using the tgtadm utility with the configuration used above. All of the following steps are also detailed in theREADME.iscsi included in the scsi-target-utils package.
List active targets
At any time you can list the active targets by typing:# tgtadm --lld iscsi --mode target --op show
Create a new target device
Create a target device:# tgtadm --lld iscsi --mode target --op new --tid=1 --targetname iqn.2009-02.com.example:for.all
Add a logical unit (LUN)
You can add a logical unit to an existing target device by typing:
# tgtadm --lld iscsi --mode logicalunit --op new --tid 1 --lun 1 -b /var/tmp/iscsi-disk1
Repeat this process while changing the -b parameter to add more logical units.
Permissions
The following sections detail various authentication and restrictions you can enabled usingtgtadm.
List all user accounts
To display a list of all configured user accounts, type:
# tgtadm --lld iscsi --mode account --op show
Add IP wildcard to allow all initiators
# tgtadm --lld iscsi --mode target --op bind --tid 1 -I ALL
IP-based restrictions
If you've previously configured this target to accept ALL initiators, you'll need to remove that first.
# tgtadm --lld iscsi --mode target --op unbind --tid 1 -I ALL
Now, restrict access to a specific IP ...
# tgtadm --lld iscsi --mode target --op bind --tid 1 -I 10.10.0.24
Or, restrict access to a subnet ...
# tgtadm --lld iscsi --mode target --op bind --tid 1 -I 10.10.0.0/24
User/Password authentication (CHAP)
There are two types of CHAP configurations supported for iSCSI authentication:
- Initiator Authentication is basic CHAP authentication. A username and password is created on the target. Each initiator logs into the target with this information.
- Target Authentication is an authentication method in addition to Initiator Authentication. A separate "outgoing" username is created on the target. This username/password pair is used by the target to log into each initiator. Initiator Authentication must also be configured in this scenario.
CHAP Initiator Authentication
- First, create a user and password:
# tgtadm --lld iscsi --mode account --op new --user ''consumer'' --password ''Longsw0rd''
- Next, add the users to an existing target device:
# tgtadm --lld iscsi --mode account --op bind --tid 1 --user ''consumer''
- On the initiator's system, this username/password information is entered into
/etc/iscsi/iscsid.conf
as:- For discovery authentication (not supported by tgt yet): discovery.sendtargets.auth.{username,password}
- For session authentication: node.session.auth.{username,password}
CHAP Target Authentication
- First, create a user and password:
# tgtadm --lld iscsi --mode account --op new --user ''provider'' --password ''Shortsw0rd''
- Next, add the users to an existing target device:
# tgtadm --lld iscsi --mode account --op bind --tid 1 --user ''provider'' --outgoing
- On the initiator's system, this username/password information is entered into
/etc/iscsi/iscsid.conf
as:- For discovery authentication (not supported by tgt yet): discovery.sendtargets.auth.{username_in,password_in}
- For session authentication: node.session.auth.{username_in,password_in}
- Scsi-target-utils Quickstart Guide
- scsi-target-utils、linux用文件虚拟磁盘、linux磁盘snapshot
- Linux下通过scsi-target-utils搭建多硬盘共享存储
- Centos7下通过EPEL安装scsi-target-utils,完成iscsi存储模拟
- Python (Visual QuickStart Guide)
- Cobbler Quickstart Guide
- LIO -SCSI target
- LIO -SCSI target
- LIO -SCSI target
- Linux中三种SCSI target
- STGT:target userspace utils
- WordPress 2 (Visual QuickStart Guide)
- Windows Vista: Visual QuickStart Guide
- Axis2官网QuickStart Guide 理解
- Linux Utils API Reference Guide
- Visual QuickStart Guide MySQL 2nd Edition
- Secrets of RSS (Visual QuickStart Guide)
- MySQL, Second Edition (Visual QuickStart Guide)
- VAssistX 添加inclue查找路径支持语法高亮(举例:兼容Qt导入项目)
- Unbantu 编译ffmpeg Android版本库
- ubuntu下安装teamviewer
- CentOS7通过yum安装Mysql5.7+修改默认密码+远程登录
- 237. Delete Node in a Linked List的C++解法
- Scsi-target-utils Quickstart Guide
- Spring源码解析-PropertyEditor
- 使用EasyPermissions 来打造简单的android6.0动态权限
- Linq 和 Lambda 查询中按照多个值进行分组GroupBy
- vue.js浅度监听和深度监听
- 新浪微博OAuth认证和存储
- Android Studio显示行数
- Spring中property资源文件动态映射xml载入方法
- 第八章 VMware Workstation中Linux克隆步骤