RHCSA Course Notes
Networking.¶
- Modifying Network interfaces under NetworkManager with Nmcli
- Show nmcli connections
- Modify
-
Assign gateway
-
Change Configuration method to manual
-
Modify DNS
-
Reset the connection
-
Assign Secondary IP with nmcli
-
Reload the connection
-
Nmtui creating interfaces options
-
Ethernet – Wired network connection (LAN).
-
Wi-Fi – Wireless network connection (WLAN).
-
Bridge – Joins multiple interfaces into one, often used for VMs or containers.
-
Bond – Combines multiple interfaces for redundancy or speed (link aggregation).
-
VLAN – Creates a virtual LAN tag over a physical interface.
-
VPN – Secure remote access via virtual private network.
-
DSL – Used for Digital Subscriber Line internet (older broadband tech).
-
Mobile Broadband – Connects via cellular network (3G/4G/5G).
-
Team – Similar to bond, but more flexible; used for NIC teaming.
-
-
Network files
- /etc/sysconfig/network-scripts
- /etc/hosts/
- /etc/resolve.conf
- /etc/nsswitch.conf
- Commands
- ping
- ifconfig or ip
- netstat
- traceroute
- tcpdump
- nslookup or dig
- ethtool
- Print date with python
RedHat Linux Repository setup. Subscription manager¶
- Checking list of repos with subscription-manager
- Select ones you need like baseos,appstream
- Enable the repos ( BaseOS and Appstream)
- Enable crb ( Codeready Builder for rhel) repo
subscription-manager repos --list | grep codeready Repo ID: codeready-builder-for-rhel-10-x86_64-eus-rpms Repo URL: https://cdn.redhat.com/content/eus/rhel10/$releasever/x86_64/codeready-builder/os Repo ID: codeready-builder-for-rhel-10-x86_64-eus-source-rpms Repo URL: https://cdn.redhat.com/content/eus/rhel10/$releasever/x86_64/codeready-builder/source/SRPMS Repo ID: codeready-builder-for-rhel-10-x86_64-debug-rpms Repo URL: https://cdn.redhat.com/content/dist/rhel10/$releasever/x86_64/codeready-builder/debug Repo ID: codeready-builder-for-rhel-10-x86_64-rpms Repo URL: https://cdn.redhat.com/content/dist/rhel10/$releasever/x86_64/codeready-builder/os Repo ID: codeready-builder-for-rhel-10-x86_64-eus-debug-rpms Repo URL: https://cdn.redhat.com/content/eus/rhel10/$releasever/x86_64/codeready-builder/debug Repo ID: codeready-builder-for-rhel-10-x86_64-source-rpms Repo URL: https://cdn.redhat.com/content/dist/rhel10/$releasever/x86_64/codeready-builder/source/SRPMS
Install Epel Release on Rhel
- Setting up at job - Listing the job and removing it-
removing the job with at -c [jobNumber]
-
Crontab and cronjob syntax. Check cronitor cli . at crontab.guru.
- Examples At every minute past every hour on every day-of-month from 5 through 10 and on every day-of-week from Monday through Friday.”
- Cronitor also has a dashboard for managing cronjobs.
- Run cronitor dash to configure credentials and then again to start the web UI.
cronitor dash
Starting Cronitor dashboard on port 9000...
Opening browser to http://localhost:9000...
Dashboard running on http://localhost:9000 (Press Ctrl+C to stop)
System tuning tuned.service¶
- List available profiles and current one
Process Priority alignment¶
- Nice and Renice priority levels
- Higher Priority from -20-19 to 0 from 0 to -> 18-20 Lowest Priority
- Top[PR] Priority - > RT -99 to -3 -2 -1 0 from 0 to 20 - 38 , 39
-
Summary
Nice value is user-space and priority PR is the processe's actual priority that is used by Linux kernel. In Linux system priorities are 0 to 139 in which 0 to 99 for real time and 100 139 for users
-
View linux priority through ps command
-
Set process priority (nice value)
-
Renice running process from command line and top
Open top press r and type the process ID, then hit Enter and enter the value from +19 to -20
Access control lists¶
I already have notes inhere -> https://docs.vladmin-dev.top/LinuxNotes/CompTIA/ACL/
Selinux¶
-
Disable SELINUX
-
Main concepts
- Labeling ( user )
- Type enforcement (level)
- List labels with -Z flag of ls
- list directory selinux type
- system_u - > user
- object_r -> role
- var_t -> type
- s0 -> Level
User home dir example
- Check Process's selinux policy with ps commandps axZ | grep httpd
system_u:system_r:httpd_t:s0 37571 ? Ss 0:00 /usr/sbin/httpd -DFOREGROUND
system_u:system_r:httpd_t:s0 37572 ? S 0:00 /usr/sbin/httpd -DFOREGROUND
system_u:system_r:httpd_t:s0 37573 ? Sl 0:00 /usr/sbin/httpd -DFOREGROUND
system_u:system_r:httpd_t:s0 37574 ? Sl 0:00 /usr/sbin/httpd -DFOREGROUND
system_u:system_r:httpd_t:s0 37575 ? Sl 0:00 /usr/sbin/httpd -DFOREGROUND
Command to manage SELinux¶
- semanage -> to label
- login
- user
- port
- interface
- module
- node
- file context
- boolean
- permissive state
- dontaudit What is Boolean?
- It is an On/Off switch to allow and block access
getsebool -aorsemanage boolean -lget all boolean rules- Enable or turn on a boolean
- Change the type in label
- Error messages recorded in journalctl
Examples¶
- List users
semanage user --list Labeling MLS/ MLS/ SELinux User Prefix MCS Level MCS Range SELinux Roles guest_u user s0 s0 guest_r root user s0 s0-s0:c0.c1023 system_r staff_r sysadm_r unconfined_r staff_u user s0 s0-s0:c0.c1023 system_r staff_r sysadm_r unconfined_r sysadm_u user s0 s0-s0:c0.c1023 sysadm_r system_u user s0 s0-s0:c0.c1023 system_r unconfined_r unconfined_u user s0 s0-s0:c0.c1023 system_r unconfined_r user_u user s0 s0 user_r xguest_u user s0 s0 xguest_r
Storage management¶
Logical Volume Management.¶
- Adding a disk and creating LVM partition.
- Use fdisk to create the partition
-
Then create physycal volume
-
Create the Volume Group
- Create the Logical Volume group
- It might return error for insufficient space. Then we use M format to create it as follows.
lvs
LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert
root rhel -wi-ao---- <26.00g
swap rhel -wi-ao---- 3.00g
test_lv test_vg -wi-a----- 4.88g
-
Make the filesystem
-
Remove the created vg , pv and lv
- Umount the disk - > umount /lvs_vol
- delete the logical volume then the volume group and the physical volume
The partition is now ready for extending an existing lvm
Manage and Extend disks¶
Extending a LVM group with another disk
- create the main physical volume group with disk 1 ->
pvcreate /dev/vdb1 - Create the Volume Group - >
vgcreate attached_vg /dev/vdb1 - Create the LVM group and configure the size (5GB disks are used) ->
lvcreate -n attach_lv --size 5000M attached_vg - Create the FileSystem - >
mkfs.xfs /dev/attached_vg/attach_lv - Create phsycal volume 2 >
pvcreate /dev/sda1 - Extend the Volumgroup ->
vgextend attached_vg /dev/sda1 - Extend the logical volume group to the max capacity ->
lvextend -l +100%FREE /dev/attached_vg/attach_lv - Grow the file system to maximum 10GB - For ext4 use resize2fs and for xfs use xfs_growfs ->
xfs_growfs /dev/attached_vg/attach_lv - Then mount the volume group to a folder ->
mount /dev/attached_vg/attach_lv /lvs_vol/
Advanced Storage Features¶
Stratis utility. Using storage pools to manage disks. Using thin provisioning providing dynamic allocation and more efficiency
The devices /dev/vdb and /dev/sda have been used in an lvm group which had their udev tags and metadata still reflecting the lvm group so it returnes this error
stratis pool create stratis-pool1 /dev/sda
Execution failed:
stratisd failed to perform the operation that you requested. It returned the following information via the D-Bus: ERROR: At least one of the devices specified was unsuitable for initialization: udev information indicates that device /dev/sda is a block device which appears to be owned.
Then we can create the pool
stratis pool list
Name Total / Used / Free Properties UUID Alerts
stratis-pool1 5 GiB / 526 MiB / 4.49 GiB ~Ca,~Cr, Op 98d0dfd7-2a72-4f99-98e3-34078655eff7 WS001
stratis pool list
Name Total / Used / Free Properties UUID Alerts
stratis-pool1 10 GiB / 532 MiB / 9.48 GiB ~Ca,~Cr, Op 98d0dfd7-2a72-4f99-98e3-34078655eff7
Once this is done we need to create the stratis pool's filesystem
stratis filesystem list
Pool Filesystem Total / Used / Free / Limit Device UUID
stratis-pool1 filesystem-1 1 TiB / 546 MiB / 1023.47 GiB / None /dev/stratis/stratis-pool1/filesystem-1 8ea3a262-565a-40c6-80a2-5d065f18548f
Now we can mount it to a folder. We are going to use the device path /dev/stratis/stratis-pool1/filesystem-1
The lsblk command output will look like this
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
sda 8:0 0 5G 0 disk
└─stratis-1-private-98d0dfd72a724f9998e334078655eff7-physical-originsub 253:2 0 10G 0 stratis
├─stratis-1-private-98d0dfd72a724f9998e334078655eff7-flex-thinmeta 253:3 0 6M 0 stratis
│ └─stratis-1-private-98d0dfd72a724f9998e334078655eff7-thinpool-pool 253:6 0 9.5G 0 stratis
│ └─stratis-1-98d0dfd72a724f9998e334078655eff7-thin-fs-8ea3a262565a40c680a25d065f18548f 253:7 0 1T 0 stratis /stratis-fs
├─stratis-1-private-98d0dfd72a724f9998e334078655eff7-flex-thindata 253:4 0 9.5G 0 stratis
│ └─stratis-1-private-98d0dfd72a724f9998e334078655eff7-thinpool-pool 253:6 0 9.5G 0 stratis
│ └─stratis-1-98d0dfd72a724f9998e334078655eff7-thin-fs-8ea3a262565a40c680a25d065f18548f 253:7 0 1T 0 stratis /stratis-fs
└─stratis-1-private-98d0dfd72a724f9998e334078655eff7-flex-mdv 253:5 0 512M 0 stratis
vda 252:0 0 30G 0 disk
├─vda1 252:1 0 1M 0 part
├─vda2 252:2 0 1G 0 part /boot
└─vda3 252:3 0 29G 0 part
├─rhel-root 253:0 0 26G 0 lvm /
└─rhel-swap 253:1 0 3G 0 lvm [SWAP]
vdb 252:16 0 5G 0 disk
└─stratis-1-private-98d0dfd72a724f9998e334078655eff7-physical-originsub 253:2 0 10G 0 stratis
├─stratis-1-private-98d0dfd72a724f9998e334078655eff7-flex-thinmeta 253:3 0 6M 0 stratis
│ └─stratis-1-private-98d0dfd72a724f9998e334078655eff7-thinpool-pool 253:6 0 9.5G 0 stratis
│ └─stratis-1-98d0dfd72a724f9998e334078655eff7-thin-fs-8ea3a262565a40c680a25d065f18548f 253:7 0 1T 0 stratis /stratis-fs
├─stratis-1-private-98d0dfd72a724f9998e334078655eff7-flex-thindata 253:4 0 9.5G 0 stratis
│ └─stratis-1-private-98d0dfd72a724f9998e334078655eff7-thinpool-pool 253:6 0 9.5G 0 stratis
│ └─stratis-1-98d0dfd72a724f9998e334078655eff7-thin-fs-8ea3a262565a40c680a25d065f18548f 253:7 0 1T 0 stratis /stratis-fs
└─stratis-1-private-98d0dfd72a724f9998e334078655eff7-flex-mdv 253:5 0 512M 0 stratis
It will always show as 1TB . To check the actual size we need to use stratis filesystem list
We can create snapshots of the filesystem
Mounting the device to fstab
We have to use the UUID method. We can get the UUID from the filesystem list. To mount it we need extra flags for the stratisd Keep in mind that single quotes are not needed in fstab
UUID=8ea3a262-565a-40c6-80a2-5d065f18548f /stratis-fs xfs defaults,x-systemd.requires=stratisd.service 0 0
mount -a
mount: (hint) your fstab has been modified, but systemd still uses
the old version; use 'systemctl daemon-reload' to reload.
Deleting the stratis fs Unmount the folder
Destroy the filesystem for the poolStop the pool temporarily
To destroy the pool it must be started