Networking Fundamentals
IP Address Classes, Subnetting and CIDR Explained
Learn how IPv4 addresses are structured, what subnet masks and CIDR prefixes mean, and how to calculate network IDs, broadcast addresses, host ranges and subnet sizes using practical examples.
Subnetting often looks difficult because several ideas—IP addresses, binary numbers, subnet masks, CIDR prefixes, network IDs and broadcast addresses—are introduced at the same time. Once you understand what each part represents, the calculation becomes a repeatable process instead of a memorization exercise.
32 bits An IPv4 address contains four 8-bit octets.
CIDR prefix /24 means the first 24 bits identify the network.
Host portion The remaining bits identify devices inside the subnet.
Subnet size Total addresses = 2^(32 − prefix) .
What you will learn
- How IPv4 addresses are represented in decimal and binary.
- What the historical IP address classes A, B, C, D and E mean.
- Why modern networks use CIDR instead of classful addressing.
- How subnet masks separate network bits from host bits.
- How to calculate subnet count, address count and usable hosts.
- How to identify the network address, first host, last host and broadcast address.
- How to divide a /24
- How to plan networks using Variable Length Subnet Masking.
1. What is an IPv4 address?
An IPv4 address is a 32-bit logical address assigned to a network interface. It is normally displayed as four decimal numbers separated by dots. Each number is called an octet because it represents eight bits.
192.168.10.25
192 168 10 25
11000000 10101000 00001010 00011001
8 bits + 8 bits + 8 bits + 8 bits = 32 bits
Every bit has a value. In one octet, the values are:
Bit position 128 64 32 16 8 4 2 1 Binary example 1 1 0 0 0 0 0 0 Decimal total 128 + 64 = 192
2. Historical IP address classes
Early IPv4 networks were divided into fixed classes according to the first octet. This is called classful addressing . It is useful for understanding older documentation and networking fundamentals, but modern networks use CIDR because fixed classes waste address space.
Class First-octet range Default mask Default prefix Traditional purpose A 1–126 255.0.0.0 /8 Very large networks B 128–191 255.255.0.0 /16 Medium networks C 192–223 255.255.255.0 /24 Small networks D 224–239 Not applicable — Multicast E 240–255 Not applicable — Reserved or experimental
Important: The address 127.0.0.0/8 is reserved for loopback testing, so 127 is not used as a normal Class A network. Also, classful boundaries are no longer how modern networks are allocated; CIDR prefixes such as /20 , /27 and /30 are common.
Private IPv4 address ranges
10.0.0.0/8 10.0.0.0 to 10.255.255.255
172.16.0.0/12 172.16.0.0 to 172.31.255.255
192.168.0.0/16 192.168.0.0 to 192.168.255.255
These private ranges are commonly used inside homes, offices, data centres and cloud virtual networks. They are not routed directly across the public internet.
3. What is a subnet?
A subnet is a logical division of a larger IP network. Instead of placing every device in one large broadcast domain, administrators divide the address space into smaller networks for departments, applications, security zones, availability zones or environments.
192.168.10.0/24 divided into four /26 subnets
Original network 192.168.10.0/24 256 addresses
→
Subnet 1 192.168.10.0/26
Subnet 2 192.168.10.64/26
Subnet 3 192.168.10.128/26
Subnet 4 192.168.10.192/26
Subnetting improves address utilisation, limits broadcasts, simplifies routing, and lets security rules be applied between groups of systems.
4. Subnet masks and CIDR notation
A subnet mask contains consecutive binary ones followed by consecutive binary zeros. The ones identify the network portion; the zeros identify the host portion.
IP address: 192.168.10.25
Subnet mask: 255.255.255.0
CIDR prefix: /24
Mask binary: 11111111.11111111.11111111.00000000
Network bits: 24 | Host bits: 8
CIDR Subnet mask Total addresses Traditional usable hosts Block size /24 255.255.255.0 256 254 256 /25 255.255.255.128 128 126 128 /26 255.255.255.192 64 62 64 /27 255.255.255.224 32 30 32 /28 255.255.255.240 16 14 16 /29 255.255.255.248 8 6 8 /30 255.255.255.252 4 2 4
The traditional usable-host calculation subtracts two addresses: one network address and one broadcast address. Special prefixes such as /31 on point-to-point links and /32 host routes follow different rules.
5. Core subnetting formulas
Total addresses
2^(32 − prefix)
Example: /26 → 2⁶ = 64 addresses.
Usable hosts
2^host-bits − 2
Example: 64 total − network − broadcast = 62.
Created subnets
2^borrowed-bits
Borrowing 2 host bits creates 4 equal subnets.
6. Step-by-step example: divide 192.168.10.0/24 into four subnets
Step 1: Determine how many bits to borrow
We need four subnets. Find the smallest number of bits where 2^n is at least four:
2^2 = 4 Borrowed bits = 2 Original prefix = /24 New prefix = /24 + 2 = /26Join the discussion
0 CommentsAsk questions, add context, or share what worked.
More from Melochip Editorial
Learn what Playwright testing is, why modern QA teams use it, how testers can get started, and the major types...
7 min read · Sep 19, 2026
Learn how Kubernetes Deployments and ReplicaSets work with practical YAML, scaling, self-healing, rolling upda...
7 min read · Sep 17, 2026
Learn Kubernetes security best practices with RBAC, Secrets, ServiceAccounts, Pod securityContext, NetworkPoli...
6 min read · Sep 17, 2026Related articles
Learn Linux from the ground up with simple explanations of the kernel, distributions, filesystem, commands, pe...
4 min read · Updated Oct 1, 2026
Learn how Kubernetes Deployments and ReplicaSets work with practical YAML, scaling, self-healing, rolling upda...
7 min read · Sep 17, 2026
Learn Kubernetes monitoring and logs with kubectl logs, events, metrics-server, top commands, Prometheus, Graf...
5 min read · Sep 17, 2026
Learn Kubernetes Ingress with controllers, IngressClass, host and path routing, TLS, DNS, annotations, redirec...
8 min read · Sep 17, 2026Stay in the loop. Get new Melochip articles
Receive Melochip article updates when new articles are available. Explicit opt-in only.
No comments yet. Start the discussion.