6. Linux Networking, DNS, SSH & Security Hardening
Modules 17-22: IP routing, DNS A/CNAME/PTR records, SSH key authentication, firewalld/UFW rules & SELinux enforcing mode
Module 1: Networking Fundamentals & Layered Troubleshooting
Configuring network interfaces, routing tables, DNS resolution, and firewalls.
🇬🇧 English Definition
Troubleshoot network issues layer by layer: interface link -> IP address -> gateway route -> DNS resolution -> firewall rules -> listening port -> application layer.
🇮🇳 Hinglish Definition
Network issue ko layer-by-layer troubleshoot karo; random commands run karna avoid karo.
Core Concepts & Rules
- ip addr & ip route: Display IP configuration and routing table entries.
- ss -tulpn: Shows listening TCP/UDP sockets and matching process names.
- Default Gateway: Router interface used to reach subnets outside local network.
🔍 Line-by-Line Command Breakdown
- Line 1: ip addr displays network interface configuration.
- Line 2: ip route displays default gateway routing table.
- Line 3: ss -tulpn shows listening network ports and process PIDs.
- Line 4: traceroute example.com traces network hop path to destination.
🎯 Interview Focus & Questions
- Q: TCP vs UDP?
A: TCP is connection-oriented, reliable, and ordered; UDP is connectionless with lower overhead and no delivery guarantee. - Q: How to troubleshoot SSH failure?
A: Check IP reachability (ping), routing, DNS if hostname is used, sshd status/port (ss -tulpn), firewall, and auth logs.
ip addr
ip route
ping -c 4 8.8.8.8
ss -tulpn
traceroute example.com
curl -I https://example.com
Module 2: DNS Resolution & SSH Remote Administration
Domain Name System resolution and securing SSH remote server access.
🇬🇧 English Definition
DNS maps domain names to IP addresses (A/AAAA records, CNAME aliases, PTR reverse lookups). SSH provides encrypted remote server administration using public/private key authentication.
🇮🇳 Hinglish Definition
DNS domain name ko IP address me resolve karta hai. SSH remote server ko securely manage karne ka standard method hai.
Core Concepts & Rules
- DNS Records: A (name to IPv4), CNAME (alias to domain), PTR (reverse IP to hostname).
- Public vs Private Key: Public key is copied to server (~/.ssh/authorized_keys); Private key remains secret on client.
- SSH Hardening: Disable direct root login (PermitRootLogin no), disable password authentication, use non-standard ports.
🔍 Line-by-Line Command Breakdown
- Line 1: dig example.com queries DNS server for A record domain resolution.
- Line 2: ssh-keygen -t ed25519 generates modern high-security SSH key pair.
- Line 3: ssh-copy-id user@server copies public key to remote server authorized_keys file.
🎯 Interview Focus & Questions
- Q: A vs CNAME record?
A: A maps a domain name directly to an IPv4 address; CNAME aliases one hostname to another domain name. - Q: Public vs private key?
A: The public key is placed on the server; the private key stays on the client and must be kept secure.
dig example.com
dig A example.com
dig -x 8.8.8.8
ssh-keygen -t ed25519
ssh-copy-id user@server
ssh -i ~/.ssh/id_ed25519 user@server
Module 3: Firewall Control & SELinux Security Policies
Filtering network traffic using UFW/firewalld and enforcing mandatory access control with SELinux.
🇬🇧 English Definition
A firewall controls network packet traffic based on security rules. SELinux (Security-Enhanced Linux) is a Mandatory Access Control (MAC) system using security labels and policy rules.
🇮🇳 Hinglish Definition
Firewall network traffic ko allow/deny karta hai. SELinux standard permissions ke aage mandatory policy controls enforce karta hai.
Core Concepts & Rules
- SELinux Modes: Enforcing (blocks & logs violations), Permissive (logs violations without blocking), Disabled.
- restorecon: Restores default file security contexts based on SELinux policy database.
🔍 Line-by-Line Command Breakdown
- Line 1: sudo ufw allow 22/tcp opens SSH port 22 in UFW firewall.
- Line 2: getenforce checks current SELinux execution mode (Enforcing/Permissive).
- Line 3: ls -Z displays SELinux security context labels assigned to files.
🎯 Interview Focus & Questions
- Q: Host Firewall vs Cloud Security Group?
A: A host firewall operates inside the OS; a cloud security group is virtual network infrastructure control outside the OS. - Q: Why can an application fail with correct Unix permissions?
A: SELinux security policy or label mismatch may still deny access; inspect SELinux contexts and audit logs.
sudo ufw status
sudo ufw allow 22/tcp
sudo firewall-cmd --state
sudo firewall-cmd --list-all
getenforce
sestatus
ls -Z /var/www
sudo restorecon -Rv /var/www