xref: /netbsd-src/external/bsd/iscsi/dist/doc/FAQ (revision 2f24582978112bccc072c8d33b43050a4f554290)
1*2f245829SagciSCSI Frequently Asked Questions
2*2f245829Sagc================================
3*2f245829Sagc
4*2f245829SagcQ1. What is iSCSI?
5*2f245829Sagc==================
6*2f245829Sagc
7*2f245829SagcA1.  It's an IETF standard (RFC 3720) for remote access to block-level
8*2f245829Sagcstorage.  It can be thought of as similar to NFS, except that an NFS
9*2f245829Sagcserver exports files; the iSCSI target exports blocks to the iSCSI
10*2f245829Sagcinitiators, which are the clients.
11*2f245829Sagc
12*2f245829Sagc
13*2f245829SagcQ2. What's the difference between an initiator and a target?
14*2f245829Sagc============================================================
15*2f245829Sagc
16*2f245829SagcA2.  The target is the iSCSI server - it serves up blocks to the
17*2f245829Sagcclients, which are called initiators.  Typically, initiators are part
18*2f245829Sagcof the operating system, since the operating system manages block
19*2f245829Sagcstorage, presenting it to the user as file systems sitting on top of
20*2f245829Sagcthe storage.
21*2f245829Sagc
22*2f245829SagcTargets do not generally need to be part of the operating system,
23*2f245829Sagcindeed there is some flexibility to be gained by having targets as
24*2f245829Sagcpart of the user-level daemons that are run. This means that
25*2f245829Sagcsecurity credentials need not be buried in the kernel.
26*2f245829Sagc
27*2f245829Sagc
28*2f245829SagcQ3. So how do I use it?
29*2f245829Sagc=======================
30*2f245829Sagc
31*2f245829SagcA3.  Firstly, you need to set up the iSCSI target.  The target is
32*2f245829Sagcsimply sitting there, waiting for requests for blocks.  So we need to
33*2f245829Sagcconfigure the target with an area of storage for it to present to the
34*2f245829Sagcinitiators.
35*2f245829Sagc
36*2f245829SagcTo set up the target, you need to edit the /etc/iscsi/targets file.
37*2f245829SagcIt has a certain layout, to provide a means of (a) mirroring and (b)
38*2f245829Sagccombining multiple areas to present one large contiguous area of
39*2f245829Sagcstorage. This can be multiply-layered.
40*2f245829Sagc
41*2f245829SagcThe basic unit of storage is an extent. This can be either a file
42*2f245829Sagcor a device. The offset of the start of the extent to be presented
43*2f245829Sagcmust be given, and also the length of the extent.
44*2f245829Sagc
45*2f245829SagcA device is made up of one or more extents, and/or one or more
46*2f245829Sagcother devices.
47*2f245829Sagc
48*2f245829SagcAt the highest level, a target is what is presented to the initiator,
49*2f245829Sagcand is made up of one or more devices, and/or one or more extents.
50*2f245829Sagc
51*2f245829SagcThe simple example is as follows, consisting of one piece of storage
52*2f245829Sagcpresented by one target:
53*2f245829Sagc
54*2f245829Sagc	# extent        file or device          start           length
55*2f245829Sagc	extent0         /tmp/iscsi-target0      0               100MB
56*2f245829Sagc
57*2f245829Sagcwill produce an extent of storage which is based on one file,
58*2f245829Sagc/tmp/iscsi-target0, which starts 0 bytes into the file, and is 100 MB
59*2f245829Sagcin length.  The file will be created if it does not already exist.
60*2f245829Sagc
61*2f245829Sagc	# target        storage                 netmask
62*2f245829Sagc	target0         extent0                 0.0.0.0/0
63*2f245829Sagc
64*2f245829SagcThat extent is then used in target0, and will be presented to an
65*2f245829Sagcinitiator running on any host.
66*2f245829Sagc
67*2f245829SagcExtents must be defined before they can be used, and extents cannot
68*2f245829Sagcbe used more than once.
69*2f245829Sagc
70*2f245829SagcDevices are used to combine extents or other devices.  Device
71*2f245829Sagcdefinitions have the following format:
72*2f245829Sagc
73*2f245829Sagc	# devices
74*2f245829Sagc	device0	RAID1		extent0 extent1
75*2f245829Sagc
76*2f245829SagcA "RAID1" device behaves in much the same way that RAID1 devices work
77*2f245829Sagcin the storage arena - they mirror the original storage.  There can be
78*2f245829Sagcany number of devices or extents in a RAID1 device, not just 2, but
79*2f245829Sagceach device or extent must be of the same size.
80*2f245829Sagc
81*2f245829SagcA "RAID0" device combines the storage, to produce a larger area of
82*2f245829Sagc(virtually) "contiguous" storage.
83*2f245829Sagc
84*2f245829SagcDevices must be defined before they can be used, and devices may not
85*2f245829Sagcbe used more than once.
86*2f245829Sagc
87*2f245829SagcA more detailed example would be as follows:
88*2f245829Sagc
89*2f245829Sagc	# Complex file showing 3-way RAID1 (with RAID1 components),
90*2f245829Sagc	# also using local and (NFS) remote components
91*2f245829Sagc
92*2f245829Sagc	# extents
93*2f245829Sagc	extent0	/iscsi/extents/0			0	100MB
94*2f245829Sagc	extent1	/imports/remote1/iscsi/extents/0	0	100MB
95*2f245829Sagc	extent2	/iscsi/extents/1			0	100MB
96*2f245829Sagc	extent3	/imports/remote1/iscsi/extents/1	0	100MB
97*2f245829Sagc	extent4	/iscsi/extents/2			0	100MB
98*2f245829Sagc	extent5	/imports/remote1/iscsi/extents/2	0	100MB
99*2f245829Sagc	extent6	/iscsi/extents/3			0	100GB
100*2f245829Sagc
101*2f245829Sagc	# devices
102*2f245829Sagc	device0	RAID1		extent0 extent1
103*2f245829Sagc	device1	RAID1		extent2 extent3
104*2f245829Sagc	device2	RAID1		extent4 extent5
105*2f245829Sagc	device3	RAID1		device0 device1 device2
106*2f245829Sagc
107*2f245829Sagc	# targets
108*2f245829Sagc	target0	device3		10.4.0.0/16
109*2f245829Sagc
110*2f245829Sagc	# a target can be made from just an extent
111*2f245829Sagc	target1	extent6		127.0.0.0/8
112*2f245829Sagc
113*2f245829Sagcwhich will make 7 extents, 3 of them 100 MB in length and remote (via
114*2f245829SagcNFS), and 3 of them 100 MB in length and local, and one of them large
115*2f245829Sagc(100 GB) and local.  Three separate occurrences of a local and remote
116*2f245829Sagc100 MB extent are combined to make three RAID1 devices, and then those
117*2f245829Sagcthree RAID1 devices are combined into another RAID1 device, and
118*2f245829Sagcpresented as target0.
119*2f245829Sagc
120*2f245829SagcThe other extent is used to present a simple 100 GB of storage as
121*2f245829Sagctarget1.
122*2f245829Sagc
123*2f245829Sagc
124*2f245829SagcQ4.  What about security?
125*2f245829Sagc=========================
126*2f245829Sagc
127*2f245829SagcA4.  A good question.  RFC 3720 specifies CHAP, SRM and Kerberos as
128*2f245829Sagcmethods of providing authentication and/or security.  In practice,
129*2f245829Sagcit's whatever is provided by the initiator you are using which will
130*2f245829Sagcdetermine what authentication or security is used.
131*2f245829Sagc
132*2f245829SagcIf you want any form of security, it's probably best to use ssh port
133*2f245829Sagcforwarding for all your traffic if you're worried about security.
134*2f245829SagcCHAP will only provide authentication, the other information will flow
135*2f245829Sagcacross the network in clear.
136*2f245829Sagc
137*2f245829Sagc
138*2f245829SagcQ5.  Using the Microsoft initiator, I can't login with CHAP
139*2f245829Sagc===========================================================
140*2f245829Sagc
141*2f245829SagcA5.  The 1.06 Microsoft initiator silently enforces a chap password
142*2f245829Sagclength of at least 12 characters.  If you enter a password which is
143*2f245829Sagcless than that, your Discovery login will silently fail.
144*2f245829Sagc
145*2f245829SagcSince CHAP provides very little authentication anyway, you are advised
146*2f245829Sagcnot to use it - ssh port forwarding, and the use of tcp wrappers,
147*2f245829Sagcwill do a much better job of protection.
148*2f245829Sagc
149*2f245829Sagc
150*2f245829SagcQ6. What initiators work with the NetBSD iSCSI target?
151*2f245829Sagc======================================================
152*2f245829Sagc
153*2f245829SagcA6. The NetBSD target has been tested at various times with the Microsoft
154*2f245829SagciSCSI initiator, version 1.06 (which can be downloaded for free from
155*2f245829Sagcwww.microsoft.com, but needs Windows XP Pro to work), and also with the
156*2f245829SagcNetBSD test harness, which is provided, but not installed, in the same
157*2f245829Sagcplace as the target.
158*2f245829Sagc
159*2f245829Sagc
160*2f245829SagcQ7.  What is the difference between Discovery and Normal login?
161*2f245829Sagc===============================================================
162*2f245829Sagc
163*2f245829SagcA7.  On direct-attached storage, the kernel verifies what storage is
164*2f245829Sagcavailable, and assigns a device node to it. With iSCSI, storage can
165*2f245829Sagccome and go, and our proximity to the devices doesn't matter. So we
166*2f245829Sagcneed to find a different method of finding out what iSCSI storage is
167*2f245829Sagcout there.
168*2f245829Sagc
169*2f245829SagcThis is done by a "Discovery" iSCSI session - the initiator logs in
170*2f245829Sagcto the target, finds out what storage is being presented, then logs
171*2f245829Sagcback out. This can be seen by the syslog entries:
172*2f245829Sagc
173*2f245829Sagc	Feb  5 10:33:44 sys3 iscsi-target: > Discovery login from iqn.1991-05.com.microsoft:inspiron on 10.4.1.5
174*2f245829Sagc	Feb  5 10:33:44 sys3 iscsi-target: < Discovery logout from iqn.1991-05.com.microsoft:inspiron on 10.4.1.5
175*2f245829Sagc
176*2f245829SagcThe initiator will then perform a "Normal" login session, which will
177*2f245829Sagcestablish a session between the initiator and target. This is denoted
178*2f245829Sagcby the syslog entries:
179*2f245829Sagc
180*2f245829Sagc	Feb  5 00:00:28 sys3 iscsi-target: > Discovery login from iqn.1993-03.org.NetBSD.iscsi-initiator:agc on 127.0.0.1
181*2f245829Sagc	Feb  5 00:00:28 sys3 iscsi-target: < Discovery logout from iqn.1993-03.org.NetBSD.iscsi-initiator:agc on 127.0.0.1
182*2f245829Sagc	Feb  5 00:00:28 sys3 iscsi-target: > Normal login from iqn.1993-03.org.NetBSD.iscsi-initiator:agc on 127.0.0.1
183*2f245829Sagc	Feb  5 00:05:32 sys3 iscsi-target: < Normal logout from iqn.1993-03.org.NetBSD.iscsi-initiator:agc on 127.0.0.1
184*2f245829Sagc
185*2f245829Sagc
186*2f245829SagcQ8. So what do I do to try it?
187*2f245829Sagc==============================
188*2f245829Sagc
189*2f245829SagcA8. Perform the following steps:
190*2f245829Sagc
191*2f245829Sagca) define the storage that you want to present in /etc/iscsi/targets
192*2f245829Sagcb) start the iSCSI target: /etc/rc.d/iscsi_target forcestart
193*2f245829Sagcc) use an initiator to point it at the machine you started it on
194*2f245829Sagc
195*2f245829Sagc
196*2f245829SagcQ9. Why does the test harness not work properly?
197*2f245829Sagc================================================
198*2f245829Sagc
199*2f245829SagcA9. Firstly, you should be invoking the test harness as
200*2f245829Sagc
201*2f245829Sagc	iscsi-harness -n 3 -h localhost
202*2f245829Sagc
203*2f245829Sagcwhere the 'n' option is the number of iterations to perform, and the
204*2f245829Sagc'h' parameter is the name or address of the machine where the
205*2f245829Sagciscsi-target is running.
206*2f245829Sagc
207*2f245829SagcIf the harness was invoked properly, check any error messages which
208*2f245829Sagcthe test harness sends:
209*2f245829Sagc
210*2f245829SagcIf one of them looks like:
211*2f245829Sagc
212*2f245829Sagc	No matching user configuration entry for `agc' was found
213*2f245829Sagc	Please add an entry for `agc' to `/etc/iscsi/auths'
214*2f245829Sagc
215*2f245829Sagc(where "agc" is substituted for the name of the user who was running
216*2f245829Sagcthe test harness), then please do as suggested. The iSCSI test harness
217*2f245829Sagctests, amongst other things, the CHAP authentication process, and so
218*2f245829SagcCHAP credentials for that user are needed.
219*2f245829Sagc
220*2f245829Sagc
221*2f245829Sagc
222*2f245829SagcAlistair Crooks
223*2f245829Sagcagc@NetBSD.org
224*2f245829SagcWed Feb  8 07:21:56 GMT 2006
225