Skip to content

IP Addressing | Networking - Wyatt's Notes

IP addressing is the mechanism by which hosts are identified and located on an IP network. Every Networked device must have an IP address to participate in IP communication. This section covers IPv4 and IPv6 addressing, subnetting, NAT, DHCP, and ARP — the foundational addressing Infrastructure of the Internet.

An IPv4 address is a 32-bit number, represented in dotted decimal notation as four Octets separated by periods. Each octet represents 8 bits and ranges from 0 to 255.

192.168.1.100
Binary: 11000000.10101000.00000001.01100100
Octets: [ 192 ].[ 168 ].[ 1 ].[ 100 ]
Bits: [31 24][23 16][15 8][7 0]

The total IPv4 address space is 232=4,294,967,2962^{32} = 4,294,967,296 addresses. This was considered sufficient In the 1970s but is grossly inadequate for today”s Internet, where every smartphone, server, VM, and Container needs an address.

Working with IP addresses in binary is essential for understanding subnetting. Convert each octet:

192 = 128 + 64 = 11000000
168 = 128 + 32 + 8 = 10101000
1 = 1 = 00000001
100 = 64 + 32 + 4 = 01100100

Quick reference for binary-to-decimal conversion:

BitValueBitValueBitValueBitValue
7128664532416
38241201
AddressPurpose
0.0.0.0Unspecified source (used in DHCP requests, default route)
127.0.0.1Loopback (localhost) — packets never leave the host
255.255.255.255Limited broadcast (all hosts on the local segment)
169.254.0.0/16Link-local (APIPA — automatic when DHCP fails)
224.0.0.0/4Multicast (224.0.0.0-239.255.255.255)
240.0.0.0/4Reserved (formerly Class E, 240.0.0.0-255.255.255.255)
192.0.0.0/24IETF Protocol Assignments
192.0.2.0/24Documentation (RFC 5737, TEST-NET-1)
198.51.100.0/24Documentation (RFC 5737, TEST-NET-2)
203.0.113.0/24Documentation (RFC 5737, TEST-NET-3)

Before CIDR (Classless Inter-Domain Routing), IPv4 addresses were divided into five classes:

ClassFirst Octet RangeNetwork BitsHost BitsDefault Subnet MaskUsable Hosts
A0-127824255.0.0.0 (/8)16,777,214
B128-1911616255.255.0.0 (/16)65,534
C192-223248255.255.255.0 (/24)254
D224-239N/AN/AN/A (multicast)N/A
E240-255N/AN/AN/A (reserved)N/A

The class was determined by the first few bits of the first octet:

Class A: 0xxxxxxx (0-127)
Class B: 10xxxxxx (128-191)
Class C: 110xxxxx (192-223)
Class D: 1110xxxx (224-239)
Class E: 1111xxxx (240-255)

Classful addressing was wasteful. A company needing 300 hosts would receive a Class B (65,534 Hosts), wasting 65,234 addresses. A company needing 5 hosts would receive a Class C (254 hosts), Wasting 249 addresses. This inefficiency drove the adoption of CIDR in 1993 (RFC 1519).

IP addressing is like the postal address system for the internet. Every device needs a unique number (IP address) to be reachable. IPv4 uses 32-bit addresses (about 4 billion), which is why we ran out and needed IPv6 with 128-bit addresses. Subnetting divides a network into smaller pieces, like apartment numbers within a building. NAT lets many devices share one public IP address, acting like a receptionist who forwards mail to internal offices. DHCP automatically assigns addresses, and ARP maps IP addresses to MAC addresses on the local network.