IP Addressing & Subnetting

Master IPv4 address structure, subnet masks, CIDR notation, and how to calculate network ranges.

Easy 45m 4 tasks

Learning Objectives

  • Explain IPv4 address structure and octet notation
  • Convert between binary, decimal, and CIDR notation
  • Calculate network address, broadcast, and usable hosts
  • Identify private vs public IP ranges

IPv4 Addressing

An IPv4 address is a 32-bit number written as four decimal octets separated by dots:

192   .  168  .   1   .  10
11000000.10101000.00000001.00001010

Each octet is 8 bits → values 0–255.

Address Classes (Classic)

Class First Octet Default Mask Networks Hosts/Network
A 1–126 /8 (255.0.0.0) 126 ~16 million
B 128–191 /16 (255.255.0.0) 16,384 ~65,000
C 192–223 /24 (255.255.255.0) 2 million 254
D 224–239 Multicast
E 240–255 Reserved

Modern networking uses CIDR instead of classes — classes are legacy knowledge.

Private IP Ranges (RFC 1918)

These addresses are not routable on the internet — used internally:

Range CIDR Usage
10.0.0.0 – 10.255.255.255 /8 Large enterprises
172.16.0.0 – 172.31.255.255 /12 Medium networks
192.168.0.0 – 192.168.255.255 /16 Home / small office

CIDR & Subnet Masks

CIDR (Classless Inter-Domain Routing) uses a /prefix to define how many bits are the network portion:

192.168.1.0/24
               24 network bits  8 host bits  2 - 2 = 254 usable hosts
CIDR Mask Hosts
/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

Subnet Calculation — Step by Step

Given: 192.168.10.130/26

  1. Mask: /26 → 255.255.255.192 → last octet = 11000000
  2. Block size: 256 - 192 = 64
  3. Subnets start at: 0, 64, 128, 192
  4. 130 falls in the 128 subnet
  5. Network address: 192.168.10.128
  6. Broadcast: 192.168.10.191 (128 + 64 - 1)
  7. Usable hosts: .129.190 = 62 hosts

Special Addresses

Address Meaning
127.0.0.1 Loopback (this machine)
0.0.0.0 Unspecified / all interfaces
255.255.255.255 Limited broadcast
x.x.x.0 Network address (not assignable)
x.x.x.255 (in /24) Broadcast (not assignable)

An IPv4 address is a 32-bit number written as four decimal octets (0–255) separated by dots.

IPv4 Address Breakdown
Reading an IP Address
OctetDecimalBinary
1st19211000000
2nd16810101000
3rd100000001
4th1000001010
Each octet = 8 bits. 8 bits can represent 0–255 (2⁸ = 256 values). Four octets × 8 bits = 32 total bits.
✦ Answer the questions to complete this task

How many bits does an IPv4 address contain?

What is the maximum value a single octet can hold?

Private IPs (RFC 1918) are used inside LANs and are NOT routable on the internet. Public IPs are globally unique and reachable from anywhere.

Private IP Ranges (RFC 1918)
RangeCIDRUse Case
10.0.0.0 – 10.255.255.255/8Large enterprises
172.16.0.0 – 172.31.255.255/12Medium networks
192.168.0.0 – 192.168.255.255/16Home / small office
Special Addresses
127.0.0.1 — Loopback (this machine)
0.0.0.0 — Unspecified / any interface
255.255.255.255 — Limited broadcast
169.254.x.x — APIPA — DHCP failed
⚠ Security: Seeing a 169.254.x.x address means DHCP failed — the OS self-assigned an IP. Check your cable or WiFi connection.
✦ Answer the questions to complete this task

Which IP range is a private address (RFC 1918)?

What does the loopback address 127.0.0.1 represent?

CIDR (Classless Inter-Domain Routing) uses a /prefix to define how many bits are the network portion.

192.168.1.0/24 ↑ 24 network bits → 8 host bits → 2⁸ - 2 = 254 usable hosts
CIDRSubnet MaskHosts AvailableExample Use
/24255.255.255.0254Home / small office
/25255.255.255.128126Split /24 in half
/26255.255.255.19262Department LAN
/27255.255.255.22430Small group
/30255.255.255.2522Point-to-point link
Formula: Usable hosts = 2^(host bits) − 2. Subtract 2 for network address (.0) and broadcast address (.255).
✦ Answer the questions to complete this task

How many usable hosts does a /26 subnet provide?

What is the subnet mask for a /25 network?

Given any IP + mask, you can find the network address, broadcast, and usable host range in 4 steps.

Worked Example: 192.168.10.130/26
1
Find the mask

/26 → 255.255.255.192 — last octet = 11000000

2
Calculate block size

256 − 192 = 64 — subnets start at 0, 64, 128, 192...

3
Locate the subnet

130 falls in the 128 block (128 ≤ 130 < 192)

4
Calculate range

Network: .128 → Broadcast: .191 → Usable: .129 – .190 (62 hosts)

Result
Network Address
192.168.10.128
Broadcast
192.168.10.191
First Usable
192.168.10.129
Last Usable
192.168.10.190
✦ Answer the questions to complete this task

What is the network address of 192.168.5.200/27?

How many bits are the 'host portion' in a /26 network?

💪 Exercises & Challenges

⚙️ Practical Easy +25 XP

Subnet Calculator Lab

## Task: Manual Subnetting Solve the following subnetting problems **without a calculator** (then verify with `ipcalc`). ### Problem Set **Problem 1**: You have `10.10.20.0/24` and need 4 equal sub

Start →
🚩 Challenge Easy +50 XP

Find the Network Address

A host has IP address `10.20.30.200` with subnet mask `255.255.255.224`. Calculate the **network address** of this subnet. Submit as `FLAG{x.x.x.x}`.

Start →