- 🌍 Understand Real World Scenarios
- ❓ Why Linux?
- 🖥️ Where We Can Use Linux?
- 📚 Fundamentals of Linux
- ⚔️ Linux vs Windows
- 📂 Linux File System
- 📦 Package Management
- 🛠️ Core Components of Linux
- 🗂️ Directory Structure In Linux
- 👤 Linux User Management
- 📄 Linux File Management
- ✍️ VI Editor Shortcuts (commonly used)
- 🔐 File Permissions
- 🛡️ File Special Permissions
- ⚙️ Process Management
- 📈 Linux System Monitoring
- 🌐 Basic Networking in Linux
- 💾 Disk and Storage Management in Linux
- 🛠️ Troubleshooting Commands
- 🧰 General Commands
- 📝 Editors – VI, VIM, Nano
- 🐚 Shell Scripting
- 🕒 Cron Management
- 🎯 Linux Interview Questions
- 📚 From Where to Learn Linux?
Linux is the foundation of most tech companies today, from startups to giants like Google and Amazon. As a DevOps engineer, you’ll work with Linux servers to manage cloud infrastructure, deploy websites, and automate tasks. 🖥️ Most cloud platforms, including AWS and GCP, use Linux for its stability, flexibility, and cost-effectiveness. 🌐 Whether it’s running databases, hosting applications, or managing containers with Docker, Linux powers many key technologies. 🚀 👉 Bottom Line: Knowing Linux is critical for cloud computing, system administration, and DevOps roles in the real world.
Certainly! Here's the theory for "Why Linux?" in 5-7 lines:
Linux is the preferred choice for most tech companies because it is open-source, secure, and highly customizable. 🛠️
It’s free to use and offers better performance with low overhead, making it ideal for running servers, databases, and cloud applications. ☁️
Unlike Windows, Linux gives complete control over the system, allowing automation through scripts and commands. 📝 > It’s also secure by design, with frequent security patches and
a smaller attack surface compared to other OS. 🔒
👉 Bottom Line: Linux offers stability, security, and cost-efficiency, making it a top choice for DevOps, cloud computing, and system administration.
-
Ubuntu:
- User-friendly, great for beginners
- Popular for both personal use and servers
- Often used in cloud environments (AWS, GCP)
-
CentOS / RHEL:
- Enterprise-grade, stable, and secure
- Widely used in server environments
- RHEL is commercial support; CentOS is community-driven
-
Debian:
- Known for stability and reliability
- Often used as the base for other distributions (like Ubuntu)
-
Fedora:
- Cutting-edge features, great for developers
- Supports new software and technologies
- Upstream source for Red Hat Enterprise Linux (RHEL)
-
Arch Linux:
- Minimalistic, flexible, and customizable
- Ideal for advanced users who want full control
-
Linux Mint:
- Beginner-friendly, based on Ubuntu
- Comes with a pre-configured desktop environment (Cinnamon)
-
Kali Linux:
- Specialized for penetration testing and cybersecurity
- Pre-packed with security tools
-
OpenSUSE:
- Known for its enterprise-grade tools and flexible configuration
- Good for both developers and system admins
-
Manjaro:
- Based on Arch Linux but more user-friendly
- Great for users who want the Arch experience without the complexity
Linux is used in many areas of technology, especially in servers and cloud computing. 🌐
It powers web servers (Apache, Nginx), databases (MySQL, PostgreSQL), and is a go-to for containerized applications (Docker, Kubernetes). 🐳
In cloud environments (AWS, GCP, Azure), Linux is the OS of choice due to its stability, performance, and low cost. ☁️
It's also used in IoT devices, smartphones (Android uses Linux Kernel), embedded systems, and cybersecurity tools. 🔒
👉 Bottom Line: Linux is everywhere, from websites to mobile apps to cloud services — it's the backbone of modern tech.
At its core, Linux is an open-source operating system based on the Unix model. 🖥️
Everything in Linux is treated as a file — including devices, processes, and directories. 📂
The system is built around a kernel, which handles hardware interaction and system resource management. 🔧
Linux uses a command-line interface (CLI) for interaction, though graphical interfaces (GUIs) are available. 🖱️
The system follows a hierarchical file system, and you use commands like ls, cd, and cp to navigate and manipulate files. 🗂️
👉 Bottom Line: Linux’s structure is simple yet powerful, providing full control over system resources and processes.
-
Cost:
- Linux is open-source and free to use. 🆓
- Windows requires a license, which often involves recurring costs. 💰
-
Customization:
- Linux is highly customizable, allowing users to modify the OS to meet specific needs. 🛠️
- Windows is more restricted in terms of customization options. ⚙️
-
User Interface:
- Windows has a graphical user interface (GUI) that is more familiar to most users, making it easier to use for beginners. 🖱️
- Linux can be used with a GUI (e.g., Ubuntu, GNOME), but many advanced users prefer the command-line interface (CLI) for more control. 💻
-
Security:
- Linux is considered more secure due to its open-source nature, allowing for quicker updates and fixes. It also has a smaller attack surface. 🔒
- Windows is a more common target for malware and viruses, though it has significantly improved its security features. 🦠
-
Performance:
- Linux is lightweight, making it ideal for servers and systems with limited resources. ⚡
- Windows can be resource-heavy, especially in enterprise environments and with certain applications. 🖥️
-
Software Support:
- Windows has better native support for popular commercial software like Microsoft Office, Adobe, and various games. 🎮
- Linux is more suited for open-source software, but tools like Wine or virtual machines can run Windows software on Linux. 📂
-
Use Cases:
- Linux is widely used in servers, cloud computing, IoT devices, and supercomputers. 🚀
- Windows is commonly used for personal desktop use, gaming, and business environments. 🏢
-
System Administration:
- Linux provides full control over the system, making it the preferred choice for system administrators and DevOps engineers. ⚙️
- Windows has a more automated system administration experience, but it lacks the granular control that Linux offers. 🔧
-
👉 Bottom Line:
- Choose Linux for servers, cloud environments, development, and customization.
- Choose Windows for desktop use, business software, and gaming.
/ (Root)
├─ bin 📦 Essential user binaries
├─ boot 🚀 Static files for bootloader
├─ dev 🖥️ Device files
├─ etc 📝 Host & system configuration
├─ home 🧑💻 User home directories
│ └─ user/
├─ lib 🔧 Essential shared libraries
├─ mnt 📂 Mount point for temporary mounts
├─ media 💾 Removable media (CDs, USB)
├─ opt 📦 Optional add-on application software
├─ proc 🌀 Virtual filesystem for processes
├─ root 👑 Home for the root user
├─ run ⚡ Runtime variable data
├─ sbin 🛠️ System binaries (admin commands)
├─ srv 🌐 Data for services (e.g., web, FTP)
├─ sys 🔄 Kernel & system information
├─ tmp 🗑️ Temporary files
├─ usr 📚 User utilities & applications
│ ├─ bin/
│ ├─ lib/
│ └─ share/
└─ var 📈 Variable data (logs, mail, spool)
-
/ (Root)
The single entry point of the entire filesystem tree. -
/bin & /sbin
Essential programs for all users (/bin) and system admin tasks (/sbin). -
/etc
All global configuration files live here (network, user accounts, services). -
/home
Personal data and settings for each user—your “workspace” on the system. -
/var
Frequently changing data: logs (/var/log), mail (/var/mail), caches. -
/proc & /sys
Virtual filesystems providing real-time info about kernel and processes. -
/usr
Secondary hierarchy for read-only user data, apps, and libraries—think “big share.”
Package management is essential for managing the software on a Linux system. It allows you to install, update, remove, and manage software packages efficiently.
A package is a compressed file containing a program or software, along with its dependencies, configuration files, and documentation. These packages make it easy to install and maintain software on Linux systems.
-
Debian-based systems (e.g., Ubuntu, Debian):
Use APT (Advanced Package Tool) for managing packages.
Example command:sudo apt install <package_name> # Install a package sudo apt update # Update package list sudo apt upgrade # Upgrade installed packages sudo apt remove <package_name> # Remove a package
-
Red Hat-based systems (e.g., CentOS, Fedora):
Use YUM (Yellowdog Updater, Modified) or DNF (Dandified YUM) for managing packages.
Example command:sudo yum install <package_name> # Install a package sudo yum update # Update packages sudo yum remove <package_name> # Remove a package
-
Arch-based systems (e.g., Arch Linux, Manjaro):
Use Pacman for managing packages.
Example command:sudo pacman -S <package_name> # Install a package sudo pacman -Sy # Synchronize package databases sudo pacman -R <package_name> # Remove a package
- DEB: Used by Debian-based distributions (e.g., Ubuntu).
- RPM: Used by Red Hat-based distributions (e.g., CentOS, Fedora).
- PKGBUILD: Used by Arch Linux for building packages.
-
Repositories:
Linux distributions maintain repositories, which are online servers storing packages. When you run the package manager (e.g.,apt,dnf,pacman), it connects to these repositories to fetch packages. -
Dependencies:
When installing a program, the package manager automatically installs any required dependencies (other software packages needed for the program to work).
- Efficiency: Automates the process of installing, updating, and removing software. 🔄
- Security: Ensures software is up to date with security patches. 🔒
- Convenience: Provides easy access to thousands of software packages in official repositories. 📦
- 📜 SSH (Secure Shell)
- 📁 FTP / SFTP Services
- 📬 Mail Services
- 🖥️ Web Server Services (Apache, Nginx)
- 📈 Database Services (MySQL, PostgreSQL)
- 🛡️ Firewall Services (firewalld, iptables, ufw)
- 🔄 Cron Jobs (Task Scheduling)
- 🌀 Logging Services (rsyslog, journalctl)
- 📦 Package Management Services (apt, yum, dnf)
In Linux, user management is crucial for controlling who can access the system and what actions they can perform. 🖥️
You can create users (useradd, adduser) to allow new people to use the system, and set passwords (passwd) to secure their accounts. 🔒
Using commands like usermod, you can modify user details (like changing their group or shell).
With groupadd and usermod -aG, you can create groups and add users to groups for organized permission management. 👥
Permissions are controlled by chown (change ownership) and chmod (change file access rights). 📂
You can also lock, unlock, or expire user accounts (passwd -l, chage) to enhance security. 🔐
This ensures that only the right people have the right level of access at all times! 🚀
sudo useradd devops_user- Explanation: This creates a new user named
devops_userwithout setting a password.
sudo passwd devops_user- Explanation: This sets a password for
devops_user. You will be prompted to enter the password.
sudo passwd devops_user- Explanation: This allows you to change the password of
devops_user. You will be asked to enter the new password.
sudo groupadd devops_group- Explanation: This creates a new group named
devops_group.
sudo usermod -aG devops_group devops_user- Explanation: This command adds the user
devops_userto the groupdevops_group.
sudo usermod -aG sudo devops_user- Explanation: This command gives
devops_usersudo (administrative) privileges by adding them to thesudogroup.
-
Check if user belongs to a group:
groups devops_user
-
Verify if user has sudo permissions:
sudo -l -U devops_user
Linux provides a wide range of commands for managing files and directories efficiently. Here's what you need to know:
-
Create an empty file:
touch filename.txt
-
Create a file with content:
echo "Hello, World!" > hello.txt
-
View the content of a file:
cat filename.txt
-
View the beginning of a file:
head filename.txt
-
View the end of a file:
tail filename.txt
-
Search for content within a file:
grep "search_term" filename.txt
-
Create a directory:
mkdir directory_name
-
Change to a directory:
cd directory_name -
List the contents of a directory:
ls -l
-
Remove a directory:
rmdir directory_name
-
Copy a file:
cp source_file destination_file
-
Move or rename a file:
mv old_name new_name
-
Copy a directory and its contents:
cp -r source_directory destination_directory
-
Delete a file:
rm filename.txt
-
Delete a directory and its contents:
rm -r directory_name
-
Change file permissions (read, write, execute):
chmod 755 filename
-
Change file ownership (user:group):
chown user:group filename
- Search for a file by name:
find /path/to/search -name filename.txt
-
Create a .tar file:
tar -cvf archive_name.tar /path/to/directory
-
Extract a .tar file:
tar -xvf archive_name.tar
-
Check the disk usage of files and directories:
du -sh /path/to/directory
-
Check free disk space:
df -h
- Use wildcards (
*,?) to match multiple files.
Example:ls *.txtto list all.txtfiles.
The Vim editor (Vi IMproved) is an advanced version of the VI editor, providing enhanced features for editing and creating text, especially useful for developers and system administrators. Vim offers a more user-friendly experience while still retaining the power of the original VI editor.
- Syntax Highlighting: Vim supports syntax highlighting for various programming languages, making code easier to read and debug.
- Undo/Redo History: Unlike VI, Vim allows you to undo and redo multiple changes.
- Search and Replace: Powerful search features, including regular expressions.
- Plugins: Vim supports many plugins to enhance its functionality, such as code completion, file navigation, etc.
- Multiple Buffers: Allows opening multiple files at once and easily switching between them.
- Customizability: Vim can be customized extensively with the
.vimrcfile.
-
Open a file with vim:
vim filename.txt
-
If the file doesn’t exist, Vim will create it.
Just like VI, Vim operates in different modes:
- This is the default mode where you can navigate, search, and manipulate text.
- Common commands:
h,j,k,l: Move the cursor left, down, up, and right.dd: Delete a line.yy: Copy a line.p: Paste the copied content.u: Undo changes.Ctrl + r: Redo changes./search_term: Search for a term in the file.
- This is the mode for editing and typing.
- To enter Insert Mode, press
i(orIto start at the beginning of the line). - To exit Insert Mode, press
Esc.
- You can execute commands like saving, quitting, or searching in Command Mode.
- Common commands:
:w: Save the file.:q: Quit Vim.:wq: Save and quit.:q!: Quit without saving changes.
-
Open a File:
vim myfile.txt
-
Insert Text:
- Press
ito enter Insert Mode and start typing. - Press
Escto return to Normal Mode.
- Press
-
Save the File:
- Press
Escand type:wto save changes. - Press
Escand type:wqto save and quit.
- Press
-
Quit Vim:
- Press
Escand type:qto quit if no changes were made. - Press
Escand type:q!to force quit without saving changes.
- Press
-
Search for a term:
- In Normal Mode, type
/termand press Enter to search for the word "term". - Press
nto find the next occurrence andNfor the previous occurrence.
- In Normal Mode, type
-
Replace a word:
- To replace a word on the current line, use the
:scommand::s/old_word/new_word/
- To replace all occurrences of the word in the entire file:
:%s/old_word/new_word/g
- To replace a word on the current line, use the
The VI editor is a powerful tool for text editing in Linux, but mastering it requires familiarity with its shortcuts and commands. Below are the most commonly used VI shortcuts, organized by mode, to help you become efficient in navigating and editing files.
- Move Cursor:
h→ Move left by one characterj→ Move down by one linek→ Move up by one linel→ Move right by one characterw→ Jump to the beginning of the next wordb→ Jump to the beginning of the previous word0→ Jump to the beginning of the current line$→ Jump to the end of the current linegg→ Jump to the beginning of the fileG→ Jump to the end of the file
-
Deleting Text:
x→ Delete the character under the cursordw→ Delete a word from the cursor positiondd→ Delete the current lined$→ Delete from the cursor to the end of the lined0→ Delete from the cursor to the beginning of the linedG→ Delete from the cursor to the end of the file
-
Copying/Pasting:
yy→ Copy (yank) the current lineyw→ Copy the current wordp→ Paste the copied text after the cursorP→ Paste the copied text before the cursor
-
Undo/Redo:
u→ Undo the last changeCtrl + r→ Redo the undone change
-
Switch to Insert Mode:
i→ Start inserting before the cursorI→ Start inserting at the beginning of the linea→ Start inserting after the cursorA→ Start inserting at the end of the lineo→ Open a new line below the current line and start insertingO→ Open a new line above the current line and start inserting
-
Exit Insert Mode:
Esc→ Exit Insert Mode and return to Normal Mode
-
Search:
/search_term→ Search for a term forward?search_term→ Search for a term backwardn→ Move to the next occurrence of the search termN→ Move to the previous occurrence of the search term
-
Replace:
:s/old/new/→ Replace the first occurrence ofoldwithnewin the current line:s/old/new/g→ Replace all occurrences ofoldwithnewin the current line:%s/old/new/g→ Replace all occurrences ofoldwithnewin the entire file
-
Save:
:w→ Save the current file:wq→ Save and quit the fileZZ→ Save and quit (shortcut for:wq)
-
Quit:
:q→ Quit if no changes have been made:q!→ Quit without saving changes:x→ Save and quit (alternative to:wq)
-
Move Between Words:
Ctrl + w→ Jump between words when editingCtrl + f→ Move forward one pageCtrl + b→ Move backward one page
-
Case Changing:
~→ Toggle the case of the character under the cursor (uppercase <-> lowercase)gU→ Convert the selected text to uppercasegu→ Convert the selected text to lowercase
-
Line Operations:
C→ Change the rest of the current lineD→ Delete from the cursor to the end of the lineY→ Copy the current lineJ→ Join the current line with the next line
In Linux, file permissions are a critical part of security and help control who can access and modify files. Each file or directory in Linux has associated permissions that determine what actions users can perform. Understanding these permissions is essential for managing security on your Linux system.
- Read (r): Allows reading the file or listing the contents of a directory.
- Write (w): Allows modifying the file or adding/removing files in a directory.
- Execute (x): Allows executing a file (if it's a script or program) or accessing a directory's contents.
These permissions are applied to three types of users:
- Owner (u): The user who owns the file.
- Group (g): Users who belong to the file's group.
- Others (o): Everyone else who is not the owner or in the group.
To view the permissions of a file, use the ls -l command:
ls -l filenameOutput example:
-rw-r--r-- 1 user group 12345 Jan 1 12:34 file.txt
Explanation:
- The first character (
-) indicates it's a regular file. - The next three characters (
rw-) represent the owner's permissions (read and write). - The next three (
r--) represent the group's permissions (read only). - The final three (
r--) represent others' permissions (read only).
To change file permissions, the chmod command is used:
- Syntax:
chmod [options] mode file - Mode can be specified in symbolic or numeric form.
-
r: Read -
w: Write -
x: Execute -
Example 1: Give execute permission to the owner of the file
chmod u+x file.txt
-
Example 2: Remove write permission for the group
chmod g-w file.txt
-
Example 3: Give read and write permissions to the owner, and read permission to others
chmod u+rw, o+r file.txt
Each permission is represented by a number:
-
Read (r) = 4
-
Write (w) = 2
-
Execute (x) = 1
-
The permissions are represented by three digits:
- First digit for the owner
- Second digit for the group
- Third digit for others
-
Example: Set permissions to
rw-r--r--:chmod 644 file.txt
Breakdown:
- Owner (
rw-): 6 (read + write = 4 + 2) - Group (
r--): 4 (read) - Others (
r--): 4 (read)
- Owner (
To change the ownership of a file, the chown command is used:
-
Syntax:
chown [owner][:group] file -
Example: Change the owner to
user1and the group tostaff:chown user1:staff file.txt
-
Example: Change the owner to
user1only:chown user1 file.txt
To change the group ownership of a file, the chgrp command is used:
-
Syntax:
chgrp group file -
Example: Change the group ownership to
admin:chgrp admin file.txt
In Linux, Access Control Lists (ACLs) provide a more flexible permission model than the traditional user/group/other file permissions. ACLs allow you to set permissions for individual users or groups on specific files or directories.
Here’s how you can use setfacl and getfacl to manage and view ACLs:
The setfacl command is used to set ACLs on files and directories. It allows you to assign permissions to specific users or groups that are not part of the file’s owner, group, or other categories.
The getfacl command is used to view the current ACLs on a file or directory. It provides detailed information about the permissions set on the file for each user or group.
To assign specific permissions to a user for a file, use the setfacl command. For example:
setfacl -m u:username:rwx /path/to/file- Explanation:
-m: Modify (set) ACL.u:username:rwx: Grant the userusernameread (r), write (w), and execute (x) permissions on the file./path/to/file: The file or directory where ACL is being set.
Example:
setfacl -m u:john:rw /home/user/file.txtThis command grants read and write permissions to the user john on the file /home/user/file.txt.
Similarly, you can set permissions for a group. Use the g: flag to specify the group.
setfacl -m g:groupname:rx /path/to/directory- Explanation:
g:groupname:rx: Grant the groupgroupnameread (r) and execute (x) permissions./path/to/directory: The directory to set the ACL on.
Example:
setfacl -m g:devs:rx /projects/myprojectThis command grants read and execute permissions to the group devs on the /projects/myproject directory.
To set default ACLs for directories, which apply to newly created files and directories within it, use the -d option:
setfacl -d -m u:username:rw /path/to/directory- Explanation:
-d: Set default ACLs for files created within the directory.-m: Modify the ACL.u:username:rw: Grant read (r) and write (w) permissions tousernamefor newly created files in the directory.
Example:
setfacl -d -m u:alice:rw /projects/sharedThis ensures that any new files created in /projects/shared will automatically grant read and write permissions to the user alice.
You can also remove ACLs for specific users or groups using the -x option:
setfacl -x u:username /path/to/file- Explanation:
-x: Remove ACL entry.u:username: Specifies the user whose ACL will be removed.
Example:
setfacl -x u:bob /home/user/file.txtThis command removes the ACL for the user bob on the file /home/user/file.txt.
To view the current ACLs on a file or directory, use the getfacl command.
getfacl /path/to/fileExample:
getfacl /home/user/file.txtThis will display the ACLs set on the file /home/user/file.txt.
Sample Output:
# file: /home/user/file.txt
# owner: user
# group: users
user::rw-
user:john:rw-
group::r--
mask::rw-
other::r--- The output shows:
- Owner (
user) has read and write permissions. - User
johnhas read and write permissions. - Group has read permission.
- Mask sets the maximum permissions for all users.
- Others have read permission.
- Owner (
If you want to remove all ACLs from a file or directory and revert it to standard user/group/other permissions, you can use the -b option with setfacl:
setfacl -b /path/to/fileThis command removes all ACL entries from the file or directory, leaving only the basic permissions.
Networking in Linux refers to the configuration, management, and troubleshooting of network connections on Linux-based systems. It enables Linux machines to communicate with each other, access the internet, connect to servers, and share data securely and efficiently.
- IP Addressing: Assigns a unique identity to each device.
- Subnetting: Divides networks for better organization and security.
- Gateway: Routes traffic from your network to other networks.
- DNS (Domain Name System): Resolves human-readable domain names to IP addresses.
- Interfaces: Physical (e.g.,
eth0) or virtual (e.g.,lo) network devices used to send/receive data.
- Managing connectivity between microservices and cloud infrastructure.
- Configuring CI/CD pipelines to access remote servers or APIs.
- Monitoring and securing network traffic in production environments.
- Debugging failed deployments due to DNS or port issues.
ip a– Show IP addressping– Test connectivitynetstat/ss– Check listening portsdig/nslookup– DNS troubleshootingcurl– Test HTTP endpoints
0️⃣ IP Address - Private Class 🔍 Private IP ranges help in internal communication within networks.
-
Examples:
10.0.0.0 – 10.255.255.255172.16.0.0 – 172.31.255.255192.168.0.0 – 192.168.255.255
-
Use the online subnet calculator: https://www.davidc.net/sites/default/subnets/subnets.html
1️⃣ curl ifconfig.me
📡 Get your public IP address from a Linux terminal:
curl ifconfig.me🧠 Useful when setting up cloud VMs or whitelisting IPs in firewalls.
2️⃣ netstat -tlupn
📊 View all listening services and their ports:
sudo netstat -tlupnt– TCPu– UDPl– Listeningp– Show PIDn– Show numeric addresses
📍 Example:
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1234/apache23️⃣ traceroute google.com
🛰️ Shows the network path (hops) to a destination:
traceroute google.com🔎 Helps detect where latency or packet loss happens.
4️⃣ curl and wget
📥 Test endpoint and download files:
curl -I https://example.com # Header only
curl -O https://example.com/app.tar.gz
wget https://example.com/app.tar.gz📌 curl is good for APIs, wget is good for large file downloads.
5️⃣ nslookup google.com
🔎 Query DNS to find IP address of a domain:
nslookup google.com🧠 Helps troubleshoot DNS resolution issues.
6️⃣ dig google.com
📖 More detailed DNS query than nslookup:
dig google.com- Shows A record, TTL, authoritative info.
7️⃣ ifconfig / ip a / ip r
🛠️ Check network interfaces and routing table:
ifconfig # Deprecated but still used
ip a # Show all network interfaces and IPs
ip r # Show routing tablePrivate IP addresses are reserved for internal network use and are not routable on the public internet. They are defined by RFC 1918.([Network Lessons][1])
| Class | IP Range | Subnet Mask | Total Addresses | Typical Use Cases |
|---|---|---|---|---|
| A | 10.0.0.0 – 10.255.255.255 | 255.0.0.0 | 16,777,216 | Large enterprises, ISPs, cloud VPCs |
| B | 172.16.0.0 – 172.31.255.255 | 255.240.0.0 | 1,048,576 | Medium-sized networks, universities |
| C | 192.168.0.0 – 192.168.255.255 | 255.255.0.0 | 65,536 | Home networks, small businesses |
These ranges are commonly used in environments like home routers, corporate LANs, Docker containers, and cloud infrastructures.
| Feature | IPv4 | IPv6 |
|---|---|---|
| Address Length | 32-bit | 128-bit |
| Address Format | Decimal (e.g., 192.168.1.1) | Hexadecimal (e.g., 2001:0db8::1) |
| Total Addresses | ~4.3 billion | ~340 undecillion |
| Header Size | 20–60 bytes (variable) | 40 bytes (fixed) |
| Configuration | Manual or DHCP | Stateless auto-configuration or DHCPv6 |
| Security | Optional (IPSec) | Mandatory (IPSec) |
| Broadcast Support | Yes | No (uses multicast and anycast) |
| NAT Required | Yes, due to limited address space | No, ample address space |
| Packet Fragmentation | By sender and routers | By sender only |
| Adoption | Widely used, but address exhaustion issues | Growing adoption, especially in modern networks |