RHCE EX300 exam: Configure an iSCSI target (server) on Red Hat Enterprise Linux
---
Our given task is:
Configure an iSCSI target.
Configure system1 to provide an iSCSI disk device named iqn.2017-04.com.example.domain9:system1 as follows.
The iSCSI service uses port 3260.
The target uses a 3GiB backing logical volume named iscsi_vol
The target is only available to system2.domain9.example.com only.
---
On your RHCE exam SELinux must be set to Enforcing mode and firewall must be running. So we will verify SELinux mode with command:
getenforce
We will check if firewall is running with command:
systemctl status firewalld
First we have to install targetcli package:
yum install -y targetcli
We have to enable target service to start automatically after reboot. If we don't enable target service to start automatically – our iSCSI target configuration will be not red after the reboot and all configuration done before reboot won't be effective.
So we have to enable target service with command:
systemctl enable target
It is very important that target service starts automatically so we will double-check it with command:
systemctl is-enabled target
Now we will start target service with command:
systemctl start target.
We have to open iSCSI port 3260 so we will add a permanent rule which will be effective after reboot:
firewall-cmd --permanent --add-port=3260/tcp
To activate this permanent rule in runtime environment we will use command:
firewall-cmd --reload
We will double-check if port 3260 was opened in current runtime environment with command:
firewall-cmd --list-all
To create additional partition I will use fdisk command. You can use different disk partitioning tool like parted for example.
fdisk /dev/vdb
Now we will use our new disk partition vdb6 for a new volume group which we will create using vgcreate command.
vgcreate iscsivg /dev/vdb6
We will create requested 3 Gibibytes logical volume iscsi_vol with command:
lvcreate -L 3G -n iscsi_vol iscsivg
where:
-L 3G will set the size of the logical volume to three Gibibytes
-n iscsi_vol will set the name of the logical volume to iscsi_vol
We will review new logical volume iscsi_vol with command:
lvdisplay iscsivg/iscsi_vol
Now we are ready to configure iSCSI target.
We will use targetcli tool.
targetcli
cd
--go to block under backstores
create disk_iscsi_vol /dev/iscsivg/iscsi_vol
cd
--go to iscsi
create iqn.2017-04.com.example.domain9:system1
Default portal listening on all IPs which is portal 0.0.0.0 on port 3260 was created. We will remove this portal later because we want our iSCSI service to listen only on interface with IP address 172.24.9.10 which is on the same network like system2.domain9.example.com server.
cd
--go to acls
under tpg1 which is under iqn.2017-04.com.example.domain9:system1 which is under iscsi
create iqn.2017-04.com.example.domain9:system2
cd
--go to luns
under tpg1 which is under iqn.2017-04.com.example.domain9:system1 which is under iscsi
create /backstores/block/disk_iscsi_vol
cd
--go to portals
under tpg1 which is under iqn.2017-04.com.example.domain9:system1 which is under iscsi
ls
And we will delete default portal 0.0.0.0 3260 because we don't want our iSCSI service to listen on all IP addresses.
delete 0.0.0.0 3260
create portal 172.24.9.10 3260 so our iSCSI service will listen only on IP address 172.24.9.10 and port 3260
create 172.24.9.10 3260
cd
--go to root to run saveconfig command.
saveconfig
Exit targetcli tool.
exit
Double-check time stamp of target configuration file if it was updated with current configuration.
ls -l /etc/target/saveconfig.json
We will check if iSCSI service is listening on port 3260 with netstat command. To use netstat command we have to first install net-tools package with command:
yum install -y net-tools
Once net-tools package is installed we will use netstat command to check if iSCSI service is listening on port 3260.
netstat -an | grep -w LISTEN
On your RHCE exam your systems will be graded after reboot so I recommend to you to reboot your server on your RHCE exam and double-check if target configuration is okay also after reboot.
Related Video Tutorials:
RHCE EX300 Exam:
RHCE EX300 exam: Configure an iSCSI initiator on Red Hat Enterprise Linux
• RHCE EX300 exam: Configure an iSCSI initia...
RHCSA Fast Track course:
Reset forgotten root password in Redhat 7:
• Reset forgotten root password in Redhat 7
Setting up network using a NetworkManager command line interface (nmcli) in Red Hat 7
• Setting up network using a NetworkManager ...
nmcli cheat! Setting up network using nmcli in Red Hat 7 in less than a 30 seconds - QUICK & EASY!!!
• nmcli cheat! Setting up network using nmcl...
Shrink ext2 ext3 and ext4 file system and reduce the size of a logical volume with only one command.
• Shrink ext2 ext3 and ext4 file system and ...
Complete guide to file system shrinking and reducing the size of the underlying logical volume.
• Complete guide to file system shrinking an...