Establishing a connection
After you discover the targets available on a target portal,
you can use the initiator to connect to a target so that you can
provision storage from the target. For example, Figure 7 shows two
targets available on HOST7. To connect to the first target in this
list, do the following:
-
Select the first target listed on the Targets tab of your
initiator, and click Connect. This displays the Connect To
Target dialog box, which displays the name (IQN) of the
target:
Note that by default, connecting to the target will also
add the connection to the list of targets on the Favorite
Targets tab so that each time the initiator computer starts it
will automatically attempt to restore the connection to the
target.
-
Selecting the Enable Multi-Path option on the Connect To
Target dialog box allows the initiator to use MultiPath IO
(MPIO), which allows the use of multiple paths to iSCSI storage
for redundancy and fault tolerance.
-
Clicking Advanced opens the Advanced Settings dialog box,
which allows you to specify or configure the following:
-
The local adapter or initiator IP address
-
CRC/Checksum settings for data or the header
digest
-
CHAP logon information, including whether to use
RADIUS
-
IPsec settings
When you are ready to connect to the target, click OK. If the
connection attempt is successful, the Status column will display
Connected for the selected target. (See Figure 8.)
You can also use Windows PowerShell to establish a connection
between an initiator and a target. As an example, start by using the
Get-IscsiConnection cmdlet to display a list of active connections
on the initiator computer:
PS C:\> Get-IscsiConnection
ConnectionIdentifier : fffffa80144a8020-1
InitiatorAddress : 0.0.0.0
InitiatorPortNumber : 34815
TargetAddress : 172.16.11.240
TargetPortNumber : 3260
PSComputerName :
To view information about the session for this connection, you
can get the connection using the Get-IscsiConnection cmdlet and pipe
the connection into the Get-IscsiSession cmdlet like this:
PS C:\> Get-IscsiConnection -ConnectionIdentifier "fffffa80144a8020-1" | `
Get-IscsiSession
AuthenticationType : NONE
InitiatorInstanceName : ROOT\ISCSIPRT\0000_0
InitiatorNodeAddress : iqn.1991-05.com.microsoft:host4.corp.fabrikam.com
InitiatorPortalAddress : 0.0.0.0
InitiatorSideIdentifier : 400001370000
IsConnected : True
IsDataDigest : False
IsDiscovered : False
IsHeaderDigest : False
IsPersistent : True
NumberOfConnections : 1
SessionIdentifier : fffffa80144a8020-4000013700000002
TargetNodeAddress : iqn.1991-05.com.microsoft:host7-fabrikam-data-target
TargetSideIdentifier : 0100
PSComputerName :
Note that the value of the
TargetNodeAddress property in the preceding
command output is what you would expect based on what you saw
earlier in the Discovered Targets list in Figure 8.
Now let’s establish a connection to the second target shown in
Figure 8. To do
this, begin by using the Get-IscsiTarget cmdlet to display a list of
available targets that have been discovered on the target
portal:
PS C:\> Get-IscsiTarget | fl
IsConnected : False
NodeAddress : iqn.1991-05.com.microsoft:host7-fabrikam-db-target
PSComputerName :
IsConnected : True
NodeAddress : iqn.1991-05.com.microsoft:host7-fabrikam-data-target
PSComputerName :
You already established a connection with the target named
fabrikam-data, so let’s try to establish a connection with target
fabrikam-db instead. To do this, use the Connect-IscsiTarget cmdlet
and specify the IQN of target fabrikam-db like this:
PS C:\> Connect-IscsiTarget -NodeAddress `
"iqn.1991-05.com.microsoft:host7-fabrikam-db-target"
AuthenticationType : NONE
InitiatorInstanceName : ROOT\ISCSIPRT\0000_0
InitiatorNodeAddress : iqn.1991-05.com.microsoft:host4.corp.fabrikam.com
InitiatorPortalAddress : 0.0.0.0
InitiatorSideIdentifier : 400001370000
IsConnected : True
IsDataDigest : False
IsDiscovered : False
IsHeaderDigest : False
IsPersistent : False
NumberOfConnections : 1
SessionIdentifier : fffffa80144a8020-4000013700000003
TargetNodeAddress : iqn.1991-05.com.microsoft:host7-fabrikam-db-target
TargetSideIdentifier : 0200
PSComputerName :
The IsConnected property in the preceding
command output indicates that your connection attempt succeeded, but
the value of the IsPersistent property
indicates that your connection won’t persist across reboots. To fix
this, you can use the Register-IscsiSession cmdlet with the
SessionIdentifier taken from the preceding
command output:
PS C:\> Register-IscsiSession -SessionIdentifier "fffffa80144a8020-4000013700000003"
If you now view the value of the
IsPersistent property for this session, you can
see that the session has been configured to persist across
reboots:
PS C:\> Get-IscsiSession -SessionIdentifier "fffffa80144a8020-4000013700000003" | `
fl IsPersistent
IsPersistent : True