IP Addressing & Subnets

IP Addressing

Every device on a network needs a unique address so other devices know where to send data - that's an IP address. There are two versions in active use, and Linux speaks both.

ConceptDetail
IPv432-bit, e.g. 192.168.1.10
IPv6128-bit, e.g. 2001:db8::1
CIDR/24 = 255.255.255.0 = 256 addresses
Private ranges10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16
Loopback127.0.0.1 (localhost)

An IPv4 address alone doesn't tell you which part identifies the network and which part identifies the specific host on it - that's what the CIDR suffix (/24, /16, etc.) is for. It's a count of how many leading bits are reserved for the network portion; the remaining bits identify individual hosts within that network. A /24 reserves 24 bits for the network and leaves 8 bits (256 possible values) for hosts.

Common CIDR sizes: /24 → 254 usable hosts, /16 → 65,534, /30 → 2 (point-to-point links, exactly enough for two ends of a direct connection).

Analogy: Think of an IP address plus its CIDR like a street address plus a ZIP code range. The ZIP code (network portion) tells the postal service which neighborhood to route mail toward; the house number (host portion) picks out one specific building within that neighborhood. Two devices need matching "ZIP codes" (the same network) before they can talk to each other directly, without a router in between.
Tip: Notice /24 yields 254 usable addresses, not a clean 256 - two addresses in every subnet are reserved and can never be assigned to a host. The very first address (all host bits set to 0) is the network address, identifying the subnet itself. The very last address (all host bits set to 1) is the broadcast address, used to send a message to every host on that subnet at once. This -2 pattern is worth memorizing, since it explains why subnet sizing math never gives you the full power-of-two number you'd expect at first glance.