IP addresses
An IPv4 address is 32 bits long, which allows 4,294,967,296 addresses. The free pool ran out on 3 February 2011.
A common belief is that each device has one IP address for life, like a serial number printed inside it. It does not. The same phone gets one address on home Wi-Fi, a different one on mobile data, and may get a new one tomorrow. To see why addresses come and go, start with what an address is for.
Every packet carries two addresses in its header: where it came from and where it is going. These are IP addresses. A router reads the destination address, and nothing else, to decide where a packet goes next. So the way addresses are built shapes how the whole internet works.
Why no part is bigger than 255
The version most people still meet is IPv4, set out in RFC 791 in 1981. An IPv4 address is 32 bits. To make it readable, it is split into four groups of 8 bits, each written as a decimal number from 0 to 255, with dots in between, as in 192.168.0.12. Eight bits hold 256 patterns, so 255 is the top. All together there are 2 to the power 32 addresses: 4,294,967,296, a little under 4.3 billion.
The front of an address names the network
An address has two parts. The front part, the prefix, names a network, and the rest picks one device on it. The prefix length goes after a slash. In 192.168.0.0/24 the first 24 bits are fixed, which leaves 8 bits, or 256 addresses, for that network. This is what lets a router keep a single rule such as "everything starting 198.51.100 goes that way" instead of a rule for every device.
Why the number on a home laptop starts with 192.168
RFC 1918 sets aside three blocks for private networks: 10.0.0.0/8, 172.16.0.0/12 and 192.168.0.0/16. Anyone may use them inside a home or an office, and routers on the public internet do not carry them. That is why a laptop at home probably has an address like 192.168.0.12, and why the neighbour's laptop may have exactly the same one. When the laptop talks to a server, the home router swaps the private source address for its own public address and changes the source port too, so replies can find their way back. This is network address translation (NAT). It lets a whole household share one public IPv4 address.
Drag to turn. Scroll or pinch to zoom.
Who lends a device its address
So where does the laptop's address come from? When a device joins a network, it broadcasts a request, and the router answers with a free private address, the router's own address to use as the gateway, and the address of a DNS resolver. This exchange is DHCP (RFC 2131). The address is lent for a limited time and renewed while the device stays connected, so the same laptop can get a different number tomorrow. Join a school's Wi-Fi and the same exchange happens with that network's DHCP server. On mobile data the phone gets its address from the mobile network instead. The other end can change too, because a website can move to a new server. That is one reason we use names such as example.com, and the DNS unit shows how names become addresses.
One address means the same thing on every computer. The loopback address, 127.0.0.1, always means "this machine", so a program can use it to talk to another program on the same computer without anything leaving it. And many devices today hold an IPv4 address and an IPv6 address side by side, using whichever the other end supports.
Four billion addresses ran out
Four billion addresses sounded like plenty in 1981. On 3 February 2011 the Internet Assigned Numbers Authority (IANA) handed its last five blocks of IPv4 space to the five regional registries, and the central free pool was empty. The long-term answer is IPv6 (RFC 8200), whose addresses are 128 bits long. That gives 2 to the power 128 addresses, about 3.4 × 10³⁸. IPv6 addresses are written as eight groups of four hexadecimal digits separated by colons. Leading zeros in a group can be dropped, and one run of all-zero groups can be replaced by "::". So 2001:0db8:0000:0000:0000:0000:0000:0020 shortens to 2001:db8::20.
| IPv4 address | 32 bits, written as four numbers 0 to 255 |
| IPv6 address | 128 bits, eight groups of hex digits |
| Prefix /24 | The first 24 bits name the network; 256 addresses remain |
| Private address | 10/8, 172.16/12, 192.168/16 (RFC 1918) |
| NAT | The router swaps private source addresses for its public one |
| MAC address | Hardware address used inside one local network |
- How many bits long is an IPv4 address?
- How many different IPv4 addresses are there?
- What is the largest number that can appear in one part of an IPv4 address?
- The first part of 192.168.0.12 is 11000000 in binary. What is 10101000 in decimal?
- Which address is private under RFC 1918?
- 172.20.0.5
- 172.32.0.5
- 8.8.8.8
- 198.51.100.20
- How many addresses are in a /24 network?
- What does NAT on a home router do?
- Swaps private source addresses for the router's public address
- Encrypts every packet
- Turns names into addresses
- Makes Wi-Fi faster
- How many bits long is an IPv6 address?
- Which is the short form of 2001:0db8:0000:0000:0000:0000:0000:0020?
- 2001:db8::20
- 2001:db8:20
- 2001::db8::20
- 21:db8::2
- In which year did IANA give out its last free blocks of IPv4 addresses?
- "My IP address is fixed to my phone for good." Addresses are lent. DHCP (RFC 2131) hands one out for a limited time, and a phone gets a different address on mobile data than on home Wi-Fi. The number fixed to the hardware is the MAC address, and that one is only used inside a local network.
- "The 192.168.0.12 in my settings is my address on the whole internet." It is a private address (RFC 1918). Routers on the public internet do not carry it, and plenty of other homes may use the very same number. Servers see the router's public address, which NAT puts in its place.
- "One part of an IPv4 address can go up to 999." Each part is 8 bits, which allows 256 values, 0 to 255. An address such as 192.168.300.1 is not valid.
- "IPv6 addresses are four times as long, so there are four times as many." Each extra bit doubles the count. 128 bits against 32 bits is 96 more bits, so there are 2 to the power 96 times as many addresses, about 7.9 × 10²⁸ times.
- IPv4 addresses are 32 bits, written as four numbers 0 to 255: 4,294,967,296 in all.
- The prefix (/24 and so on) names the network; the rest names the device.
- Private ranges 10/8, 172.16/12 and 192.168/16 stay inside homes and offices; NAT shares one public address.
- IPv6 uses 128-bit addresses written in hexadecimal, with "::" for a run of zeros.
Sources for this course (28)
- (checked 2026-10-17; reordered 2026-10-19: standards first, then official documentation, then operators and papers, history sources last)
- IETF RFCs (rfc-editor.org): RFC 768 UDP (1980, 8-byte header)
- RFC 791 IPv4 (1981, 32-bit addresses, "does not provide a reliable communication facility", TTL field "measured in units of seconds" but every module must decrease it by at least one, so it is only an upper bound)
- RFC 792 ICMP (Time Exceeded)
- RFC 801 NCP/TCP transition plan (1 January 1983)
- RFC 894 Ethernet (1500-byte payload)
- RFC 1034 and RFC 1035 DNS (1987, HOSTS.TXT kept by SRI-NIC, labels up to 63 octets and names up to 255, TTL in seconds)
- RFC 1122 (127.0.0.0/8 loopback)
- RFC 1918 private addresses (10/8, 172.16/12, 192.168/16)
- RFC 2131 DHCP, RFC 3022 NAT, RFC 3596 AAAA records, RFC 3849 and RFC 5737 documentation addresses, RFC 4271 BGP-4, RFC 4291 IPv6 text form, RFC 6298 TCP retransmission timer (initial RTO 1 second)
- RFC 6335 port ranges (0-1023, 1024-49151, 49152-65535)
- RFC 7766 DNS over TCP, RFC 8200 IPv6 (128-bit addresses, Hop Limit)
- RFC 8446 TLS 1.3 (one round-trip handshake)
- RFC 9000 QUIC and RFC 9114 HTTP/3, RFC 9110 HTTP semantics (status code classes)
- RFC 9293 TCP (three-way handshake, sequence numbers)
- IANA: ip-parameters registry (recommended default TTL 64)
- IPv4 free pool depleted 3 February 2011 (NRO and ARIN announcements)
- Official documentation: MDN Web Docs "How does the Internet work?" (45 cables for 10 computers, switches, routers, MAC and IP addresses, internet and web)
- "What is a URL?", "HTTP response status codes" (developer.mozilla.org)
- Cloudflare Learning Center: "What is DNS?" (four kinds of DNS server, 8 steps of an uncached lookup, browser and OS caches, TTL)
- "What is HTTP/3?" (cloudflare.com/learning)
- Google Chrome Help, "Browse in Incognito mode" (support.google.com/chrome/answer/95464, checked 2026-10-19: Incognito limits what is saved to the device; websites and organisations that manage your network, like your school, employer or internet service provider, may be able to observe your activity)
- Operators and papers: root-servers.org (13 root name servers run by 12 organisations, 2047 instances on 2026-10-17)
- Jacobson and Karels 1988, Congestion Avoidance and Control (loss mostly congestion)
- History blocks only: UCLA Samueli School of Engineering, Internet50 (first ARPANET message "LO", UCLA to SRI, 29 October 1969, 22:30)
- historyofinformation.com and Wikipedia ARPANET (Kline)
- Spiceworks/SRI history (HOSTS.TXT kept by SRI-NIC)
- Numbers (2^32, 2^96, 45 and 6 cables, packet counts, round-trip times)
Checked: 2026-10-17