Stage 3 · Build
TCP/IP Fundamentals
IP Addressing & Subnetting
IPv4, IPv6, CIDR notation, subnets, and classless routing.
IPv4 Addresses
An IPv4 address is a 32-bit number written as four octets separated by dots: 192.168.1.1. Each octet ranges from 0 to 255. The address space gives us roughly 4.3 billion unique addresses, which seemed like plenty in 1981 but is now exhausted for public use.
Every IP address has two parts: a network prefix that identifies the subnet, and a host portion that identifies the specific device. The subnet mask determines where the split is.
IP Address: 192.168.1.100
Subnet Mask: 255.255.255.0
||||| ||||| ||||| |||||
Binary mask: 11111111.11111111.11111111.00000000
|--- network (24 bits) ---|- host (8 bits) -|The mask tells us which bits belong to the network and which belong to the host. A 255 means all bits are network bits. A 0 means all bits are host bits.
CIDR Notation
CIDR Notation
Classless Inter-Domain Routing (CIDR) replaced the old classful system. Instead of class A/B/C networks, CIDR uses a slash notation to indicate the prefix length: 192.168.1.0/24 means the first 24 bits are the network prefix.
| CIDR | Subnet Mask | Hosts | Typical Use |
|---|---|---|---|
| /8 | 255.0.0.0 | 16,777,214 | Legacy Class A |
| /16 | 255.255.0.0 | 65,534 | Legacy Class B |
| /24 | 255.255.255.0 | 254 | Small office network |
| /28 | 255.255.255.240 | 14 | Point-to-point links |
| /32 | 255.255.255.255 | 1 | Host route (single IP) |
# Linux
ip addr show
# macOS
ifconfig en0
# See the subnet for a specific interface
ip addr show eth0 | grep inetThe output shows your IP address and prefix length. 10.0.0.5/24 means the network is 10.0.0.0/24 and the host is .5 on that network.
Subnetting in Practice
Subnetting splits a larger network into smaller subnets. You borrow bits from the host portion to create additional subnet bits. Going from /24 to /28 gives you 16 subnets (2^4) of 14 hosts each (2^4 - 2, minus network and broadcast addresses).
10.0.0.0/28 - hosts 10.0.0.1 to 10.0.0.14
10.0.0.16/28 - hosts 10.0.0.17 to 10.0.0.30
10.0.0.32/28 - hosts 10.0.0.33 to 10.0.0.46
...
10.0.0.240/28 - hosts 10.0.0.241 to 10.0.0.254Each /28 subnet has 16 addresses. The first is the network address, the last is the broadcast. That leaves 14 usable host addresses per subnet.
Number of subnets = 2^(new prefix - old prefix). Hosts per subnet = 2^(32 - new prefix) - 2. A /26 gives 2^(26-24) = 4 subnets of 62 hosts each.
Private Address Ranges
RFC 1918 defines three private IPv4 ranges that are not routable on the public internet. These are used internally in homes, offices, and data centers.
| Range | CIDR | Addresses | Use Case |
|---|---|---|---|
| 10.0.0.0 - 10.255.255.255 | /8 | 16.7M | Large enterprises, cloud VPCs |
| 172.16.0.0 - 172.31.255.255 | /12 | 1M | Medium networks |
| 192.168.0.0 - 192.168.255.255 | /16 | 65K | Home and small office |
Cloud providers use private ranges extensively. AWS VPCs, GCP VPCs, and Azure VNets all use 10.0.0.0/8 or 172.16.0.0/12 ranges internally. NAT provides internet access from these private ranges.
IPv6 Essentials
IPv6 uses 128-bit addresses, written as eight groups of four hexadecimal digits separated by colons. The address space is 2^128 — roughly 3.4 x 10^38 addresses. IPv6 was designed to eliminate NAT and restore end-to-end connectivity.
Full form: 2001:0db8:0000:0000:0000:0000:0000:0001
Compressed: 2001:db8::1
Loopback: ::1
Link-local: fe80::1Leading zeros in each group can be omitted. A single :: replaces one contiguous block of all-zero groups. You can only use :: once in an address.
# Check if you have an IPv6 address
ip -6 addr show
# Test IPv6 connectivity
ping6 google.com
# Check DNS resolution with AAAA records
dig AAAA google.comMost modern operating systems have IPv6 enabled by default. Dual-stack systems run both IPv4 and IPv6 simultaneously.
IPv6 is not just about more addresses. It simplifies networking by eliminating NAT, improving multicast support, and enabling stateless address autoconfiguration. Most cloud providers now support IPv6 natively.
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.