Solaris and Linux
Sunday, May 31, 2026
Networking core concepts
L1 – Physical: Cables, NICs, bits.
L2 – Data Link: MAC addresses, switches, VLANs, STP.
L3 – Network: IP, routing, subnets, CIDR, ARP.
L4 – Transport: TCP/UDP, ports, handshake, retransmission.
L5 – Session: Connection management. Rare in practical ops.
L6 – Presentation: Encryption, compression, TLS framing.
L7 – Application: HTTP, DNS, SMTP, gRPC.
How to Install KVM Packages
egrep -c '(vmx|svm)' /proc/cpuinfo
lsmod | grep kvm
virt-host-validate
Install KVM Packages on Rhel/Centos
sudo dnf install -y qemu-kvm libvirt virt-install virt-manager
Install KVM Packages Ubuntu
sudo apt update
sudo apt install -y qemu-kvm libvirt-daemon-system libvirt-clients virtinst
Manage Libvirt Service
systemctl status libvirtd;systemctl start libvirtd;systemctl enable libvirtd;systemctl restart libvirtd
List Virtual Machines
virsh list
virsh list --all
virsh start vmname ( To start the VM)
virsh shutdown vmname ( To shutdown VM)
virsh destroy vmname ( To Desntroy the VM) =======> Do not use this command
virsh reboot vmname ( To reboot the VM)
virsh suspend vmname ( To Suspend VM)
virsh resume vmname ( To Resume VM)
virsh dominfo vmname ( VM iminfo)
virsh dumpxml vmname
virsh domstats vmname (To Show CPU and memory usage)
virsh domuuid vmname (To Get VM UUID)
virsh snapshot-list vmname
Create Virtual Machines Using ISO
virt-install \
--name rhel9 \
--memory 4096 \
--vcpus 2 \
--disk size=50 \
--cdrom /iso/rhel9.iso \
--os-variant rhel9.0 \
--network bridge=br0
virsh snapshot-create-as vmname snapshot1
virsh snapshot-revert vmname snapshot1
virsh snapshot-delete vmname snapshot1
virsh net-list --all
virsh net-start default
virsh net-autostart default
Storage Commands
virsh pool-list --all
virsh vol-list default
virsh pool-info default
Console Access
virsh console vmname
Ctrl + ]
virsh migrate --live vmname qemu+ssh://destination-host/system
virsh setmem vmname 8G --live
virsh setvcpus vmname 4 --live
journalctl -u libvirtd
virsh domiflist vmname
Daily KVM Administration Commands
virsh list --all
virsh dominfo vmname
virsh start vmname
virsh shutdown vmname
virsh reboot vmname
virsh console vmname
virsh domifaddr vmname
virsh snapshot-list vmname
virsh net-list --all
virsh pool-list --all
Thursday, May 28, 2026
LVM Basics
PV (Physical Volume) – Physical disks/partitions
VG (Volume Group) – Pool of storage
LV (Logical Volume) – Logical partitions created from the pool
pvs # List PVs
vgs # List VGs
lvs # List LVs
pvcreate /dev/sdb
vgcreate vg_data /dev/sdb
lvcreate -L 10G -n lv_app vg_data
mkfs.xfs /dev/vg_data/lv_app
mount /dev/vg_data/lv_app /app
lvextend -L +5G /dev/vg_data/lv_app
xfs_growfs /app
vgextend vg_data /dev/sdc
lvremove /dev/vg_data/lv_app
vgremove vg_data
pvremove /dev/sdb
# Add new disk
pvcreate /dev/sdb
# Add disk to VG
vgextend vg_root /dev/sdb
# Extend LV
lvextend -l +100%FREE /dev/vg_root/lv_data
# Grow filesystem
xfs_growfs /data # XFS
resize2fs /dev/vg_root/lv_data # EXT4
Friday, May 22, 2026
Wednesday, May 20, 2026
Access mode and Trunk mode.
| Feature | Access Mode | Trunk Mode |
|---|---|---|
VLANs carried | One VLAN | Multiple VLANs |
| VLAN Tagging | No | Yes |
| Used for | End devices | Network devices |
| Traffic type | Untagged | Tagged |
Tuesday, May 19, 2026
Common Linux System Calls
| Category | Examples | Purpose |
|---|---|---|
| File Operations | open(), read(), write(), close() | File handling |
| Process Control | fork(), exec(), wait() | Process creation |
| Memory Management | mmap(), brk() | Memory allocation |
| Device Management | ioctl() | Device communication |
| Networking | socket(), bind(), connect() | Network operations |
| Information | getpid(), uname() | System information |
What is the Kernel?
User Space
Where normal programs run (bash, nginx, bash, curl, docker python)
Kernel Space
Where the kernel runs with full hardware Scheduler, memory manager access
syscalls
API through which programs request open(), read(), fork() kernel services
Thursday, May 14, 2026
PXE Boot Flow
Client PXE Boot
↓
DHCP assigns IP
↓
TFTP downloads pxelinux.0
↓
PXE menu appears
↓
Kernel + initrd loaded
↓
Installer downloads packages via HTTP
↓
DHCP assigns IP
↓
TFTP downloads pxelinux.0
↓
PXE menu appears
↓
Kernel + initrd loaded
↓
Installer downloads packages via HTTP
How to setup Automated PXE Server Setup Script
.
#!/bin/bash
# ============================================================
# Automated PXE Server Setup
# Supported OS : RHEL / Rocky / AlmaLinux 8 & 9
# Author : ChatGPT
# ============================================================
set -e
# -----------------------------
# Variables
# -----------------------------
PXE_SERVER_IP="192.168.1.10"
SUBNET="192.168.1.0"
NETMASK="255.255.255.0"
RANGE_START="192.168.1.100"
RANGE_END="192.168.1.200"
GATEWAY="192.168.1.1"
OS_NAME="rhel9"
ISO_MOUNT="/mnt/rhel9"
HTTP_ROOT="/var/www/html/${OS_NAME}"
TFTP_ROOT="/var/lib/tftpboot"
PXE_CFG="${TFTP_ROOT}/pxelinux.cfg"
# -----------------------------
# Install Required Packages
# -----------------------------
echo "Installing required packages..."
dnf install -y \
dhcp-server \
tftp-server \
syslinux \
httpd \
xinetd \
wget \
firewalld
# -----------------------------
# Enable Services
# -----------------------------
systemctl enable --now firewalld
systemctl enable --now httpd
systemctl enable --now tftp.socket
systemctl enable --now dhcpd
# -----------------------------
# Configure Firewall
# -----------------------------
echo "Configuring firewall..."
firewall-cmd --permanent --add-service=http
firewall-cmd --permanent --add-service=dhcp
firewall-cmd --permanent --add-service=tftp
firewall-cmd --reload
# -----------------------------
# Create TFTP Structure
# -----------------------------
echo "Creating PXE boot directories..."
mkdir -p ${PXE_CFG}
mkdir -p ${TFTP_ROOT}/images/${OS_NAME}
# -----------------------------
# Copy PXE Boot Files
# -----------------------------
echo "Copying PXE boot files..."
cp /usr/share/syslinux/pxelinux.0 ${TFTP_ROOT}/
cp /usr/share/syslinux/menu.c32 ${TFTP_ROOT}/
cp /usr/share/syslinux/libutil.c32 ${TFTP_ROOT}/
cp /usr/share/syslinux/libcom32.c32 ${TFTP_ROOT}/
# -----------------------------
# Mount ISO
# -----------------------------
echo "Mounting ISO..."
mkdir -p ${ISO_MOUNT}
echo "Please place RHEL ISO at /root/rhel9.iso"
mount -o loop /root/rhel9.iso ${ISO_MOUNT}
# -----------------------------
# Copy Installation Files
# -----------------------------
echo "Copying installation files..."
mkdir -p ${HTTP_ROOT}
cp -r ${ISO_MOUNT}/* ${HTTP_ROOT}/
# -----------------------------
# Copy Kernel and Initrd
# -----------------------------
echo "Copying kernel and initrd..."
cp ${ISO_MOUNT}/images/pxeboot/vmlinuz \
${TFTP_ROOT}/images/${OS_NAME}/
cp ${ISO_MOUNT}/images/pxeboot/initrd.img \
${TFTP_ROOT}/images/${OS_NAME}/
# -----------------------------
# Create PXE Menu
# -----------------------------
echo "Creating PXE menu..."
cat <<EOF > ${PXE_CFG}/default
DEFAULT menu.c32
PROMPT 0
TIMEOUT 100
ONTIMEOUT local
MENU TITLE Automated PXE Boot Menu
LABEL local
MENU LABEL Boot from Local Disk
LOCALBOOT 0
LABEL ${OS_NAME}
MENU LABEL Install RHEL 9
KERNEL images/${OS_NAME}/vmlinuz
APPEND initrd=images/${OS_NAME}/initrd.img \
ip=dhcp \
inst.repo=http://${PXE_SERVER_IP}/${OS_NAME}
LABEL rescue
MENU LABEL Rescue Installed System
KERNEL images/${OS_NAME}/vmlinuz
APPEND initrd=images/${OS_NAME}/initrd.img rescue
EOF
# -----------------------------
# Configure DHCP
# -----------------------------
echo "Creating DHCP configuration..."
cat <<EOF > /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
authoritative;
allow booting;
allow bootp;
subnet ${SUBNET} netmask ${NETMASK} {
range ${RANGE_START} ${RANGE_END};
option routers ${GATEWAY};
option subnet-mask ${NETMASK};
option domain-name-servers 8.8.8.8;
next-server ${PXE_SERVER_IP};
filename "pxelinux.0";
}
EOF
# -----------------------------
# SELinux Adjustments
# -----------------------------
echo "Configuring SELinux..."
setsebool -P tftp_home_dir on
restorecon -Rv ${TFTP_ROOT}
# -----------------------------
# Restart Services
# -----------------------------
echo "Restarting services..."
systemctl restart dhcpd
systemctl restart httpd
systemctl restart tftp.socket
# -----------------------------
# Display Status
# -----------------------------
echo
echo "========================================"
echo " PXE SERVER SETUP COMPLETED"
echo "========================================"
echo
echo "PXE Server IP : ${PXE_SERVER_IP}"
echo "HTTP Repo : http://${PXE_SERVER_IP}/${OS_NAME}"
echo "TFTP Root : ${TFTP_ROOT}"
echo
echo "Boot target systems using PXE network boot."
echo
Sunday, May 3, 2026
Linux Interview Que.
1. What is Linux?
Answer:
Linux is an open-source, Unix-like operating system based on the Linux kernel. It manages hardware resources and provides services for applications.
🔹 2. Explain Linux boot process
Answer:
BIOS/UEFI initializes hardware
Bootloader (GRUB) loads kernel
Kernel initializes system
init / systemd starts services
System reaches target (multi-user/graphical)
🔹 3. What is the difference between hard link and soft link?
Answer:
Hard link: Points to same inode, survives file deletion
Soft link (symlink): Points to file path, breaks if original file is deleted
🔹 4. What is a process?
Answer:
A process is a running instance of a program with its own memory space and PID.
🔹 5. How do you check CPU and memory usage?
Answer:
CPU: top, htop, mpstat
Memory: free -m, vmstat
🔹 6. Difference between df and du?
Answer:
df: Shows filesystem disk usage
du: Shows directory/file usage
🔹 7. What is swap memory?
Answer:
Swap is disk space used as virtual memory when RAM is full.
🔹 8. What is /etc/fstab?
Answer:
A configuration file that defines filesystems to mount at boot time.
🔹 9. How do you find large files?
Answer:
find / -type f -size +500M
🔹 10. What is SSH?
Answer:
SSH (Secure Shell) is a secure protocol for remote login and command execution.
🔹 11. How do you secure SSH?
Answer:
Disable root login
Use key-based authentication
Change default port
Use firewall rules
🔹 12. What is cron?
Answer:
Cron is a job scheduler to run tasks automatically at scheduled times.
🔹 13. What is LVM?
Answer:
LVM (Logical Volume Manager) allows flexible disk management, resizing partitions without downtime.
🔹 14. What is RAID?
Answer:
RAID is data storage virtualization combining multiple disks for redundancy/performance.
RAID 0 → performance
RAID 1 → mirroring
RAID 5 → parity
🔹 15. How do you check open ports?
Answer:
ss -tuln
🔹 16. How do you check running processes?
Answer:
ps -ef
top
🔹 17. Server is slow — how do you troubleshoot?
Answer (structured approach):
Check CPU → top
Check memory → free -m
Check disk → df -h, iostat
Check logs → /var/log/messages
Check network → ss, netstat
🔹 18. Disk is full — what will you do?
Answer:
Check usage → df -h
Find large files → du -sh *
Clean logs → /var/log
Remove temp files → /tmp
Extend disk (LVM if available)
🔹 19. High CPU usage — how to identify?
Answer:
top
ps -eo pid,ppid,cmd,%cpu --sort=-%cpu
🔹 20. What is load average?
Answer:
Load average shows number of processes waiting for CPU.
Compare with CPU cores
Load > cores → system overloaded
🔹 21. Difference between process and thread?
Answer:
Process: Independent, own memory
Thread: Lightweight, shares memory
🔹 22. What are file permissions?
Answer:
Permissions control access:
Read (r), Write (w), Execute (x)
Owner, Group, Others
Example:
chmod 755 file
🔹 23. What is a zombie process?
Answer:
A zombie process is a completed process whose entry still exists in process table.
🔹 24. How do you monitor logs in real time?
Answer:
tail -f /var/log/syslog
🔹 25. What is systemd?
Answer:
Systemd is the init system and service manager in modern Linux.
Subscribe to:
Posts (Atom)