Data Communication and Networking
IP Address Classes; Subnetting and CIDR
C-CAT
IP Address Classes
Classful Addressing
IPv4 addresses are divided into 5 classes (A, B, C, D, E):
| Class | First Octet Range | Network Bits | Host Bits | Default Subnet Mask | # Networks | Hosts per Network |
|---|---|---|---|---|---|---|
| A | 1 – 126 | 8 | 24 | 255.0.0.0 (/8) | 126 | 16,777,214 |
| B | 128 – 191 | 16 | 16 | 255.255.0.0 (/16) | 16,384 | 65,534 |
| C | 192 – 223 | 24 | 8 | 255.255.255.0 (/24) | 2,097,152 | 254 |
| D | 224 – 239 | N/A | N/A | N/A | — | Multicast |
| E | 240 – 255 | N/A | N/A | N/A | — | Research/Reserved |
Note: 127.x.x.x is reserved for loopback (127.0.0.1 = localhost)
Binary Class Identification
| Class | First Bits | First Octet Range |
|---|---|---|
| A | 0xxxxxxx | 0 – 127 |
| B | 10xxxxxx | 128 – 191 |
| C | 110xxxxx | 192 – 223 |
| D | 1110xxxx | 224 – 239 |
| E | 1111xxxx | 240 – 255 |
Quick identification rule:
0xxxxxxx → Class A (starts with 0)
10xxxxxx → Class B (starts with 10)
110xxxxx → Class C (starts with 110)
1110xxxx → Class D (starts with 1110)
1111xxxx → Class E (starts with 1111)
Net ID and Host ID
Every IP address has two parts:
- Net ID (Network ID) — identifies the network
- Host ID — identifies the specific device within the network
Class A: | Net ID | Host ID |
| 8 bits | 24 bits |
| 1 octet | 3 octets |
Class B: | Net ID | Host ID |
| 16 bits | 16 bits
|
| 2 octets | 2 octets |
Class C: | Net ID | Host ID |
| 24 bits | 8 bits |
| 3 octets | 1 octet |
Subnetting and CIDR
What is Subnetting?
Subnetting divides a large network into smaller sub-networks (subnets).
Why subnet?
- Reduce network congestion (broadcast domains)
- Improve security (isolate departments)
- Better IP address utilization
- Easier troubleshooting
Subnet Mask
A subnet mask determines which part of an IP address is the network portion and which is the host portion.
IP Address: 192.168.1.100
Subnet Mask: 255.255.255.0 (same as /24)
Network part: 192.168.1.x (first 3 octets)
Host part: x.x.x.100 (last octet)
AND operation to find network address:
IP: 11000000.10101000.00000001.01100100 (192.168.1.100)
Mask: 11111111.11111111.11111111.00000000 (255.255.255.0)
AND: 11000000.10101000.00000001.00000000 (192.168.1.0) ← Network Address
CIDR — Classless Inter-Domain Routing
CIDR notation uses prefix length instead of class-based addressing.
192.168.1.0/24 → means 24 bits are network bits
→ same as 255.255.255.0
→ 2^8 = 256 addresses; 254 usable hosts
10.0.0.0/8 → 8 network bits
→ 2^24 = 16,777,216 addresses
Common CIDR blocks:
| CIDR | Subnet Mask | Hosts |
|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 |
| /16 | 255.255.0.0 | 65,534 |
| /24 | 255.255.255.0 | 254 |
| /25 | 255.255.255.128 | 126 |
| /26 | 255.255.255.192 | 62 |
| /27 | 255.255.255.224 | 30 |
| /28 | 255.255.255.240 | 14 |
| /30 | 255.255.255.252 | 2 |
Special addresses in a subnet:
- Network address — first address (all host bits = 0) — not assignable
- Broadcast address — last address (all host bits = 1) — sends to all hosts
- Usable hosts = 2^(host bits) - 2
Continue learning
Related notes
Definition of AI; Need of AI
Artificial Intelligence
Introduction to Data Engineering; Big Data — The 5 V's; Types of Data
Big Data and Data Engineering
Introduction to C Programming; C Program Structure; Data Types and Variables
C Programming
What Is a Computer?; Machine Cycle: Fetch–Decode–Execute; CPU Organization
Computer Architecture
Put this topic into timed practice
Open mock tests when you want full-exam pacing, or keep drilling in practice mode.