Saturday 30 July 2016

RHCE 7 Exam Practice with Solution Part-2 (EX 300)

7) Link Aggregation:-

--->configure your serverX and DesktopX which watches for link changes and selects on active port for data transfors.
--->ServerX should have the address as 192.168.0.100/255.255.255.0
--->DesktopX should have the address as 192.168.0.100/255.255.255.0

Solution:

[root@server7 ~]#nmcli connection show
[root@server7 ~]#nmcli connection add con-name team0 type team ifname team0 config '{"runner":{"name":"activebackup"}}'
[root@server7 ~]#teamdctl team0 state [Default is round robin here we are going to setup active backup]
[root@server7 ~]#nmcli connection modify team0 ipv4.addresses 192.168.0.100/24 ipv4.method static
[root@server7 ~]#nmcli connection down team0 ;nmcli connection up team0
[root@server7 ~]#nmcli connection add con-name team0-port1 type team-slave ifname eno33554992 master team0
[root@server7 ~]#teamdctl team0 state
[root@server7 ~]#nmcli connection add con-name team0-port2 type team-slave ifname eno50332216 master team0
[root@server7 ~]#teamdctl team0 state
[root@server7 ~]#ifdown eno33554992
[root@server7 ~]#teamdctl team0 state
[root@server7 ~]#nmcli connection up eno33554992
[root@server7 ~]#nmcli connection up team0-port1
[root@server7 ~]#teamdctl team0 state
[root@server7 ~]#nmcli connection down team0-port2
[root@server7 ~]#teamdctl team0 state
[root@server7 ~]#nmcli connection up team0-port2
[root@server7 ~]#nmcli teamdctl team0 state

Note : Do ping command ping 192.168.0.254 -t from another terminal to check status

Do the same for desktop machine also....

8) SMTP configuration

--->configure the SMTP mail service on serverX and desktopX which only reply mail from local system through station.network0.example.com
--->all outgoing mail have ther sender domain at example.com ensure that mail should not store locally.
--->Verify the mail server is woring by sender mail to a sirat user.

Solution:

[root@server7 ~]#yum install postfix
[root@server7 ~]#systemctl enable postfix
[root@server7 ~]#systemctl start postfix

--Allow smtp port into firewall---

[root@server7 ~]firewall-cmd --permanent --add-service=smtp
[root@server7 ~]firewall-cmd --reload
[root@server7 ~]firewall-cmd --list-ports
[root@server7 ~]vim /etc/postfix/main.conf

inet_interface=localhost
mydestination=
myorigin=example.com
relayhost=[station.network0.example.com]
mynetworks=127.0.0.0/8,[::1]/128
local_transport=error:local delivery disabled

[root@server7 ~]#systemctl start postfix
[root@server7 ~]#useradd sirat
[root@server7 ~]#mail -V sirat@server7.example.com   [send a test mail to sirat user]

[root@server7 ~]#tail -f /var/log/maillog [check mail status]

17) script

--->create a script on serverX called /root/random with the following details
--->when run as /root/random Postconf, should bring the output as "Postroll"
--->when run as /root/random Postroll, should bring the output as "Postconf"
--->when run with only other argument or wihout argument, should bring the stderr as
"/root/random Postconf | Postroll"

Solution:

[root@server7 ~]#vim /root/random
#!/bin/bash
case $@ in
postconf ) echo "Postroll";;
Postroll ) echo "postconf";;
         *) echo "/root/random postconf | Postroll";;
esac

[root@server7 ~]#chmod a+x /root/random

18) script 

--->create a script on serverX called /root/createusers
--->when this script is called with the test file argument, it should add all the users from the file
--->downloaded the fire from http://station.network0.example.com/pub/testfile
--->all user should have the login shell as /bin/false, passwd not required.
--->when this script is called wih anyother argument, it should print the message "Input File Not Found"
--->When this script is run without any argument, it should dissplay "Usage "/root/createuser"
Note:- If the users are added no need to delete.

Solution:

#wget http://classroom.example.com/pub/testfile

[root@server7 ~]#vim /root/createusers

#!/bin/bash
a=""
case "$@" in
testfile ) for b in `cat testfile`
do
useradd -s /bin/false $b;
done;;
$a ) echo "Usage:/root/createusers";;
* ) echo "Input file Not Found";;
esac

[root@server7 ~]#chmod a+x /root/createusers


19) Configure SCSI storage. (Target CLI)

--->create a new 1 GB iscsi_block target on your serverX.example.com
--->The server should export on iscsi disk called iqn.2014.11.com.example.serverX.
--->This target should be only be available allowd to clients with an IQN of iqn.2014.11.com.example.desktopX.

Solution:

Server-Vm
--------
[root@server7 ~]#yum install targetcli* -y
[root@server7 ~]#systemctl enable target.service
[root@server7 ~]#systemctl start target.service
[root@server7 ~]#firewall-cmd --permanent --add-port=3260/tcp
[root@server7 ~]#firewall-cmd --reload
[root@server7 ~]#fdisk /dev/vdb   [Create 1GB new partition]
:n,:p,:1,:Enter,:+1G,:w
#partprobe /dev/vdb
#cat /proc/partitions
#targetcli
>ls
>cd /backstores/block
>create block1 /dev/vdb1
>cd /iscsi
>create iqn.2014-10.com.example:serverX
>cd /iscsi/iqn.2014-10.com.example/tpg1/acls
>create iqn.2014-10.com.example:desktopX
>cd /iscsi/iqn.2014-10.com.example/tpg1/luns
>create /backstore/block/block1
>cd /iscsi/iqn.2014-10.com.example/tpg1/portals
>create 172.25.X.11/3260      ------->( server ip)
>exit


#systemctl restart target.service

20) ISCSI initiator
-The serverX.example.com provides an iscsi port (3260). connect the disk with desktopX.example.com
and configure filesystem with the following requirements,
-create 800MB partition on ISCSI blcok device and assign the filesystem as xfs.
-Mount the volume under /mnt/initiator at the system boot time.
The filesystem should contain the copy of http://classroom.example.com/pub/iscsi.txt
The file should be owned by root with 0644 permission Note: don't modify the content.

Desktop-Vm
----------
[root@server7 ~]#yum install iscsi-initiator-utils -y
[root@server7 ~]#systemctl enable iscsi.service iscsid.service
[root@server7 ~]#systemctl start iscsi.service iscsid.service

[root@server7 ~]#vim /etc/iscsi/initiatorname.iscsi
InitiatorName=iqn.2014-10.com.example:desktopX

:wq

[root@server7 ~]#systemctl restart iscsi.service iscsid.service

[root@server7 ~]#systemctl start iscsi.service
[root@server7 ~]#systemctl start iscsid.service

man iscsiadm -- search with /examples and take discoverydb and login commands and modify the ipaddress.

[root@server7 ~]#iscsiadm --mode discoverydb --type sendtargets --portal 172.25.11.11 --discover
[root@server7 ~]#iscsiadm --mode node --targetname iqn.2014-06.com.example:server11 --portal 172.25.11.11:3260 --login
cat /proc/partitions
[root@server7 ~]#fdisk /dev/sdc
n,p,1,Enter,+200M,w
[root@server7 ~]#partprobe /dev/sdc
[root@server7 ~]#blkid
[root@server7 ~]#vim /etc/fstab
UUID= /media ext4 _netdev 0 0
:wq
=================

1 comment:

  1. Jadwal Daftar Sabung Ayam SV388 15 Februari 2019 di Situs Judi Sabung Ayam Online Melalui Agen Resmi Taruhan Sabung Ayam Live Asli Thailand.

    Jumat, Banten 15 Februari 2019 – Pada Hari Tersebut Akan Di Laksanakan Berbagai Pertandingan Sabung Ayam Secara Live di Arena Sabung Ayam Thailand.

    Untuk Info Lebih Lanjut Bisa Hub kami Di :
    wechat : bolavita
    line : cs_bolavita
    whatsapp : +628122222995
    BBM: BOLAVITA

    ReplyDelete