iSCSI : Configure iSCSI Target (CUI)
2019/04/10 |
Configure iSCSI Target Server.
A storage on a network is called iSCSI Target, a Client which connects to iSCSI Target is called iSCSI Initiator.
On CUI Configuration, Set like follows.
|
|
[1] | Run PowerShell with Admin Privilege and Configure iSCSI Target Server. |
Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. # create iSCSI Target # [-TargetName] ⇒ any Target name # [InitiatorId] ⇒ specify Initiators to allow to connect to Target # for specifying Initiators, possible to specify methods like follows not only IPAddress # IPAddress, IPv6Address, DNSName, IQN, MACAddress PS C:\Users\Administrator> New-IscsiServerTarget -TargetName "iSCSITarget01" -InitiatorId @("IPAddress:10.0.0.110","IPAddress:10.0.0.111") ChapUserName : ClusterGroupName : ComputerName : RX-7.srv.world Description : EnableChap : False EnableReverseChap : False EnforceIdleTimeoutDetection : True FirstBurstLength : 65536 IdleDuration : 00:00:00 InitiatorIds : {IPAddress:10.0.0.110, IPAddress:10.0.0.111} LastLogin : LunMappings : {} MaxBurstLength : 262144 MaxReceiveDataSegmentLength : 65536 ReceiveBufferCount : 10 ReverseChapUserName : Sessions : {} Status : NotConnected TargetIqn : iqn.1991-05.com.microsoft:rx-7-iscsitarget01-target TargetName : iSCSITarget01 # create iSCSI virtual disk # [-Path] ⇒ any PATH you'd like to create v-disk # [-SizeBytes] ⇒ disk size PS C:\Users\Administrator> New-IscsiVirtualDisk -Path "C:\iSCSIDisk\Disk01.vhdx" -SizeBytes 10GB ClusterGroupName : ComputerName : RX-7.srv.world Description : DiskType : Dynamic HostVolumeId : {808CAB52-0000-0000-0000-602200000000} LocalMountDeviceId : OriginalPath : ParentPath : Path : C:\iSCSIDisk\Disk01.vhdx SerialNumber : D1F8597A-48E9-483F-93EB-84CEDBAD5011 Size : 10737418240 SnapshotIds : Status : NotConnected VirtualDiskIndex : 2102166038 # assign iSCSI virtual disk to iSCSI Target PS C:\Users\Administrator> Add-IscsiVirtualDiskTargetMapping -TargetName "iSCSITarget01" -Path "C:\iSCSIDisk\Disk01.vhdx" # enable CHAP for iSCSI Target and set Username and Password for authentication # required password length over 12 chars PS C:\Users\Administrator> Set-IscsiServerTarget ` -TargetName "iSCSITarget01" ` -EnableChap $True ` -Chap (New-Object PSCredential("username", (ConvertTo-SecureString -AsPlainText "UserP@ssw0rd01" -Force)))` -PassThru ChapUserName : username ClusterGroupName : ComputerName : RX-7.srv.world Description : EnableChap : True EnableReverseChap : False EnforceIdleTimeoutDetection : True FirstBurstLength : 65536 IdleDuration : 00:36:56 InitiatorIds : {IPAddress:10.0.0.110, IPAddress:10.0.0.111} LastLogin : LunMappings : {TargetName:iSCSITarget01;VHD:"C:\iSCSIDisk\Disk01.vhdx";LUN:0} MaxBurstLength : 262144 MaxReceiveDataSegmentLength : 65536 ReceiveBufferCount : 10 ReverseChapUserName : Sessions : {} Status : NotConnected TargetIqn : iqn.1991-05.com.microsoft:rx-7-iscsitarget01-target TargetName : iSCSITarget01 # confirm settings PS C:\Users\Administrator> Get-IscsiServerTarget -TargetName "iSCSITarget01" ChapUserName : username ClusterGroupName : ComputerName : RX-7.srv.world Description : EnableChap : True EnableReverseChap : False EnforceIdleTimeoutDetection : True FirstBurstLength : 65536 IdleDuration : 00:40:38 InitiatorIds : {IPAddress:10.0.0.110, IPAddress:10.0.0.111} LastLogin : LunMappings : {TargetName:iSCSITarget01;VHD:"C:\iSCSIDisk\Disk01.vhdx";LUN:0} MaxBurstLength : 262144 MaxReceiveDataSegmentLength : 65536 ReceiveBufferCount : 10 ReverseChapUserName : Sessions : {} Status : NotConnected TargetIqn : iqn.1991-05.com.microsoft:rx-7-iscsitarget01-target TargetName : iSCSITarget01 # restart service PS C:\Users\Administrator> Restart-Service -Name WinTarget |