IP addressing

IPv4 basics

A 32-bit binary number in dotted decimal, four octets of 0-255. The subnet mask marks the split: 1s are the network portion, 0s the host portion.

Classes by first octet, with default masks:

Address types

Assignment

Static is manual entry, error-prone at scale. Dynamic is DHCP using DORA (Discover, Offer, Request, Acknowledge). BOOTP is the ancestor: a static MAC-to-IP database for diskless workstations.

A fully configured client has an IP, subnet mask, default gateway, and DNS (or WINS for NetBIOS names in old Windows domains).

Data flows

Unicast is one to one, multicast is one to an opted-in group, and broadcast is one to everyone on the segment. IPv6 drops broadcast entirely and adds anycast (delivered to the nearest member of a group).

Binary math

Powers of 2 per bit position: 128, 64, 32, 16, 8, 4, 2, 1.

Binary to decimal: sum the positions holding a 1, so 10010110 = 128 + 16 + 4 + 2 = 150. Decimal to binary: subtract the largest power that fits and mark the 1s (167 = 10100111). Verify by converting back.

Subnetting

Borrow host bits to create subnets: subnets = 2^s (s = borrowed bits), and usable hosts = 2^h - 2 (h = host bits, minus the network ID and broadcast).

CIDR replaces classful masks and lets routes consolidate; VLSM sizes each subnet to what it needs (worked examples in my CCNA VLSM note).

The practice pattern: round each department up to the next power of 2 including network + broadcast.

54 users round to 64, a /26. 32 users also round to 64 and a /26, because 32 usable won’t fit 32 users after the minus 2. 5 users round to 8, a /29.

A /27 has 32 total and 30 usable; a /28 has 16 total and 14 usable. Read the question carefully: total vs assignable.

IPv6

128-bit addresses (340 undecillion), written as eight groups of four hex digits. Shorthand: drop leading zeros, and compress one run of all-zero groups with :: (once per address).

Features: no broadcasts, no fragmentation, and a simplified 5-field header.

Address types:

SLAAC self-configures addresses without a server using EUI-64 (which builds the 64-bit interface ID from the MAC); DHCPv6 also exists. NDP replaces ARP: router solicitation and advertisement, neighbor solicitation and advertisement, redirection.

Spotting formats: IPv4 is dotted decimal, IPv6 is hex groups with colons, and a MAC is 12 hex digits in pairs.

IPv4/IPv6 coexistence