IP addresses uniquely identify devices on a network. Understanding addressing and subnetting is fundamental to network design and troubleshooting.

IPv4 Addressing

32-bit addresses written in dotted decimal notation: 192.168.1.1

Private Address Ranges (RFC 1918)

ClassRangeCIDRHosts
A10.0.0.0 - 10.255.255.25510.0.0.0/816,777,214
B172.16.0.0 - 172.31.255.255172.16.0.0/121,048,574
C192.168.0.0 - 192.168.255.255192.168.0.0/1665,534

Special Addresses

  • 127.0.0.0/8 - Loopback (localhost)
  • 169.254.0.0/16 - Link-local (APIPA, when DHCP fails)
  • 0.0.0.0 - Default route / “any address”
  • 255.255.255.255 - Broadcast

CIDR Notation

Classless Inter-Domain Routing replaced classful addressing. The /n suffix indicates the number of network bits.

CIDRSubnet MaskHosts
/32255.255.255.2551
/24255.255.255.0254
/16255.255.0.065,534
/8255.0.0.016,777,214

Quick mental maths: Hosts = 2^(32-n) - 2 (subtract network and broadcast addresses)

Subnetting

Dividing a network into smaller segments for:

  • Security isolation
  • Reduced broadcast domains
  • Efficient IP allocation

Subnetting Example

Given 192.168.1.0/24, create 4 subnets:

  • Need 2 additional bits (2^2 = 4 subnets)
  • New prefix: /26 (24 + 2)
  • Each subnet: 64 addresses (62 usable)
SubnetNetworkUsable RangeBroadcast
1192.168.1.0/26.1 - .62.63
2192.168.1.64/26.65 - .126.127
3192.168.1.128/26.129 - .190.191
4192.168.1.192/26.193 - .254.255

IPv6 Addressing

128-bit addresses written in hexadecimal: 2001:0db8:85a3:0000:0000:8a2e:0370:7334

Shorthand rules:

  • Leading zeros can be omitted: 2001:db8:85a3:0:0:8a2e:370:7334
  • One group of consecutive zeros can be replaced with ::: 2001:db8:85a3::8a2e:370:7334

Common IPv6 Ranges

  • ::1/128 - Loopback
  • fe80::/10 - Link-local
  • fc00::/7 - Unique local (like private IPv4)
  • 2000::/3 - Global unicast (public)

NAT (Network Address Translation)

Translates private IPs to public IPs at the network boundary.

  • SNAT (Source NAT) - Outbound traffic, many-to-one
  • DNAT (Destination NAT) - Inbound traffic, port forwarding
  • PAT (Port Address Translation) - Multiple hosts share one public IP via ports

NAT breaks end-to-end connectivity but conserves IPv4 addresses. IPv6 was designed to eliminate the need for NAT.

References