Configuring an iSCSI SAN
Setting Up the iSCSI Target
In this exercise, you set up
an iSCSI target on server1. This exercise assumes that on server1 that you have
an LVM volume group available with the name vgsan. Within the volume group, you
need free disk space that allows you to create two LVM logical volumes.
1.
Open a root shell on server1. Type vgs to verify the name
of the LVM volume group and the amount of available disk space. If you do not
have a volume group with available disk space, you should create a volume group
first.
1. Open a root shell on server1. Type vgs to verify the name of the LVM volume group and the amount of available disk space. If you do not have a volume group with available disk space, you should create a volume group first.
[root@ipa ~]# cat /proc/partitions
major minor #blocks name 8 0 20971520 sda 8 1 512000 sda1 8 2 20458496 sda2 8 16 5242880 sdb 11 0 3655680 sr0 253 0 18358272 dm-0 253 1 2097152 dm-1 [root@ipa ~]# vgcreate vgsan /dev/sdb Physical volume "/dev/sdb" successfully created Volume group "vgsan" successfully created [root@ipa ~]# pvs PV VG Fmt Attr PSize PFree /dev/sda2 rhel_rhelserver lvm2 a-- 19.51g 0 /dev/sdb vgsan lvm2 a-- 5.00g 5.00g [root@ipa ~]# vgs VG #PV #LV #SN Attr VSize VFree rhel_rhelserver 1 2 0 wz--n- 19.51g 0 vgsan 1 0 0 wz--n- 5.00g 5.00g |
2. Type lvcreate -L 200M -n lvsan1 /dev/vgsan and lvcreate -L 200M -n lvsan2 /dev/vgsan to provide the backing storage needed for setting up your iSCSI target.
[root@ipa
~]# lvcreate -L 200M -n lvsan1 /dev/vgsan
Logical volume "lvsan1" created [root@ipa ~]# lvcreate -L 200M -n lvsan2 /dev/vgsan Logical volume "lvsan2" created [root@ipa ~]# lvs LV VG Attr LSize Pool Origin Data% Move Log Cpy%Sync Convert root rhel_rhelserver -wi-ao---- 17.51g swap rhel_rhelserver -wi-ao---- 2.00g lvsan1 vgsan -wi-a----- 200.00m lvsan2 vgsan -wi-a----- 200.00m |
3. Enter yum -y install targetcli .
[root@ipa ~]# yum -y install targetcli
Loaded plugins: langpacks, product-id, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. Resolving Dependencies --> Running transaction check ---> Package targetcli.noarch 0:2.1.fb34-1.el7 will be installed --> Processing Dependency: python-rtslib >= 2.1.fb41 for package: targetcli-2.1.fb34-1.el7.noarch --> Processing Dependency: python-configshell for package: targetcli-2.1.fb34-1.el7.noarch --> Running transaction check ---> Package python-configshell.noarch 1:1.1.fb11-3.el7 will be installed --> Processing Dependency: python-urwid for package: 1:python-configshell-1.1.fb11-3.el7.noarch --> Processing Dependency: pyparsing for package: 1:python-configshell-1.1.fb11-3.el7.noarch ---> Package python-rtslib.noarch 0:2.1.fb46-1.el7 will be installed --> Processing Dependency: python-kmod for package: python-rtslib-2.1.fb46-1.el7.noarch --> Running transaction check ---> Package pyparsing.noarch 0:1.5.6-9.el7 will be installed ---> Package python-kmod.x86_64 0:0.9-4.el7 will be installed ---> Package python-urwid.x86_64 0:1.1.1-3.el7 will be installed --> Finished Dependency ResolutionDependencies Resolved ========================================================================================================================================================================================= Package Arch Version Repository Size ========================================================================================================================================================================================= Installing: targetcli noarch 2.1.fb34-1.el7 myrepo 55 k Installing for dependencies: pyparsing noarch 1.5.6-9.el7 myrepo 94 k python-configshell noarch 1:1.1.fb11-3.el7 myrepo 64 k python-kmod x86_64 0.9-4.el7 myrepo 57 k python-rtslib noarch 2.1.fb46-1.el7 myrepo 75 k python-urwid x86_64 1.1.1-3.el7 myrepo 654 k Transaction Summary ========================================================================================================================================================================================= Install 1 Package (+5 Dependent packages)Total download size: 998 k Installed size: 3.9 M Downloading packages: ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Total 3.7 MB/s | 998 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : python-kmod-0.9-4.el7.x86_64 1/6 Installing : python-rtslib-2.1.fb46-1.el7.noarch 2/6 Installing : pyparsing-1.5.6-9.el7.noarch 3/6 Installing : python-urwid-1.1.1-3.el7.x86_64 4/6 Installing : 1:python-configshell-1.1.fb11-3.el7.noarch 5/6 Installing : targetcli-2.1.fb34-1.el7.noarch 6/6 Verifying : python-rtslib-2.1.fb46-1.el7.noarch 1/6 Verifying : python-urwid-1.1.1-3.el7.x86_64 2/6 Verifying : targetcli-2.1.fb34-1.el7.noarch 3/6 Verifying : 1:python-configshell-1.1.fb11-3.el7.noarch 4/6 Verifying : pyparsing-1.5.6-9.el7.noarch 5/6 Verifying : python-kmod-0.9-4.el7.x86_64 6/6 Installed: targetcli.noarch 0:2.1.fb34-1.el7 Dependency Installed: pyparsing.noarch 0:1.5.6-9.el7 python-configshell.noarch 1:1.1.fb11-3.el7 python-kmod.x86_64 0:0.9-4.el7 python-rtslib.noarch 0:2.1.fb46-1.el7 python-urwid.x86_64 0:1.1.1-3.el7 Complete! [root@ipa ~]# |
3.
Type targetcli . This opens the targetcli interface, which
looks like a shell prompt. Type ls to show the default interface (see
Figure below )
[root@ipa ~]# targetcli
Warning: Could not load preferences file /root/.targetcli/prefs.bin. targetcli shell version 2.1.fb34 Copyright 2011-2013 by Datera, Inc and others. For help on commands, type 'help'./> ls o- / ......................................................................................................................... [...] o- backstores .............................................................................................................. [...] | o- block .................................................................................................. [Storage Objects: 0] | o- fileio ................................................................................................. [Storage Objects: 0] | o- pscsi .................................................................................................. [Storage Objects: 0] | o- ramdisk ................................................................................................ [Storage Objects: 0] o- iscsi ............................................................................................................ [Targets: 0] o- loopback ......................................................................................................... [Targets: 0] /> |
5. The first step in setting up an iSCSI target is
configuring the backstore. Type cd /backstores to enter the backstores
branch of targetcli, which allows you to specify which backing storage is going
to be used.
6. Type block/ create block1 /dev/vgsan/lvsan1. This assigns the LVM logical volume that you have created earlier as the backstore in the iSCSI target.
Repeat for lvsan2 by typing block/
create block2 /dev/vgsan/lvsan2 . Notice the way the command works; it
starts with block/ , which brings you to the contents of the directory
/block, and from there the create commands are issued.
Also notice that despite the
fact that you are using the create command, it does not really create
the backing storage device; it assigns an already existing storage device as
the backing storage.
/> cd backstores/
/backstores> block/ create block1 /dev/vgsan/lvsan1 Created block storage object block1 using /dev/vgsan/lvsan1. /backstores> block/ create block2 /dev/vgsan/lvsan2 Created block storage object block2 using /dev/vgsan/lvsan2. |
7. Now let’s create a file-backed block device as
well: fileio/ create file1 /root/diskfile1 100M . This command creates a
sparse file with a size of 100 MiB and assigns it as a backing storage device.
/backstores> fileio/ create file1 /root/diskfile1
100M
Created fileio file1 with size 104857600 |
8. At this time, type ls to get an overview of
the current configuration. It should look like Figure 26.3 and show you two
block devices and one file-backed storage device.
/backstores> ls
o- backstores ................................................................................................................ [...] o- block .................................................................................................... [Storage Objects: 2] | o- block1 ................................................................ [/dev/vgsan/lvsan1 (200.0MiB) write-thru deactivated] | o- block2 ................................................................ [/dev/vgsan/lvsan2 (200.0MiB) write-thru deactivated] o- fileio ................................................................................................... [Storage Objects: 1] | o- file1 ................................................................... [/root/diskfile1 (100.0MiB) write-back deactivated] o- pscsi .................................................................................................... [Storage Objects: 0] o- ramdisk .................................................................................................. [Storage Objects: 0] /backstores> |
9. Now that the block backstores are taken care of, you can start configuring the unique identifier for your iSCSI target, the iSCSI IQN, which will also create the default TGP. To start, use cd /iscsi/ to get to the iscsi branch of the configuration.
/backstores> cd /
/> cd iscsi /iscsi> ls o- iscsi .............................................................................................................. [Targets: 0] /iscsi> |
10. Now type create iqn.2015-04.com.example:target to create the IQN. Notice that the name of the IQN starts with year-month (in YY-MM notation) and is followed by the inversed DNS domain name. Make sure you respect this naming standard; otherwise, the IQN will not be created.
/iscsi> create
iqn.2015-12.com.example:target
Created target iqn.2015-12.com.example:target. Created TPG 1. |
TIP Notice that the IQN naming standard is very
strict. If you specify the month as one digit instead of two, for instance,
you’ll get a “WWN not valid” message,and creation will fail!
11. Type ls . This shows the contents of the
iscsi branch, where you now see the IQN you just created, as well as the TPG
tpg1 that was created automatically while creating the IQN (see Figure ).
/iscsi> ls
o- iscsi .............................................................................................................. [Targets: 1] o- iqn.2015-12.com.example:target ...................................................................................... [TPGs: 1] o- tpg1 ................................................................................................. [no-gen-acls, no-auth] o- acls ............................................................................................................ [ACLs: 0] o- luns ............................................................................................................ [LUNs: 0] o- portals ...................................................................................................... [Portals: 0] /iscsi> |
12. At this point, you can create an ACL in the TPG. Remember, you need to create ACLs as well to access the iSCSI target, because without ACLs, any iSCSI initiator will be denied access. Any new LUN that you create will be mapped to each ACL that is associated with the TPG. This is because of the auto_add_mapped_luns feature, which is on by default. To create the ACL, first enter the IQN that you just created. Type cd iqn.[Tab] to enter the IQN. Notice that in the cd command, you are using the Tab key for command-line completion.
/iscsi> cd
iqn.2015-12.com.example:target/
/iscsi/iqn.20...xample:target> ls o- iqn.2015-12.com.example:target ........................................................................................ [TPGs: 1] o- tpg1 ................................................................................................... [no-gen-acls, no-auth] o- acls .............................................................................................................. [ACLs: 0] o- luns .............................................................................................................. [LUNs: 0] o- portals ........................................................................................................ [Portals: 0] /iscsi/iqn.20...xample:target> |
13. Now type tpg1/acls/ create iqn.2015-04.com.example:server1 , which creates a node ACL that allows server1 to access the IQN you just created. In this command, the initiatorname as used in /etc/iscsi/initiatorname.iscsi on the iSCSI initiator server is used. After completing this procedure, make sure that the contents of this file on the iSCSI initiatorname matches. (See also the section “Setting the Initiatorname” later in this chapter for more details.) If so required, repeat this command for all other iSCSI initiators that need access to this iSCSI target.
/iscsi/iqn.20...xample:target> cd
tpg1/
/iscsi/iqn.20...e:target/tpg1> acls/ create iqn.2015-12.com.example:server1 Created Node ACL for iqn.2015-12.com.example:server1 |
14. Now that you have created the ACL, you need to create the LUNs. The LUNs are needed to associate a block device with a specific TPG. To do this, type the following commands:
tpg1/luns/ create /backstores/block/block1
tpg1/luns/ create
/backstores/block/block2
tpg1/luns/ create
/backstores/fileio/file1
/iscsi/iqn.20...e:target/tpg1> luns/
create /backstores/block/block1
Created LUN 0. Created LUN 0->0 mapping in node ACL iqn.2015-12.com.example:server1 /iscsi/iqn.20...e:target/tpg1> luns/ create /backstores/block/block2 Created LUN 1. Created LUN 1->1 mapping in node ACL iqn.2015-12.com.example:server1 /iscsi/iqn.20...e:target/tpg1> luns/ create /backstores/fileio/file1 Created LUN 2. Created LUN 2->2 mapping in node ACL iqn.2015-12.com.example:server1 /iscsi/iqn.20...e:target/tpg1> |
TIP While creating LUNs, you can specify additional
parameters. For instance, from the tpg1/luns/ context, type create
lun=10 storage_object=/backstores/block/block1 to assign the LUN number 10
to the backing storage device that is specified.
15. Type ls to verify what you have created so far. The result should look like below
/iscsi/iqn.20...e:target/tpg1>
ls
o- tpg1 ..................................................................................................... [no-gen-acls, no-auth] o- acls ................................................................................................................ [ACLs: 1] | o- iqn.2015-12.com.example:server1 ............................................................................ [Mapped LUNs: 3] | o- mapped_lun0 ...................................................................................... [lun0 block/block1 (rw)] | o- mapped_lun1 ...................................................................................... [lun1 block/block2 (rw)] | o- mapped_lun2 ...................................................................................... [lun2 fileio/file1 (rw)] o- luns ................................................................................................................ [LUNs: 3] | o- lun0 ..................................................................................... [block/block1 (/dev/vgsan/lvsan1)] | o- lun1 ..................................................................................... [block/block2 (/dev/vgsan/lvsan2)] | o- lun2 ....................................................................................... [fileio/file1 (/root/diskfile1)] o- portals .......................................................................................................... [Portals: 0] /iscsi/iqn.20...e:target/tpg1> |
16. At this point, you can create the portal. This
connects the iSCSI configuration to the specific IP address on the iSCSI target
server. To make this work, you need to ensure that the iSCSI target is on a
fixed IP address. If that IP address is 192.168.4.210, the command to use is tpg1/portals/
create 192.168.4.210 .
Notice that this step is
required only if you want to have the iSCSI target offering its services on
only a specific IP address. If you do not create a portal, a default portal is
used that binds to the IP address 0.0.0.0, which represents all IP addresses on
your server.
/iscsi/iqn.20...e:target/tpg1> portals/
create 192.168.122.202
Using default IP port 3260 Created network portal 192.168.122.202:3260. |
17. The configuration has now completed. Get back to
the root of the configuration tree by using cd / and type ls to
get a complete overview of the configuration.
It should look like Figure.
You can now type exit to close the configuration interface. This
automatically writes the configuration file.
/iscsi/iqn.20...e:target/tpg1> ls
o- tpg1 ..................................................................................................... [no-gen-acls, no-auth] o- acls ................................................................................................................ [ACLs: 1] | o- iqn.2015-12.com.example:server1 ............................................................................ [Mapped LUNs: 3] | o- mapped_lun0 ...................................................................................... [lun0 block/block1 (rw)] | o- mapped_lun1 ...................................................................................... [lun1 block/block2 (rw)] | o- mapped_lun2 ...................................................................................... [lun2 fileio/file1 (rw)] o- luns ................................................................................................................ [LUNs: 3] | o- lun0 ..................................................................................... [block/block1 (/dev/vgsan/lvsan1)] | o- lun1 ..................................................................................... [block/block2 (/dev/vgsan/lvsan2)] | o- lun2 ....................................................................................... [fileio/file1 (/root/diskfile1)] o- portals .......................................................................................................... [Portals: 1] o- 192.168.122.202:3260 ................................................................................................... [OK] /iscsi/iqn.20...e:target/tpg1> /iscsi/iqn.20...e:target/tpg1> exit Global pref auto_save_on_exit=true Last 10 configs saved in /etc/target/backup. Configuration saved to /etc/target/saveconfig.json [root@ipa ~]# |
At this point, the iSCSI target configuration is written, but the target is not yet operational. The configuration is written to the file /etc/target/saveconfig.json.
This is a file in the Java
JSON format and is not really meant to be edited directly.
While you are saving the
configuration, the iSCSI target service is also started automatically and
listening on port 3260 of the specified portal IP address. Below shows partial contents of the JSON
file.
[root@ipa target]# cat saveconfig.json
{ "fabric_modules": [], "storage_objects": [ { "attributes": { "block_size": 512, "emulate_dpo": 0, "emulate_fua_read": 0, "emulate_fua_write": 1, "emulate_model_alias": 1, "emulate_rest_reord": 0, "emulate_tas": 1, "emulate_tpu": 0, "emulate_tpws": 0, "emulate_ua_intlck_ctrl": 0, "emulate_write_cache": 1, "enforce_pr_isids": 1, "fabric_max_sectors": 8192, "is_nonrot": 0, "max_unmap_block_desc_count": 1, "max_unmap_lba_count": 8192, "max_write_same_len": 4096, "optimal_sectors": 8192, "queue_depth": 128, "unmap_granularity": 1, "unmap_granularity_alignment": 0 }, "dev": "/root/diskfile1", "name": "file1", "plugin": "fileio", "size": 104857600, "write_back": true, "wwn": "ae31590d-dd09-4ecb-9e49-ca20bf159c34" }, { "attributes": { "block_size": 512, "emulate_dpo": 0, "emulate_fua_read": 0, "emulate_fua_write": 1, "emulate_model_alias": 1, "emulate_rest_reord": 0, "emulate_tas": 1, "emulate_tpu": 0, "emulate_tpws": 0, "emulate_ua_intlck_ctrl": 0, "emulate_write_cache": 0, "enforce_pr_isids": 1, "fabric_max_sectors": 8192, "is_nonrot": 0, "max_unmap_block_desc_count": 0, "max_unmap_lba_count": 0, "max_write_same_len": 65535, "optimal_sectors": 8192, "queue_depth": 128, "unmap_granularity": 0, "unmap_granularity_alignment": 0 }, "dev": "/dev/vgsan/lvsan2", "name": "block2", "plugin": "block", "readonly": false, "write_back": false, "wwn": "04910112-b6b8-4ae9-a8a3-b676d44d2036" }, { "attributes": { "block_size": 512, "emulate_dpo": 0, "emulate_fua_read": 0, "emulate_fua_write": 1, "emulate_model_alias": 1, "emulate_rest_reord": 0, "emulate_tas": 1, "emulate_tpu": 0, "emulate_tpws": 0, "emulate_ua_intlck_ctrl": 0, "emulate_write_cache": 0, "enforce_pr_isids": 1, "fabric_max_sectors": 8192, "is_nonrot": 0, "max_unmap_block_desc_count": 0, "max_unmap_lba_count": 0, "max_write_same_len": 65535, "optimal_sectors": 8192, "queue_depth": 128, "unmap_granularity": 0, "unmap_granularity_alignment": 0 }, "dev": "/dev/vgsan/lvsan1", "name": "block1", "plugin": "block", "readonly": false, "write_back": false, "wwn": "c1646d01-c82d-46b6-bd37-304584882d02" } ], "targets": [ { "fabric": "iscsi", "tpgs": [ { "attributes": { "authentication": 0, "cache_dynamic_acls": 0, "default_cmdsn_depth": 16, "demo_mode_write_protect": 1, "generate_node_acls": 0, "login_timeout": 15, "netif_timeout": 2, "prod_mode_write_protect": 0 }, "enable": true, "luns": [ { "index": 2, "storage_object": "/backstores/fileio/file1" }, { "index": 1, "storage_object": "/backstores/block/block2" }, { "index": 0, "storage_object": "/backstores/block/block1" } ], "node_acls": [ { "attributes": { "dataout_timeout": 3, "dataout_timeout_retries": 5, "default_erl": 0, "nopin_response_timeout": 30, "nopin_timeout": 15, "random_datain_pdu_offsets": 0, "random_datain_seq_offsets": 0, "random_r2t_offsets": 0 }, "mapped_luns": [ { "index": 2, "tpg_lun": 2, "write_protect": false }, { "index": 1, "tpg_lun": 1, "write_protect": false }, { "index": 0, "tpg_lun": 0, "write_protect": false } ], "node_wwn": "iqn.2015-12.com.example:server1" } ], "parameters": { "AuthMethod": "CHAP,None", "DataDigest": "CRC32C,None", "DataPDUInOrder": "Yes", "DataSequenceInOrder": "Yes", "DefaultTime2Retain": "20", "DefaultTime2Wait": "2", "ErrorRecoveryLevel": "0", "FirstBurstLength": "65536", "HeaderDigest": "CRC32C,None", "IFMarkInt": "2048~65535", "IFMarker": "No", "ImmediateData": "Yes", "InitialR2T": "Yes", "MaxBurstLength": "262144", "MaxConnections": "1", "MaxOutstandingR2T": "1", "MaxRecvDataSegmentLength": "8192", "MaxXmitDataSegmentLength": "262144", "OFMarkInt": "2048~65535", "OFMarker": "No", "TargetAlias": "LIO Target" }, "portals": [ { "ip_address": "192.168.122.202", "iser": false, "port": 3260 } ], "tag": 1 } ], "wwn": "iqn.2015-12.com.example:target" } ] } [root@ipa target]# cat /etc/target/saveconfig.json { "fabric_modules": [], "storage_objects": [ { "attributes": { "block_size": 512, "emulate_dpo": 0, "emulate_fua_read": 0, "emulate_fua_write": 1, "emulate_model_alias": 1, "emulate_rest_reord": 0, "emulate_tas": 1, "emulate_tpu": 0, "emulate_tpws": 0, "emulate_ua_intlck_ctrl": 0, "emulate_write_cache": 1, "enforce_pr_isids": 1, "fabric_max_sectors": 8192, "is_nonrot": 0, "max_unmap_block_desc_count": 1, "max_unmap_lba_count": 8192, "max_write_same_len": 4096, "optimal_sectors": 8192, "queue_depth": 128, "unmap_granularity": 1, "unmap_granularity_alignment": 0 }, "dev": "/root/diskfile1", "name": "file1", "plugin": "fileio", "size": 104857600, "write_back": true, "wwn": "ae31590d-dd09-4ecb-9e49-ca20bf159c34" }, { "attributes": { "block_size": 512, "emulate_dpo": 0, "emulate_fua_read": 0, "emulate_fua_write": 1, "emulate_model_alias": 1, "emulate_rest_reord": 0, "emulate_tas": 1, "emulate_tpu": 0, "emulate_tpws": 0, "emulate_ua_intlck_ctrl": 0, "emulate_write_cache": 0, "enforce_pr_isids": 1, "fabric_max_sectors": 8192, "is_nonrot": 0, "max_unmap_block_desc_count": 0, "max_unmap_lba_count": 0, "max_write_same_len": 65535, "optimal_sectors": 8192, "queue_depth": 128, "unmap_granularity": 0, "unmap_granularity_alignment": 0 }, "dev": "/dev/vgsan/lvsan2", "name": "block2", "plugin": "block", "readonly": false, "write_back": false, "wwn": "04910112-b6b8-4ae9-a8a3-b676d44d2036" }, { "attributes": { "block_size": 512, "emulate_dpo": 0, "emulate_fua_read": 0, "emulate_fua_write": 1, "emulate_model_alias": 1, "emulate_rest_reord": 0, "emulate_tas": 1, "emulate_tpu": 0, "emulate_tpws": 0, "emulate_ua_intlck_ctrl": 0, "emulate_write_cache": 0, "enforce_pr_isids": 1, "fabric_max_sectors": 8192, "is_nonrot": 0, "max_unmap_block_desc_count": 0, "max_unmap_lba_count": 0, "max_write_same_len": 65535, "optimal_sectors": 8192, "queue_depth": 128, "unmap_granularity": 0, "unmap_granularity_alignment": 0 }, "dev": "/dev/vgsan/lvsan1", "name": "block1", "plugin": "block", "readonly": false, "write_back": false, "wwn": "c1646d01-c82d-46b6-bd37-304584882d02" } ], "targets": [ { "fabric": "iscsi", "tpgs": [ { "attributes": { "authentication": 0, "cache_dynamic_acls": 0, "default_cmdsn_depth": 16, "demo_mode_write_protect": 1, "generate_node_acls": 0, "login_timeout": 15, "netif_timeout": 2, "prod_mode_write_protect": 0 }, "enable": true, "luns": [ { "index": 2, "storage_object": "/backstores/fileio/file1" }, { "index": 1, "storage_object": "/backstores/block/block2" }, { "index": 0, "storage_object": "/backstores/block/block1" } ], "node_acls": [ { "attributes": { "dataout_timeout": 3, "dataout_timeout_retries": 5, "default_erl": 0, "nopin_response_timeout": 30, "nopin_timeout": 15, "random_datain_pdu_offsets": 0, "random_datain_seq_offsets": 0, "random_r2t_offsets": 0 }, "mapped_luns": [ { "index": 2, "tpg_lun": 2, "write_protect": false }, { "index": 1, "tpg_lun": 1, "write_protect": false }, { "index": 0, "tpg_lun": 0, "write_protect": false } ], "node_wwn": "iqn.2015-12.com.example:server1" } ], "parameters": { "AuthMethod": "CHAP,None", "DataDigest": "CRC32C,None", "DataPDUInOrder": "Yes", "DataSequenceInOrder": "Yes", "DefaultTime2Retain": "20", "DefaultTime2Wait": "2", "ErrorRecoveryLevel": "0", "FirstBurstLength": "65536", "HeaderDigest": "CRC32C,None", "IFMarkInt": "2048~65535", "IFMarker": "No", "ImmediateData": "Yes", "InitialR2T": "Yes", "MaxBurstLength": "262144", "MaxConnections": "1", "MaxOutstandingR2T": "1", "MaxRecvDataSegmentLength": "8192", "MaxXmitDataSegmentLength": "262144", "OFMarkInt": "2048~65535", "OFMarker": "No", "TargetAlias": "LIO Target" }, "portals": [ { "ip_address": "192.168.122.202", "iser": false, "port": 3260 } ], "tag": 1 } ], "wwn": "iqn.2015-12.com.example:target" } ] } [root@ipa target]# |
TIP As you have noticed, the procedure to configure an
iSCSI target is a long procedure that involves many steps. You might be
wondering how to memorize all of these steps for the exam. The secret is that
you should not try to memorize all the individual steps. Instead, you want to
see the global overview of what you have been doing. You started by creating
the backstores that provide the storage that the iSCSI target is sharing. Next
you created an IQN, which automatically created the TPG also. The third step
was to create ACLs to allow nodes to access the target, following which you
created the LUNs. While you were creating the LUNs, ACLs were assigned
automatically. The last step was to configure the portal and write the
configuration. There is not much to memorize here, because if you type ls in
the targetcli interface, all of these steps are listed in the order that you
should execute them.
TIP You can also study the man page of the targetcli
command to get some help on the iSCSI configuration on the exam. Notice,
however, that the QuickStart in this man page does not use authentication, so
no ACLs are created here. So if you want to use this man page on the exam, make
sure to study it well so that you know which information is available and which
is not available through this man page.
Finalizing the iSCSI Target Configuration
1. On server1, type systemctl start target followed
by systemctl enable target.
[root@ipa target]# systemctl start target
|
2. Type systemctl status target and verify that the target currently is active and that the status is set to enabled.
[root@ipa target]# systemctl status target
target.service - Restore LIO kernel target configuration Loaded: loaded (/usr/lib/systemd/system/target.service; disabled) Active: active (exited) since Mon 2015-12-28 11:12:19 IST; 12s ago Process: 5259 ExecStart=/usr/bin/targetctl restore (code=exited, status=0/SUCCESS) Main PID: 5259 (code=exited, status=0/SUCCESS)Dec 28 11:12:19 ipa.example.com systemd[1]: Starting Restore LIO kernel target configuration... Dec 28 11:12:19 ipa.example.com systemd[1]: Started Restore LIO kernel target configuration. [root@ipa target]# |
3. Open the firewall, using firewall-cmd --add-port=3260/tcp --permanent , followed by firewall-cmd --reload .
[root@ipa target]# firewall-cmd --add-port=3260/tcp --permanent
success [root@ipa target]# firewall-cmd --reload success |
4.
4. Type firewall-cmd --list-all to verify the firewall
configuration. The results should look like below .
[root@ipa target]# firewall-cmd --list-all
public (default, active) interfaces: eno16777736 sources: services: dhcpv6-client dns ftp http https kerberos kpasswd ldap ntp ssh ports: 514/tcp 3260/tcp masquerade: no forward-ports: icmp-blocks: rich rules: |
Thank you for reading.
For
Reading other article, visit to “https://sites.google.com/site/unixwikis/”
No comments:
Post a Comment