What an IP Address Actually Is
An IP address is a 32-bit number. We write it in dotted decimal , four groups of 8 bits, each expressed as a number from 0 to 255. So 192.168.1.1 is really 11000000.10101000.00000001.00000001 in binary. The human-readable format is just easier to work with.
Every device on a network that communicates at Layer 3 needs at least one IP address. That includes routers, switches with management interfaces, servers, PCs, and virtual machines.
The Subnet Mask: Network vs Host
An IP address has two parts: the network portion and the host portion. The subnet mask tells you where the boundary is. A /24 mask (255.255.255.0) means the first 24 bits are the network and the last 8 bits identify the host within that network.
IP address: 192.168.1.50 = 11000000.10101000.00000001.00110010
Subnet mask: 255.255.255.0 = 11111111.11111111.11111111.00000000 |---- network portion ----|-- host -|
Network: 192.168.1.0
Two devices with the same network portion are on the same subnet. They can reach each other directly without going through a router.
Private Address Space (RFC 1918)
Three ranges are reserved for private use. These addresses are never routed on the public internet.
10.0.0.0/8, 16.7 million addresses. Used in large enterprise networks.172.16.0.0/12, 1 million addresses. Less common, often seen in cloud provider infrastructure.192.168.0.0/16, 65,536 addresses. Home routers, small offices, lab networks.
Private addresses exist because IPv4 was designed when the internet was much smaller. There aren't enough public IPv4 addresses for every device, so we use private addresses internally and NAT (Network Address Translation) to share public addresses at the edge.
Public Addresses
Everything not in the private ranges is a public address (with some exceptions for loopback, multicast, etc.). Public addresses are globally unique and routable on the internet. IANA (Internet Assigned Numbers Authority) allocates blocks to Regional Internet Registries (ARIN, RIPE, APNIC, etc.), which allocate to ISPs, which assign to customers.
Getting a public IP block today requires going through an ISP or applying to your RIR directly. IPv4 address exhaustion means RIRs are out of new blocks; most allocations now are from returned or transferred space.
Loopback and Special Addresses
127.0.0.0/8 is the loopback range. Any address in this range routes back to the local machine. 127.0.0.1 (localhost) is the most common. This is not a real network interface , it's a software construct the kernel handles internally.
On routers and switches, the loopback interface is different: a logical interface you configure with interface loopback0. It's always up as long as the device is up, and it's commonly used as the router ID for BGP and OSPF, and as the source interface for management sessions.
Other special ranges: 169.254.0.0/16 is link-local (auto-assigned when DHCP fails, also used by Azure and AWS for instance metadata). 0.0.0.0 means "any address" in routing contexts. 255.255.255.255 is the limited broadcast , sent to everyone on the local subnet.
IPv4 Exhaustion and NAT
The IPv4 address space has about 4.3 billion addresses. That sounds like a lot, but once you allocate blocks for private use, multicast, and legacy waste, the usable public address space is much smaller. IANA exhausted its free pool in 2011. ARIN (North America) ran out in 2015.
NAT (Network Address Translation) is what makes this work at scale. A home router has one public IP and uses NAT to give every device on the home network a private address. The router keeps a translation table and rewrites source/destination IPs on packets crossing the boundary.
IPv6: The Actual Fix
IPv6 uses 128-bit addresses. That's 2^128 possible addresses , a number so large it's effectively inexhaustible. Written in hex, colon-separated: 2001:0db8:85a3::8a2e:0370:7334. Double-colon compresses consecutive groups of zeros.
IPv6 address types: global unicast (like a public IPv4, starts with 2001: or 2600:), link-local (starts with fe80:, auto-configured on every interface, only valid on that link), and unique-local (like private IPv4, starts with fc00::/7).
IPv6 doesn't use NAT by design. Every device gets a globally routable address. The privacy concern this raises is handled by privacy extensions (randomized interface IDs).
How a Device Decides to Use the Default Gateway
When a device wants to send a packet, it first checks: is the destination on the same subnet as me? If yes, it sends directly (via ARP to find the MAC address). If no, it sends to the default gateway , typically the router's interface on that subnet.
This decision is entirely local. The device doesn't know the full network topology. It just knows two things: its own subnet, and where to send everything else.
Watch the video
This topic has a full video on YouTube.
Comments (0)
Please sign in to comment.