IPv4 Addresses Explained

An IPv4 address is a 32-bit number that identifies a network interface. We write it as four 8-bit numbers (octets) separated by dots: 192.168.1.42. Each octet is 0–255. That gives us about 4.3 billion possible addresses — and we ran out years ago.

What an IP address actually is

192      .  168     .  1       .  42
11000000 .  10101000.  00000001.  00101010

= 11000000101010000000000100101010 (32 bits)
= 3232235818 (one big number)

The dots are just for human readability.

Network portion vs host portion

An IP address is split into two parts:

  • Network portion — identifies the network
  • Host portion — identifies a specific machine on that network

The split is determined by the subnet mask (or CIDR prefix).

IP:           192.168.1.42
Subnet mask:  255.255.255.0   (or /24 in CIDR)

Network: 192.168.1.0
Host:    .42 (within that network)

Subnetting deserves its own deep dive. Coming up next on the roadmap.

The (now legacy) classful addressing

Originally, IP addresses were grouped by “class”:

Class Range Default mask Hosts
A 1–127.x.x.x /8 ~16 million
B 128–191.x.x.x /16 ~65 thousand
C 192–223.x.x.x /24 254
D 224–239.x.x.x multicast
E 240–255.x.x.x reserved

Classful addressing is obsolete. Modern networks use CIDR — variable-length subnet masks. Mention classes only when an old documentation forces you to.

Special addresses to know

  • 0.0.0.0 — “this network” / unspecified. Used to bind a server to all interfaces.
  • 127.0.0.1 — loopback. Always points back to your own machine.
  • 255.255.255.255 — broadcast to all hosts on this network.
  • 169.254.0.0/16 — link-local (auto-config when DHCP fails).

Private address ranges (RFC 1918)

Reserved for use inside private networks — never route over the internet:

  • 10.0.0.0/8
  • 172.16.0.0/12
  • 192.168.0.0/16

This is what NAT uses to make many devices share one public IP.

Why we ran out

4.3 billion addresses sounds like a lot. The internet has billions of phones, IoT devices, servers, cloud VMs. We’ve been out of free IPv4 since 2011. The two solutions: NAT (pack many devices behind one public IP) and IPv6 (much bigger address space).

Useful commands

# See your IPs
ip addr show              # Linux
ifconfig                   # macOS / older Linux
ipconfig                   # Windows

# Find your public IP
curl ifconfig.me
curl https://api.ipify.org

What to learn next

Subnetting and CIDR — the most useful network skill you can have. Up next.

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *