CEN610S Core Engineering Networks - IPv4 Addressing and Prefixes

IPv4 Addressing Fundamentals

  • IP version 4 (IPv4) uses 32-bit32\text{-}bit addresses; total address space = 2322^{32} addresses.

  • Each host or router must have a unique address.

  • Two key elements: Address and Subnet mask.

  • Addressing written in dotted quad notation A.B.C.DA.B.C.D with each octet being 88 bits (example: 18.31.0.118.31.0.1).

IP Prefixes – Modern

  • Addresses are allocated in blocks called prefixes; all hosts in an L-bitL\text{-bit} prefix share the same top LL bits.

  • Number of addresses in a prefix: 232L2^{32-L}.

  • CIDR notation: A.B.C.D/LA.B.C.D/L;

    • E.g., 128.13.0.0/16128.13.0.0/16 covers 128.13.0.0128.13.0.0 to 128.13.255.255128.13.255.255.

    • E.g., /24 yields 28=2562^8 = 256 addresses; /32 yields 1 address.

  • Binary representations (optional): e.g. a /24 prefix defines the first 24 bits as the network; the remaining 8 bits are host bits.

IP Prefixes – More Specific / Less Specific

  • More specific prefix → longer prefix → smaller set of addresses.

  • Less specific prefix → shorter prefix → larger set of addresses.

  • Common prefix lengths: /8,/16,/24,/32,/0/8, /16, /24, /32, /0.

IP Address Classes – Historical

  • Classful addressing used fixed-size blocks with the class encoded in high-order bits; networks/hosts split by class:

    • Class A: 8-bit network portion

    • Class B: 16-bit network portion

    • Class C: 24-bit network portion

  • These class distinctions are historical and largely ignored in favor of CIDR.

Public / Private IP Addresses

  • Public IP addresses: globally routable on the Internet; must be allocated; space is finite.

  • Private IP addresses: internal use, not routable on the public Internet; NAT used to reach the Internet.

  • Private ranges (examples):

    • 10.0.0.0/810.0.0.0/8

    • 172.16.0.0/12172.16.0.0/12

    • 192.168.0.0/16192.168.0.0/16

Allocating Public IP Addresses

  • Allocation follows a hierarchy: IANA → RIRs (Regional Internet Registries) → ISPs/enterprises → customers/computers (via DHCP).

  • RIRs include: ARIN, APNIC, RIPE, LACNIC, AfriNIC.

IP Prefix in Practice / Subnet Mask

  • Subnet mask is often described by prefix length (e.g., /16) rather than decimal; default for Class B is /16 ≡ 255.255.0.0255.255.0.0.

  • Subnet mask helps decide if the destination is local to the sender's network.

  • Process (routing decision): devices perform ANDing between source/destination addresses and the subnet mask to determine locality.

ANDing and Locality (Subnetting)

  • Definition: local if (S&M)=(D&M)(S \& M) = (D \& M), where

    • SS = Source address, DD = Destination address, MM = Subnet mask.

  • Steps:

    • Compute source network ID: Snet=S&MS_{net} = S \& M

    • Compute destination network ID: Dnet=D&MD_{net} = D \& M

    • If S<em>net=D</em>netS<em>{net} = D</em>{net}, destination is local; otherwise, route via a gateway.1.1